constellation/image/mkosi.prepare
2023-01-25 09:58:56 +01:00

34 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euxo pipefail
# set selinux to permissive
sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
# backport of https://github.com/dracutdevs/dracut/commit/dcbe23c14d13ca335ad327b7bb985071ca442f12
sed -i 's/WantedBy=multi-user.target/WantedBy=basic.target/' /usr/lib/systemd/system/systemd-resolved.service
# write + enable debugd.service if INSTALL_DEBUGD is set
if [[ ${INSTALL_DEBUGD:-false} == "true" ]]; then
cat << EOF > /usr/lib/systemd/system/debugd.service
[Unit]
Description=Constellation Debug Daemon
Wants=network-online.target
After=network-online.target configure-constel-csp.service
[Service]
Type=simple
RemainAfterExit=yes
Restart=on-failure
EnvironmentFile=/run/constellation.env
Environment=PATH=/run/state/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
ExecStart=/usr/bin/debugd
[Install]
WantedBy=multi-user.target
EOF
echo "enable debugd.service" > /usr/lib/systemd/system-preset/31-constellation-debug.preset
systemctl enable debugd.service
# ensure constellation-bootstrapper.service uses downloaded binaries on reboots
sed -i 's#ExecStart=.*#ExecStart=/run/state/bin/bootstrapper#' /usr/lib/systemd/system/constellation-bootstrapper.service
fi