index : mkinitcpio-archiso32 | |
Archlinux32 initcpio scripts used by archiso | gitolite user |
summaryrefslogtreecommitdiff |
author | David Runge <dvzrv@archlinux.org> | 2020-07-11 18:13:20 +0200 |
---|---|---|
committer | David Runge <dvzrv@archlinux.org> | 2020-07-11 20:58:01 +0200 |
commit | 043262b5f71e3030ad5553597b0e9696f6ff56b2 (patch) | |
tree | c77adfaca93127661d7fc2f5c0b1e95c7cfd6af4 /hooks/archiso_pxe_nbd | |
parent | ab2b8f8286383599b76f9f2db450ac417bd3fc1c (diff) |
-rw-r--r-- | hooks/archiso_pxe_nbd | 27 |
diff --git a/hooks/archiso_pxe_nbd b/hooks/archiso_pxe_nbd index 4fb7fa5..ce93080 100644 --- a/hooks/archiso_pxe_nbd +++ b/hooks/archiso_pxe_nbd @@ -1,19 +1,20 @@ -# vim: set ft=sh: +#!/bin/ash run_earlyhook() { - if [[ -n "${ip}" && -n "${archiso_nbd_srv}" ]]; then + # shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() + if [ -n "${ip}" ] && [ -n "${archiso_nbd_srv}" ]; then # Module autoloading like with loop devices does not work, doing manually... modprobe nbd 2> /dev/null fi } run_hook() { - if [[ -n "${ip}" && -n "${archiso_nbd_srv}" ]]; then + if [ -n "${ip}" ] && [ -n "${archiso_nbd_srv}" ]; then - archiso_nbd_srv=$(eval echo ${archiso_nbd_srv}) - [[ -z "${archiso_nbd_name}" ]] && archiso_nbd_name="archiso" + archiso_nbd_srv=$(eval echo "${archiso_nbd_srv}") + [ -z "${archiso_nbd_name}" ] && archiso_nbd_name="archiso" - mount_handler="archiso_pxe_nbd_mount_handler" + export mount_handler="archiso_pxe_nbd_mount_handler" fi } @@ -29,19 +30,21 @@ archiso_pxe_nbd_mount_handler () { done msg ":: Setup NBD from ${archiso_nbd_srv} at /dev/nbd0" - if [[ "${copytoram}" != "n" ]]; then - nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 + if [ "${copytoram}" != "n" ]; then + nbd-client "${archiso_nbd_srv}" -N "${archiso_nbd_name}" /dev/nbd0 copytoram="y" else - nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} -systemd-mark -persist /dev/nbd0 + nbd-client "${archiso_nbd_srv}" -N "${archiso_nbd_name}" -systemd-mark -persist /dev/nbd0 fi - archisodevice=/dev/nbd0 + export archisodevice=/dev/nbd0 - archiso_mount_handler ${newroot} + archiso_mount_handler "${newroot}" - if [[ "${copytoram}" == "y" ]]; then + if [ "${copytoram}" = "y" ]; then msg ":: Disconnect NBD from ${archiso_nbd_srv} at /dev/nbd0" nbd-client -d /dev/nbd0 fi } + +# vim: set ft=sh: |