+ mkdir -p "${MNTPOINT}/etc/network"
+ cp /etc/network/interfaces.examples "$MNTPOINT/etc/network/interfaces.examples"
+ 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
+ chmod 0700 "${MNTPOINT}"/root/.ssh
+ if ssh-add -L >> "${MNTPOINT}"/root/.ssh/authorized_keys ; then
+ eend 0
+ else
+ eerror "Error: executing 'ssh-add -L' failed."
+ 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 "Error: Could not open a connection to your authentication agent or the agent has no identities."
+ eend 1
+ bailout 1
+ fi
+ fi
+
+ if [ -n "${SSHCOPYAUTH}" ] ; then
+ AUTHORIZED_KEYS_SOURCE=${AUTHORIZED_KEYS_SOURCE:-${HOME}/.ssh/authorized_keys}
+
+ if ! [ -f "${AUTHORIZED_KEYS_SOURCE}" ]; then
+ eerror "Error: could not read '${AUTHORIZED_KEYS_SOURCE}' for setting up SSH key login."
+ eend 1
+ bailout 1
+ fi
+
+ AUTHORIZED_KEYS_TARGET="${MNTPOINT}/root/.ssh/"
+ einfo "Copying '${AUTHORIZED_KEYS_SOURCE}' to '${AUTHORIZED_KEYS_TARGET}' as requested via --sshcopyauth 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
+ fi
+
+ if [ -d /run/udev ] ; then
+ einfo "Setting up bind-mount /run/udev"
+ mkdir -p "${MNTPOINT}"/run/udev
+ mount --bind /run/udev "${MNTPOINT}"/run/udev
+ eend $?