diskimage-builder/elements/devuser/extra-data.d/50-devuser
Gregory Haynes 031a7b03be Add generic devuser element
The devuser element is useful for configuring a generic utility user for
the built images.

Change-Id: Ifd9dcf3ba88d7abc98b1e44a93f6d9a6b4e764dd
2015-04-08 07:01:24 +00:00

21 lines
499 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
if [ -n "$DIB_DEV_USER_AUTHORIZED_KEYS" ]; then
if [ -f "$DIB_DEV_USER_AUTHORIZED_KEYS" ]; then
cat $DIB_DEV_USER_AUTHORIZED_KEYS >> $TMP_HOOKS_PATH/devuser-ssh-authorized-keys
fi
else
for fmt in "rsa dsa"; do
if [ -f "$HOME/.ssh/id_$fmt.pub" ]; then
cat $HOME/.ssh/id_$fmt.pub >> $TMP_HOOKS_PATH/devuser-ssh-authorized-keys
break
fi
done
fi