From: Thomas Horsten Date: Fri, 11 Dec 2009 19:17:10 +0000 (+0000) Subject: [initscripts] Set password and disable/enable ssh based on installer settings X-Git-Url: http://xenbits.xen.org/gitweb?a=commitdiff_plain;h=96131655bb7c40b3f919552045ad7bfd952932a7;p=xenclient%2Fbuild.git [initscripts] Set password and disable/enable ssh based on installer settings --- diff --git a/package/openssh/S50sshd b/package/openssh/S50sshd index e9d39f8..207e630 100644 --- a/package/openssh/S50sshd +++ b/package/openssh/S50sshd @@ -3,6 +3,9 @@ # 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 diff --git a/target/generic/target_xenclient_skeleton/etc/init.d/S35configuration b/target/generic/target_xenclient_skeleton/etc/init.d/S35configuration new file mode 100755 index 0000000..54403a7 --- /dev/null +++ b/target/generic/target_xenclient_skeleton/etc/init.d/S35configuration @@ -0,0 +1,33 @@ +#!/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