Commit 6fae221c authored by Gerardo Exequiel Pozzi's avatar Gerardo Exequiel Pozzi
Browse files

[archiso] Always copytoram for NBD



Avoid issues on shutdown (and during normal usage if network settings changed)
Signed-off-by: default avatarGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
parent 0fdbf313
......@@ -14,7 +14,6 @@ install-hooks:
install -D -m 755 archiso/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/archiso_shutdown
install -D -m 644 archiso/hooks/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown
install -D -m 644 archiso/install/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown
install -D -m 644 archiso/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd
install -D -m 644 archiso/hooks/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common
install -D -m 644 archiso/install/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common
install -D -m 644 archiso/hooks/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd
......@@ -42,7 +41,6 @@ uninstall:
rm -f $(DESTDIR)/usr/lib/initcpio/archiso_shutdown
rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown
rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown
rm -f $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd
rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common
rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common
rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd
......
omit_kill_nbd_client() {
add_omit_pids $(< /run/archiso/nbd_client.pid)
}
add_hook shutdown_prekillall omit_kill_nbd_client
add_hook single_prekillall omit_kill_nbd_client
......@@ -27,9 +27,6 @@ if [[ ! -d /oldrun/archiso/copytoram ]]; then
else
umount /oldrun/archiso/bootmnt
fi
if [[ -f /oldrun/archiso/nbd_client.pid ]]; then
nbd-client -d /dev/nbd0
fi
fi
# reboot / poweroff / halt, depending on the argument passed by init
......
......@@ -15,6 +15,7 @@ archiso_pxe_nbd_mount_handler () {
# Module autoloading like with loop devices does not work, doing manually...
modprobe nbd 2> /dev/null
msg ":: Waiting for boot device..."
while ! poll_device /dev/nbd0 30; do
echo "ERROR: boot device didn't show up after 30 seconds..."
......@@ -24,22 +25,13 @@ archiso_pxe_nbd_mount_handler () {
done
msg ":: Setup NBD from ${archiso_nbd_srv} at /dev/nbd0"
if [[ "${copytoram}" = "y" ]]; then
nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0
else
nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 -persist
fi
nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0
copytoram="y"
archisodevice=/dev/nbd0
archiso_mount_handler ${newroot}
if [[ "${copytoram}" = "y" ]]; then
msg ":: Disconnect NBD from ${archiso_nbd_srv} at /dev/nbd0"
nbd-client -d /dev/nbd0
else
mkdir -p /run/archiso
pidof nbd-client > /run/archiso/nbd_client.pid
cp /archiso_pxe_nbd ${newroot}/etc/rc.d/functions.d/
fi
msg ":: Disconnect NBD from ${archiso_nbd_srv} at /dev/nbd0"
nbd-client -d /dev/nbd0
}
......@@ -6,8 +6,6 @@ build() {
add_runscript
add_binary nbd-client
add_file /usr/lib/initcpio/archiso_pxe_nbd /archiso_pxe_nbd
}
help() {
......
......@@ -43,7 +43,6 @@ make_setup_mkinitcpio() {
done
cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/root-image/usr/lib/initcpio/install
cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/root-image/usr/lib/initcpio
cp /usr/lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/usr/lib/initcpio
cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf
: > ${work_dir}/build.${FUNCNAME}
fi
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment