diff options
Diffstat (limited to 'builder/modules.d/wlan-boot/hooks/prepare-newroot.sh')
-rwxr-xr-x | builder/modules.d/wlan-boot/hooks/prepare-newroot.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/builder/modules.d/wlan-boot/hooks/prepare-newroot.sh b/builder/modules.d/wlan-boot/hooks/prepare-newroot.sh new file mode 100755 index 00000000..c58ea15c --- /dev/null +++ b/builder/modules.d/wlan-boot/hooks/prepare-newroot.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# copy the wpa_supplicant.service to the new system to prevent systemd +# killing the wpa_supplicant process + +# this hook will be executed in pre-pivot as 00 + +# get the systemd path on the new system +systemd_system_unit_path="/etc/systemd/system" +new_systemd_system_unit_path="${NEWROOT}""$systemd_system_unit_path" + +#### copy from the current to the new system +cp "/usr/bin/systemd-preserve-process-marker" "${NEWROOT}/usr/bin/systemd-preserve-process-marker" +#cp "/usr/bin/simple.script" "${NEWROOT}/usr/bin/simple.script" + +## dhcpcd +cp "/etc/systemd/system/dhcp.service" "${new_systemd_system_unit_path}/dhcp.service" +cp "/usr/sbin/dhcpcd" "/sysroot/usr/sbin/dhcpcd" +mkdir -p /sysroot/libexec/ +#mount -t tmpfs tmpfs /sysroot/libexec/ +cp -r /libexec/* "${NEWROOT}/libexec/" + +## wpa_supplicant +cp "/etc/systemd/system/wpa_supplicant.service" "${new_systemd_system_unit_path}/wpa_supplicant.service" +mkdir --parents "${NEWROOT}/etc" +cp /etc/wpa_supplicant.conf "${NEWROOT}/etc/wpa_supplicant.conf" + +## certificate +mkdir --parents "${NEWROOT}/etc/ssl/certs" +cp /etc/ssl/certs/Deutsche_Telekom_Root_CA_2.pem "${NEWROOT}/etc/ssl/certs" + +## linking in sysinit.target.wants +mkdir --parents "${new_systemd_system_unit_path}/sysinit.target.wants" +cd "${new_systemd_system_unit_path}/sysinit.target.wants" +! ln --symbolic '../wpa_supplicant.service' +! ln --symbolic '../dhcp.service' + +# disable NetworkManager.service +rm /sysroot/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service +rm /sysroot/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service +rm /sysroot/etc/systemd/system/multi-user.target.wants/NetworkManager.service + + +### DEBUG ### +cp /root/debug-shell.service ${NEWROOT}/etc/systemd/system/debug-shell.service +! ln --symbolic '../debug-shell.service' +cp /usr/sbin/restart_wpa /sysroot/usr/sbin/restart_wpa |