dropbear: Make sure the dropbear key is generated on first boot

The previous patch made sure a truncated key would be re-generated
but it broke the case that there is no key at all. This code is
handling both cases now. Use quotes as code outside this method
is using them too. Use the -a and not the && operator to work with
the busybox version of [ and ].
This commit is contained in:
Holger Hans Peter Freyther 2013-01-12 20:55:55 +01:00 committed by Harald Welte
parent be7111d6c6
commit b92f71e94b
1 changed files with 2 additions and 2 deletions

View File

@ -58,13 +58,13 @@ gen_keys() {
for t in $DROPBEAR_KEYTYPES; do
case $t in
rsa)
if [ ! -s $DROPBEAR_RSAKEY ]; then
if [ -f "$DROPBEAR_RSAKEY" -a ! -s "$DROPBEAR_RSAKEY" ]; then
rm $DROPBEAR_RSAKEY
fi
test -f $DROPBEAR_RSAKEY || dropbearkey -t rsa -f $DROPBEAR_RSAKEY
;;
dsa)
if [ ! -s $DROPBEAR_DSSKEY ]; then
if [ -f "$DROPBEAR_DSSKEY" -a ! -s "$DROPBEAR_DSSKEY" ]; then
rm $DROPBEAR_DSSKEY
fi
test -f $DROPBEAR_DSSKEY || dropbearkey -t dss -f $DROPBEAR_DSSKEY