Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

github-runner: fix package layout and script patches #186325

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,21 @@ stdenv.mkDerivation rec {

# Install the helper scripts to bin/ to resemble the upstream package
mkdir -p $out/bin
install -m755 src/Misc/layoutbin/runsvc.sh $out/bin/
install -m755 src/Misc/layoutbin/RunnerService.js $out/lib/
install -m755 src/Misc/layoutroot/run.sh $out/lib/
install -m755 src/Misc/layoutroot/config.sh $out/lib/
install -m755 src/Misc/layoutroot/env.sh $out/lib/
install -m755 src/Misc/layoutbin/runsvc.sh $out/bin/
install -m755 src/Misc/layoutbin/RunnerService.js $out/lib/
install -m755 src/Misc/layoutroot/run.sh $out/lib/
install -m755 src/Misc/layoutroot/run-helper.sh.template $out/lib/run-helper.sh
install -m755 src/Misc/layoutroot/config.sh $out/lib/
install -m755 src/Misc/layoutroot/env.sh $out/lib/

# Rewrite reference in helper scripts from bin/ to lib/
substituteInPlace $out/lib/run.sh --replace '"$DIR"/bin' "$out/lib"
substituteInPlace $out/lib/config.sh --replace './bin' "$out/lib"
substituteInPlace $out/lib/run.sh --replace '"$DIR"/bin' '"$DIR"/lib'
substituteInPlace $out/lib/config.sh --replace './bin' $out'/lib' \
--replace 'source ./env.sh' $out/bin/env.sh

# Remove uneeded copy for run-helper template
substituteInPlace $out/lib/run.sh --replace 'cp -f "$DIR"/run-helper.sh.template "$DIR"/run-helper.sh' ' '
substituteInPlace $out/lib/run-helper.sh --replace '"$DIR"/bin/' '"$DIR"/'

# Make paths absolute
substituteInPlace $out/bin/runsvc.sh \
Expand Down Expand Up @@ -269,7 +275,7 @@ stdenv.mkDerivation rec {
wrap() {
makeWrapper $out/lib/$1 $out/bin/$1 \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath (buildInputs ++ [ openssl ])} \
''${@:2}
"''${@:2}"
}

fix_rpath Runner.Listener
Expand All @@ -279,10 +285,13 @@ stdenv.mkDerivation rec {
wrap Runner.Listener
wrap Runner.PluginHost
wrap Runner.Worker
wrap run.sh
wrap env.sh
wrap run.sh --run 'export RUNNER_ROOT=''${RUNNER_ROOT:-$HOME/.github-runner}'
wrap env.sh --run 'cd $RUNNER_ROOT'

wrap config.sh --prefix PATH : ${lib.makeBinPath [ glibc.bin ]}
wrap config.sh --run 'export RUNNER_ROOT=''${RUNNER_ROOT:-$HOME/.github-runner}' \
--run 'mkdir -p $RUNNER_ROOT' \
--prefix PATH : ${lib.makeBinPath [ glibc.bin ]} \
--chdir $out
'';

# Script to create deps.nix file for dotnet dependencies. Run it with
Expand Down