--- /dev/null
+#! /bin/bash
+
+### BEGIN INIT INFO
+# Provides: gitlab-ci-multi-runner
+# Required-Start: $local_fs $remote_fs $network $syslog
+# Required-Stop: $local_fs $remote_fs $network $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: GitLab CI-Multi Runner init.d script
+# Description: Enables automatic start of runners at boot time in the background.
+### END INIT INFO
+
+DESC="GitLab CI-Multi Runner"
+USER="gitlab_ci_multi_runner"
+GROUP="gitlab_ci_multi_runner"
+CHDIR="~$USER"
+NAME="gitlab-ci-multi-runner"
+DAEMON="/usr/bin/gitlab-ci-multi-runner"
+PIDFILE="/var/run/gitlab-ci-multi-runner.pid"
+LOGFILE="/var/log/gitlab-ci-multi-runner.log"
+
+# Exit if the package is not installed
+if [ ! -x "$DAEMON" ]; then
+ echo "$DAEMON not present or not executable"
+ exit 1
+fi
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Define LSB log_* functions.
+. /lib/lsb/init-functions
+
+## Check to see if we are running as root first.
+if [ "$(id -u)" != "0" ]; then
+ echo "This script must be run as root"
+ exit 1
+fi
+
+eval CHDIR=$CHDIR
+
+do_start() {
+ start-stop-daemon --start \
+ --pidfile "$PIDFILE" \
+ --chdir "$CHDIR" \
+ --background \
+ --make-pidfile \
+ --chuid "$USER:$GROUP" \
+ --no-close \
+ --exec "$DAEMON" -- "run" &>> $LOGFILE
+}
+
+do_stop() {
+ start-stop-daemon --stop --pidfile "$PIDFILE" --user "$USER" --exec "$DAEMON" --quiet
+}
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting $DESC"
+ do_start
+ log_end_msg $?
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESC"
+ do_stop
+ log_end_msg $?
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ status)
+ status_of_proc -p "$PIDFILE" "$DAEMON" "$DESC"
+ ;;
+ *)
+ echo "Usage: sudo service gitlab-ci-multi-runner {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null
+#
+# systemd unit file for CentOS 7, Ubuntu bleeding edge
+#
+[Unit]
+Description=GitLab CI-Multi Runner
+# start us only once the network and logging subsystems are available
+After=syslog.target network.target
+
+# See these pages for lots of options:
+# http://0pointer.de/public/systemd-man/systemd.service.html
+# http://0pointer.de/public/systemd-man/systemd.exec.html
+[Service]
+Type=simple
+User=gitlab_ci_multi_runner
+Group=gitlab_ci_multi_runner
+ExecStart=/usr/bin/gitlab-ci-multi-runner run
+
+# if we crash, restart
+RestartSec=1
+Restart=on-failure
+
+# use syslog for logging
+StandardOutput=syslog
+StandardError=syslog
+SyslogIdentifier=gitlab-ci-multi-runner
+
+[Install]
+WantedBy=multi-user.target
Summary: The official GitLab CI runner written in Go
Name: gitlab-ci-multi-runner
Version: 1.7.1
-Release: 1
+Release: 1.1
License: MIT
Group: Development/Building
Source0: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/repository/archive.tar.gz?ref=v%{version}&/%{name}-%{version}.tar.gz
# Source1-md5: 0d89c7578a0b5d22a4ae85dcb7d5b4f5
Source2: https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/master/docker/prebuilt-arm.tar.xz
# Source2-md5: c0533c581624dcb33095f08f06e6a00b
+Source3: %{name}.init
+Source4: %{name}.sysconfig
+Source5: %{name}.service
Patch0: nodim_gz.patch
Patch1: branch-preserver.patch
URL: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir}/gitlab-runner,%{_bindir},/var/lib/gitlab-runner/.gitlab-runner}
+install -d $RPM_BUILD_ROOT{%{_sysconfdir}/gitlab-runner,%{_bindir},/etc/{rc.d/init.d,sysconfig},%{systemdunitdir},/var/lib/gitlab-runner/.gitlab-runner}
install -p src/%{import_path}/%{name} $RPM_BUILD_ROOT%{_bindir}/gitlab-runner
+install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}
# backward compat name for previous pld packaging
ln -s gitlab-runner $RPM_BUILD_ROOT%{_bindir}/gitlab-ci-multi-runner
%files
%defattr(644,root,root,755)
%doc README.md CHANGELOG.md
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/gitlab-ci-multi-runner
+%attr(754,root,root) /etc/rc.d/init.d/gitlab-ci-multi-runner
%dir %attr(750,root,root) %{_sysconfdir}/gitlab-runner
%attr(755,root,root) %{_bindir}/gitlab-ci-multi-runner
%attr(755,root,root) %{_bindir}/gitlab-runner
+%{systemdunitdir}/gitlab-ci-multi-runner.service
%dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner
%dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner/.gitlab-runner