mirror of
https://github.com/actions/runner.git
synced 2025-12-13 10:05:23 +00:00
updated systemd svc.sh to accept custom service file (#1612)
* updated systemd svc.sh to accept custom service file * updated systemd and darwin svc templates to accept TEMPLATE_PATH env
This commit is contained in:
@@ -17,7 +17,13 @@ RUNNER_ROOT=`pwd`
|
|||||||
|
|
||||||
LAUNCH_PATH="${HOME}/Library/LaunchAgents"
|
LAUNCH_PATH="${HOME}/Library/LaunchAgents"
|
||||||
PLIST_PATH="${LAUNCH_PATH}/${SVC_NAME}.plist"
|
PLIST_PATH="${LAUNCH_PATH}/${SVC_NAME}.plist"
|
||||||
TEMPLATE_PATH=./bin/actions.runner.plist.template
|
TEMPLATE_PATH=$GITHUB_ACTIONS_RUNNER_SERVICE_TEMPLATE
|
||||||
|
IS_CUSTOM_TEMPLATE=0
|
||||||
|
if [[ -z $TEMPLATE_PATH ]]; then
|
||||||
|
TEMPLATE_PATH=./bin/actions.runner.plist.template
|
||||||
|
else
|
||||||
|
IS_CUSTOM_TEMPLATE=1
|
||||||
|
fi
|
||||||
TEMP_PATH=./bin/actions.runner.plist.temp
|
TEMP_PATH=./bin/actions.runner.plist.temp
|
||||||
CONFIG_PATH=.service
|
CONFIG_PATH=.service
|
||||||
|
|
||||||
@@ -29,7 +35,11 @@ function failed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -f "${TEMPLATE_PATH}" ]; then
|
if [ ! -f "${TEMPLATE_PATH}" ]; then
|
||||||
failed "Must run from runner root or install is corrupt"
|
if [[ $IS_CUSTOM_TEMPLATE = 0 ]]; then
|
||||||
|
failed "Must run from runner root or install is corrupt"
|
||||||
|
else
|
||||||
|
failed "Service file at '$GITHUB_ACTIONS_RUNNER_SERVICE_TEMPLATE' using GITHUB_ACTIONS_RUNNER_SERVICE_TEMPLATE env variable is not found"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function install()
|
function install()
|
||||||
|
|||||||
@@ -10,7 +10,13 @@ arg_2=${2}
|
|||||||
RUNNER_ROOT=`pwd`
|
RUNNER_ROOT=`pwd`
|
||||||
|
|
||||||
UNIT_PATH=/etc/systemd/system/${SVC_NAME}
|
UNIT_PATH=/etc/systemd/system/${SVC_NAME}
|
||||||
TEMPLATE_PATH=./bin/actions.runner.service.template
|
TEMPLATE_PATH=$GITHUB_ACTIONS_RUNNER_SERVICE_TEMPLATE
|
||||||
|
IS_CUSTOM_TEMPLATE=0
|
||||||
|
if [[ -z $TEMPLATE_PATH ]]; then
|
||||||
|
TEMPLATE_PATH=./bin/actions.runner.service.template
|
||||||
|
else
|
||||||
|
IS_CUSTOM_TEMPLATE=1
|
||||||
|
fi
|
||||||
TEMP_PATH=./bin/actions.runner.service.temp
|
TEMP_PATH=./bin/actions.runner.service.temp
|
||||||
CONFIG_PATH=.service
|
CONFIG_PATH=.service
|
||||||
|
|
||||||
@@ -31,7 +37,11 @@ function failed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -f "${TEMPLATE_PATH}" ]; then
|
if [ ! -f "${TEMPLATE_PATH}" ]; then
|
||||||
failed "Must run from runner root or install is corrupt"
|
if [[ $IS_CUSTOM_TEMPLATE = 0 ]]; then
|
||||||
|
failed "Must run from runner root or install is corrupt"
|
||||||
|
else
|
||||||
|
failed "Service file at '$GITHUB_ACTIONS_RUNNER_SERVICE_TEMPLATE' using GITHUB_ACTIONS_RUNNER_SERVICE_TEMPLATE env variable is not found"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#check if we run as root
|
#check if we run as root
|
||||||
|
|||||||
Reference in New Issue
Block a user