@@ -5,20 +5,20 @@ const config = require('./config');
55
66// User data scripts are run as the root user
77function buildUserDataScript ( githubRegistrationToken , label ) {
8+ let userData ;
89 if ( config . input . runnerHomeDir ) {
910 // If runner home directory is specified, we expect the actions-runner software (and dependencies)
1011 // to be pre-installed in the AMI, so we simply cd into that directory and then start the runner
11- return [
12+ userData = [
1213 '#!/bin/bash' ,
1314 `cd "${ config . input . runnerHomeDir } "` ,
1415 `echo "${ config . input . preRunnerScript } " > pre-runner-script.sh` ,
1516 'source pre-runner-script.sh' ,
1617 'export RUNNER_ALLOW_RUNASROOT=1' ,
1718 `./config.sh --url https://github.com/${ config . githubContext . owner } /${ config . githubContext . repo } --token ${ githubRegistrationToken } --labels ${ label } ` ,
18- './run.sh' ,
1919 ] ;
2020 } else {
21- return [
21+ userData = [
2222 '#!/bin/bash' ,
2323 'mkdir actions-runner && cd actions-runner' ,
2424 `echo "${ config . input . preRunnerScript } " > pre-runner-script.sh` ,
@@ -28,9 +28,15 @@ function buildUserDataScript(githubRegistrationToken, label) {
2828 'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.313.0.tar.gz' ,
2929 'export RUNNER_ALLOW_RUNASROOT=1' ,
3030 `./config.sh --url https://github.com/${ config . githubContext . owner } /${ config . githubContext . repo } --token ${ githubRegistrationToken } --labels ${ label } ` ,
31- './run.sh' ,
3231 ] ;
3332 }
33+ if ( config . input . runAsService ) {
34+ userData . push ( './svc.sh install' ) ;
35+ userData . push ( './svc.sh start' ) ;
36+ } else {
37+ userData . push ( './run.sh' ) ;
38+ }
39+ return userData ;
3440}
3541
3642function buildMarketOptions ( ) {
0 commit comments