libinput 1.22.0
[platform/upstream/libinput.git] / .gitlab-ci / start-in-systemd.sh
1 #!/usr/bin/env bash
2
3 set -x
4
5 systemd_target=basic.target
6 post_command="/usr/bin/systemctl exit \$EXIT_STATUS"
7
8 while [[ $# -gt 0 ]]; do
9         case $1 in
10                 --debug-mode)
11                         shift
12                         systemd_target=multi-user.target
13                         post_command="echo you can now log in as root (no password) and then turn off by running \'/usr/bin/systemctl exit \$EXIT_STATUS\'"
14                         ;;
15                 *)
16                         echo "Unknow commandline argument $1"
17                         exit 1
18                         ;;
19         esac
20 done
21
22 WORKDIR=${FDO_DISTRIBUTION_WORKINGDIR:-$PWD}
23 B2C_WORKDIR=${FDO_B2C_WORKDIR:-/app}
24
25 # remove root password for debugging
26 sed -i 's/root:!locked::/root:::/' /etc/shadow
27
28 # create a libinput test suite service
29 cat <<EOF > /etc/systemd/system/libinput-testsuite.service
30
31 [Unit]
32 Description=Libinput test suite
33 After=$systemd_target
34
35 [Service]
36 Type=simple
37 StandardOutput=journal+console
38 EnvironmentFile=$B2C_WORKDIR/.b2c_env
39 WorkingDirectory=$WORKDIR
40 ExecStart=$WORKDIR/.gitlab-ci/meson-build.sh --skip-setup --skip-build
41
42 # exit the container on termination
43 ExecStopPost=$post_command
44
45 [Install]
46 WantedBy=default.target
47 EOF
48
49 cat /etc/systemd/system/libinput-testsuite.service
50
51 # enable the service
52 systemctl enable libinput-testsuite.service
53
54 # disable some services we don't need in the CI
55 systemctl mask network-online.target
56 systemctl mask network-pre.target
57 systemctl mask timers.target
58 systemctl mask dnf-makecache.timer
59 systemctl mask systemd-logind.service
60 systemctl mask rpmdb-migrate.service
61 systemctl mask systemd-network-generator.service
62 systemctl mask cryptsetup-pre.target
63 systemctl mask cryptsetup.target
64
65 #change default target
66 systemctl set-default $systemd_target
67
68 # start the system
69 exec /usr/sbin/init