diff --git a/airootfs/etc/systemd/scripts/sysrescue-initialize.py b/airootfs/etc/systemd/scripts/sysrescue-initialize.py index aa51139..2bf84d6 100755 --- a/airootfs/etc/systemd/scripts/sysrescue-initialize.py +++ b/airootfs/etc/systemd/scripts/sysrescue-initialize.py @@ -19,7 +19,7 @@ errcnt = 0 # Read the effective configuration file # ============================================================================== print(f"====> Read the effective configuration file ...") -effectivecfg = "/etc/sysrescue/sysrescue-effective-config.json" +effectivecfg = "/run/archiso/config/sysrescue-effective-config.json" if os.path.exists(effectivecfg) == False: print (f"Failed to find effective configuration file in {effectivecfg}") sys.exit(1) diff --git a/airootfs/etc/systemd/system/sysrescue-configuration.service b/airootfs/etc/systemd/system/sysrescue-configuration.service deleted file mode 100644 index 9cf8b54..0000000 --- a/airootfs/etc/systemd/system/sysrescue-configuration.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Determine SystemRescue effective configuration -After=network.target network-online.target -Before=sysrescue-initialize.service -Wants=network-online.target - -[Service] -Type=oneshot -ExecStart=/usr/bin/sysrescue-configuration.lua -RemainAfterExit=true - -[Install] -WantedBy=multi-user.target diff --git a/airootfs/root/customize_airootfs.sh b/airootfs/root/customize_airootfs.sh index c32ec1e..0aa203e 100755 --- a/airootfs/root/customize_airootfs.sh +++ b/airootfs/root/customize_airootfs.sh @@ -27,6 +27,10 @@ sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' /etc/systemd/logind.conf # PulseAudio takes care of volume restore ln -sf /dev/null /etc/udev/rules.d/90-alsa-restore.rules +# config symlink +mkdir /etc/sysrescue/ +ln -sf /run/archiso/config/sysrescue-effective-config.json /etc/sysrescue/sysrescue-effective-config.json + # Services systemctl enable NetworkManager.service systemctl enable iptables.service @@ -34,7 +38,6 @@ systemctl enable ip6tables.service systemctl enable pacman-init.service systemctl enable choose-mirror.service systemctl enable sshd.service -systemctl enable sysrescue-configuration.service systemctl enable sysrescue-initialize.service systemctl enable sysrescue-autorun.service systemctl enable qemu-guest-agent.service diff --git a/airootfs/usr/bin/sysrescue-configuration.lua b/airootfs/usr/bin/sysrescue-configuration.lua index 22ae7ad..74fe0c4 100755 --- a/airootfs/usr/bin/sysrescue-configuration.lua +++ b/airootfs/usr/bin/sysrescue-configuration.lua @@ -13,7 +13,7 @@ -- At the end it writes the effective configuration to a JSON file which is meant -- to be ready by any initialisation script which needs to know the configuration. -- Shell scripts can read values from the JSON file using a command such as: --- jq --raw-output '.global.copytoram' /etc/sysrescue/sysrescue-effective-config.json +-- jq --raw-output '.global.copytoram' /run/archiso/config/sysrescue-effective-config.json -- This script requires the following lua packages to run on Arch Linux: -- sudo pacman -Sy lua lua-yaml lua-dkjson lua-http @@ -253,10 +253,9 @@ print (jsoncfgtxt) -- Write the effective configuration to a JSON file -- ============================================================================== print ("====> Writing the effective configuration to a JSON file ...") -output_location = "/etc/sysrescue" +output_location = "/run/archiso/config" output_filename = "sysrescue-effective-config.json" output_fullpath = output_location.."/"..output_filename -lfs.mkdir(output_location) jsoncfgfile = io.open(output_fullpath, "w") if jsoncfgfile == nil then io.stderr:write(string.format("ERROR: Failed to create effective configuration file in %s\n", output_fullpath)) diff --git a/patches/archiso-v43-07-yaml-config.patch b/patches/archiso-v43-07-yaml-config.patch index 5cc953b..ce5b265 100644 --- a/patches/archiso-v43-07-yaml-config.patch +++ b/patches/archiso-v43-07-yaml-config.patch @@ -2,12 +2,15 @@ diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index 853652e..53215eb 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso -@@ -197,6 +197,32 @@ archiso_mount_handler() { +@@ -197,6 +197,35 @@ archiso_mount_handler() { fi fi ++ msg ":: Creating config dir ..." ++ mkdir -p /run/archiso/config/ ++ + msg ":: Execute the configuration processing script ..." -+ jsonconfig="/etc/sysrescue/sysrescue-effective-config.json" ++ jsonconfig="/run/archiso/config/sysrescue-effective-config.json" + if ! /usr/bin/sysrescue-configuration.lua > /tmp/sysrescue-configuration.log 2>&1 + then + echo "ERROR: The configuration processing script has failed"