# sshd Starts sshd.
#
+# Only run SSH server if it is enabled
+[ -f /config/ssh_enabled ] || exit 0
+
# Make sure the ssh-keygen progam exists
[ -f /usr/bin/ssh-keygen ] || exit 0
--- /dev/null
+#!/bin/sh
+
+# Check for configuration files left by the installer
+
+# Password
+
+CFGDIR=/config/install/data
+UPGRADE_CFGDIR=/config/upgrade/data
+
+umask 077
+
+for a in password.conf ssh.conf; do
+ if [ -f $UPGRADE_CFGDIR/$a ]; then
+ mv -f $UPGRADE_CFGDIR/$a $CFGDIR/$a
+ fi
+done
+
+if [ -f ${CFGDIR}/password.conf ]; then
+ eval `cat ${CFGDIR}/password.conf`
+ awk -F: -v OFS=: "/^root:/ {\$2 = \"${PASSWORD}\"; print } ; !/^root:/ {print}" /etc/shadow > /etc/shadow.new
+ mv -f /etc/shadow.new /etc/shadow
+ mv -f ${CFGDIR}/password.conf ${CFGDIR}/password.conf.DONE
+fi
+
+if [ -f ${CFGDIR}/ssh.conf ]; then
+ eval `cat ${CFGDIR}/ssh.conf`
+ if [ "$SSH_ENABLED" = "true" ]; then
+ touch /config/ssh_enabled
+ else
+ rm -f /config/ssh_enabled
+ fi
+ mv -f ${CFGDIR}/ssh.conf ${CFGDIR}/ssh.conf.DONE
+fi