X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=grml-debootstrap;h=c9bf40ec48a82a4a61fe767f921409e1909be53b;hb=b5efac4cc671ebb6e9f81ac95a58116cf67bbd09;hp=6f9743c673b5c8738ff5aeda837c51c30249cbe9;hpb=22cdc9fc66a89cb73b7d279849b19941bdd1ae24;p=grml-debootstrap.git diff --git a/grml-debootstrap b/grml-debootstrap index 6f9743c..c9bf40e 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -335,10 +335,6 @@ stage() { } # }}} -# make sure we have what we need {{{ -check4progs "${DEBOOTSTRAP}" || bailout 1 -# }}} - # source main configuration file {{{ if [ -r /etc/debootstrap/config ] ; then # shellcheck disable=SC1091 @@ -626,6 +622,8 @@ fi # }}} # make sure we have what we need {{{ +check4progs "${DEBOOTSTRAP}" || bailout 1 + if [ -n "$VIRTUAL" ] ; then check4progs kpartx parted qemu-img || bailout 1 fi @@ -1800,6 +1798,8 @@ iface ${interface} inet dhcp fi if [ -n "${SSHCOPYID}" ] ; then + AUTHORIZED_KEYS_SOURCE=${AUTHORIZED_KEYS_SOURCE:-$HOME/.ssh/authorized_keys} + AUTHORIZED_KEYS_TARGET=${AUTHORIZED_KEYS_TARGET:-$MNTPOINT/root/.ssh/} if ssh-add -L >/dev/null 2>&1 ; then einfo "Use locally available public keys to authorise root login on the target system as requested via --sshcopyid option." mkdir -p "${MNTPOINT}"/root/.ssh @@ -1811,6 +1811,17 @@ iface ${interface} inet dhcp eend 1 bailout 1 fi + elif [ -f "$AUTHORIZED_KEYS_SOURCE" ]; then + einfo "copying '$AUTHORIZED_KEYS_SOURCE' to '$AUTHORIZED_KEYS_TARGET' as requested via --sshcopyid option." + mkdir -p "$AUTHORIZED_KEYS_TARGET" + chmod 0700 "$AUTHORIZED_KEYS_TARGET" + if cp "$AUTHORIZED_KEYS_SOURCE" "$AUTHORIZED_KEYS_TARGET" ; then + eend 0 + else + eerror "Error: copying '$AUTHORIZED_KEYS_SOURCE' to '$AUTHORIZED_KEYS_TARGET' failed" + eend 1 + bailout 1 + fi else eerror "Could not open a connection to your authentication agent or the agent has no identites." eend 1