summaryrefslogtreecommitdiff
path: root/.gitlab-ci/start-in-systemd.sh
blob: 99650d22c4965a98779bc0cb141f7fe5f3c6c0f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash

set -x

systemd_target=basic.target
post_command="/usr/bin/systemctl exit \$EXIT_STATUS"

while [[ $# -gt 0 ]]; do
	case $1 in
		--debug-mode)
			shift
			systemd_target=multi-user.target
			post_command="echo you can now log in as root (no password) and then turn off by running \'/usr/bin/systemctl exit \$EXIT_STATUS\'"
			;;
		*)
			echo "Unknow commandline argument $1"
			exit 1
			;;
	esac
done

WORKDIR=${FDO_DISTRIBUTION_WORKINGDIR:-$PWD}
B2C_WORKDIR=${FDO_B2C_WORKDIR:-/app}

# remove root password for debugging
sed -i 's/root:!locked::/root:::/' /etc/shadow

# create a libinput test suite service
cat <<EOF > /etc/systemd/system/libinput-testsuite.service

[Unit]
Description=Libinput test suite
After=$systemd_target

[Service]
Type=simple
StandardOutput=journal+console
EnvironmentFile=$B2C_WORKDIR/.b2c_env
WorkingDirectory=$WORKDIR
ExecStart=$WORKDIR/.gitlab-ci/meson-build.sh --skip-setup --skip-build

# exit the container on termination
ExecStopPost=$post_command

[Install]
WantedBy=default.target
EOF

cat /etc/systemd/system/libinput-testsuite.service

# enable the service
systemctl enable libinput-testsuite.service

# disable some services we don't need in the CI
systemctl mask network-online.target
systemctl mask network-pre.target
systemctl mask timers.target
systemctl mask dnf-makecache.timer
systemctl mask systemd-logind.service
systemctl mask rpmdb-migrate.service
systemctl mask systemd-network-generator.service
systemctl mask cryptsetup-pre.target
systemctl mask cryptsetup.target

#change default target
systemctl set-default $systemd_target

# start the system
exec /usr/sbin/init