diff --git a/setup.sh b/setup.sh index acc3362..c6afad0 100644 --- a/setup.sh +++ b/setup.sh @@ -746,6 +746,32 @@ EOF zfs set org.zfsbootmenu:commandline='rw nowatchdog rd.vconsole.keymap=de-latin1' "${zpool_name}"'/root/'"${zfs_arch_dataset_name}" } +function we_want_ssh () { + #2.10 + if [[ "${ARCHZBM_NET_CLIENT_IP}" ]] || \ + [[ "${ARCHZBM_NET_SERVER_IP}" ]] || \ + [[ "${ARCHZBM_NET_GATEWAY_IP}" ]] || \ + [[ "${ARCHZBM_NET_NETMASK}" ]] || \ + [[ "${ARCHZBM_NET_HOSTNAME}" ]] || \ + [[ "${ARCHZBM_NET_DEVICE}" ]] || \ + [[ "${ARCHZBM_NET_AUTOCONF}" ]] || \ + [[ "${ARCHZBM_SSH_PORT}" ]] || \ + [[ "${ARCHZBM_SSH_KEEPALIVE_INTVL}" ]] || \ + [[ "${ARCHZBM_SSH_AUTH_KEYS}" ]]; then + >&3 printf -- '%s\n' 'Installing SSH in ZFSBootMenu' + return 0 + fi + >&3 printf -- '%s\n' 'Not installing SSH in ZFSBootMenu' + return 1 +} + +function configure_ssh_in_zbm () { + #2.11 + paru_install 'mkinitcpio-nfs-utils' 'dropbear' 'mkinitcpio-dropbear' + in_file_in_array_insert_n_at_the_end '/etc/zfsbootmenu/mkinitcpio.conf' 'HOOKS' 'net' + in_file_in_array_insert_n_at_the_end '/etc/zfsbootmenu/mkinitcpio.conf' 'HOOKS' 'dropbear' +} + function add_syslinux_pacman_hook () { mkdir -p '/opt/git/quico.space/quico-os-setup/zbm-syslinux-pacman-hook/branches/main' git -C '/opt/git/quico.space/quico-os-setup/zbm-syslinux-pacman-hook/branches/main' clone 'https://quico.space/quico-os-setup/zbm-syslinux-pacman-hook.git' . @@ -799,6 +825,9 @@ function install_os_in_chroot () { # Install ZFSBootMenu image configure_zfsbootmenu #2.9 + if we_want_ssh; then #2.10 + configure_ssh_in_zbm #2.11 + fi generate-zbm # Yes, we do this twice so we immediately get a functional backup file