From: Felix Fietkau Date: Thu, 23 Mar 2006 16:15:45 +0000 (+0000) Subject: use locking to make sure that dropbear keys can be generated on the first boot X-Git-Tag: whiterussian_rc5~16 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a5d2a9e3a14463675062eb5e958af92dfc962252;p=openwrt%2Fsvn-archive%2Fopenwrt.git use locking to make sure that dropbear keys can be generated on the first boot SVN-Revision: 3468 --- diff --git a/openwrt/package/base-files/default/etc/init.d/S99done b/openwrt/package/base-files/default/etc/init.d/S99done index 786a83f377..e41d4e698c 100755 --- a/openwrt/package/base-files/default/etc/init.d/S99done +++ b/openwrt/package/base-files/default/etc/init.d/S99done @@ -3,7 +3,11 @@ sysctl -p >&- # automagically run firstboot [ "$(nvram get no_root_swap)" != 1 ] && { - { mount|grep "on / type tmpfs" 1>&-; } && firstboot switch2jffs + { mount|grep "on / type tmpfs" 1>&-; } && { + lock /tmp/.switch2jffs + firstboot switch2jffs + lock -u /tmp/.switch2jffs + } } # set leds to normal state diff --git a/openwrt/package/dropbear/files/S50dropbear b/openwrt/package/dropbear/files/S50dropbear index 88fc288491..a4d6111bec 100755 --- a/openwrt/package/dropbear/files/S50dropbear +++ b/openwrt/package/dropbear/files/S50dropbear @@ -1,16 +1,21 @@ #!/bin/sh -for type in rsa dss; do { - # check for keys - key=/etc/dropbear/dropbear_${type}_host_key - [ ! -f $key ] && { - # generate missing keys - mkdir -p /etc/dropbear - [ -x /usr/bin/dropbearkey ] && { - /usr/bin/dropbearkey -t $type -f $key 2>&- >&- && exec $0 $* - } & - exit 0 - } -}; done +[ ! -f /etc/dropbear/dropbear_rsa_host_key ] && { + for type in rsa dss; do { + # check for keys + key=/tmp/dropbear/dropbear_${type}_host_key + [ ! -f $key ] && { + # generate missing keys + mkdir -p /tmp/dropbear + [ -x /usr/bin/dropbearkey ] && { + /usr/bin/dropbearkey -t $type -f $key 2>&- >&- && exec $0 $* + } & + exit 0 + } + }; done + lock -w /tmp/.switch2jffs + mkdir -p /etc/dropbear + mv /tmp/dropbear/dropbear_* /etc/dropbear/ +} /usr/sbin/dropbear