HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/gitlab-runner/post-install
#!/bin/sh

set -e

# detect user: first try to use gitlab_ci_multi_runner
for USER in gitlab_ci_multi_runner gitlab-runner; do
  if id -u "$USER" >/dev/null 2>/dev/null; then
    echo "GitLab Runner: detected user $USER"
    break
  fi
done

# Disable
# [skel](https://www.thegeekdiary.com/understanding-the-etc-skel-directory-in-linux/)
# for distributions like Debian buster
# https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1379
GITLAB_RUNNER_DISABLE_SKEL=${GITLAB_RUNNER_DISABLE_SKEL:-true}

# create user if doesn't exist: it will create gitlab-runner if not found
if ! id -u "$USER" >/dev/null 2>/dev/null; then
  echo "GitLab Runner: creating $USER..."

  if [ $GITLAB_RUNNER_DISABLE_SKEL = true ]; then
    echo "Home directory skeleton not used"
    useradd --system --shell /bin/bash --comment 'GitLab Runner' --create-home --skel /dev/null $USER
  else
    useradd --system --shell /bin/bash --comment 'GitLab Runner' --create-home $USER
  fi
fi

# add user to docker group to allow Docker access (insecure)
if id -nG "$USER" | grep -q docker; then
  echo "WARNING: $USER belongs to group docker which is insecure, because allows to have root access to host"
fi

# get USER home directory
eval HOMEDIR=~$USER

# create empty config and re-register runner
mkdir -p /etc/gitlab-runner
chmod 0700 /etc/gitlab-runner
if [ -f $HOMEDIR/config.toml ] && [ ! -f /etc/gitlab-runner/config.toml ]; then
  echo "GitLab Runner: importing configuration to /etc/gitlab-runner/config.toml"
  cp $HOMEDIR/config.toml /etc/gitlab-runner/config.toml
  chmod 0600 /etc/gitlab-runner/config.toml
fi

# uninstall old service
if gitlab-runner status --service="gitlab-runner"; then
  gitlab-runner stop --service="gitlab-runner" >/dev/null 2>/dev/null || :
  gitlab-runner uninstall --service="gitlab-runner" >/dev/null 2>/dev/null || :
fi

# if migrating from pre 10.0.0 installation
if gitlab-runner status --service="gitlab-ci-multi-runner"; then
  gitlab-runner stop --service="gitlab-ci-multi-runner" >/dev/null 2>/dev/null || :
  gitlab-runner uninstall --service="gitlab-ci-multi-runner" >/dev/null 2>/dev/null || :
fi

# re-register runner
gitlab-runner stop >/dev/null 2>/dev/null || :
gitlab-runner uninstall >/dev/null 2>/dev/null || :
gitlab-runner install --user=$USER --working-directory=$HOMEDIR

# start runner service
gitlab-runner start || :