openssh: start init scripts on RUNLEVEL=boot

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-09-07 23:10:42 +02:00
parent 8569249f92
commit 997ef7c3b9

View File

@ -22,55 +22,61 @@
# #
# runlevels: openelec, textmode # runlevels: openelec, textmode
( RSA1_KEY="/storage/.cache/ssh/ssh_host_key"
RSA1_KEY="/storage/.cache/ssh/ssh_host_key" RSA2_KEY="/storage/.cache/ssh/ssh_host_rsa_key"
RSA2_KEY="/storage/.cache/ssh/ssh_host_rsa_key" DSA2_KEY="/storage/.cache/ssh/ssh_host_dsa_key"
DSA2_KEY="/storage/.cache/ssh/ssh_host_dsa_key"
KEYGEN="/usr/bin/ssh-keygen" KEYGEN="/usr/bin/ssh-keygen"
SSHD="/usr/sbin/sshd" SSHD="/usr/sbin/sshd"
# Check for the SSH1 RSA key case $RUNLEVEL in
if [ ! -f $RSA1_KEY ] ; then boot)
progress "SSH: generating SSH1 RSA key" (
# Check for the SSH1 RSA key
if [ ! -f $RSA1_KEY ] ; then
progress "SSH: generating SSH1 RSA key"
mkdir -p /storage/.cache/ssh mkdir -p /storage/.cache/ssh
$KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null
chmod 600 $RSA1_KEY chmod 600 $RSA1_KEY
fi fi
# Check for the SSH2 RSA key # Check for the SSH2 RSA key
if [ ! -f $RSA2_KEY ] ; then if [ ! -f $RSA2_KEY ] ; then
progress "SSH: generating SSH2 RSA key" progress "SSH: generating SSH2 RSA key"
mkdir -p /storage/.cache/ssh mkdir -p /storage/.cache/ssh
$KEYGEN -q -t rsa -f $RSA2_KEY -C '' -N '' >&/dev/null $KEYGEN -q -t rsa -f $RSA2_KEY -C '' -N '' >&/dev/null
chmod 600 $RSA2_KEY chmod 600 $RSA2_KEY
fi fi
# Check for the SSH2 DSA key # Check for the SSH2 DSA key
if [ ! -f $DSA2_KEY ] ; then if [ ! -f $DSA2_KEY ] ; then
progress "SSH: generating SSH2 DSA key" progress "SSH: generating SSH2 DSA key"
mkdir -p /storage/.cache/ssh mkdir -p /storage/.cache/ssh
$KEYGEN -q -t dsa -f $DSA2_KEY -C '' -N '' >&/dev/null $KEYGEN -q -t dsa -f $DSA2_KEY -C '' -N '' >&/dev/null
chmod 600 $DSA2_KEY chmod 600 $DSA2_KEY
fi fi
# Check for predifined known hosts file # Check for predifined known hosts file
if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then
progress "SSH: setup predifined known hosts" progress "SSH: setup predifined known hosts"
mkdir -p /$HOME/.ssh mkdir -p /$HOME/.ssh
cp /etc/ssh/known_hosts $HOME/.ssh cp /etc/ssh/known_hosts $HOME/.ssh
fi fi
progress "Starting SSH Server" progress "Starting SSH Server"
wait_for_network wait_for_network
mkdir -p /var/empty mkdir -p /var/empty
chmod -R 600 /var/empty chmod -R 600 /var/empty
$SSHD $SSHD
)&
;;
)& poweroff|reboot)
;;
esac