diff --git a/src/linux/lib/smartdc/mdata-get b/src/linux/lib/smartdc/mdata-get index 9b0a3ed..e1f8fa9 100755 --- a/src/linux/lib/smartdc/mdata-get +++ b/src/linux/lib/smartdc/mdata-get @@ -43,9 +43,19 @@ case $(uname -s) in esac if [[ -n ${NC_SOCK} ]]; then + if [[ ! -e ${NC_SOCK} ]]; then + echo "mdata-get: socket not accessible" >&2 + exit 2 + fi + coproc nc -U ${NC_SOCK} exec <&${COPROC[0]} 3>&${COPROC[1]} else + if [[ ! -e ${SERIAL_DEV} ]]; then + echo "mdata-get: socket not accessible" >&2 + exit 2 + fi + exec <${SERIAL_DEV} 3>>${SERIAL_DEV} fi diff --git a/src/linux/lib/smartdc/run-user-script b/src/linux/lib/smartdc/run-user-script index d02704d..1c849b5 100755 --- a/src/linux/lib/smartdc/run-user-script +++ b/src/linux/lib/smartdc/run-user-script @@ -10,4 +10,6 @@ if [[ $? -eq 0 ]] ; then chmod +x /root/user-script exec /root/user-script fi +else + rm -f /root/user-script fi diff --git a/src/linux/lib/smartdc/set-root-authorized-keys b/src/linux/lib/smartdc/set-root-authorized-keys index 2f5e469..a27a3e5 100755 --- a/src/linux/lib/smartdc/set-root-authorized-keys +++ b/src/linux/lib/smartdc/set-root-authorized-keys @@ -5,7 +5,7 @@ if [[ ! -f /root/.ssh/authorized_keys ]]; then authorized_keys=$(/lib/smartdc/mdata-get root_authorized_keys 2>>/dev/console) - if [[ -n ${authorized_keys} ]]; then + if [[ $? -eq 0 && -n ${authorized_keys} ]]; then mkdir -p /root/.ssh echo "${authorized_keys}" > /root/.ssh/authorized_keys chmod 700 /root/.ssh