Fix race-condition with create_swap.sh

Stupid code just relied on create_swap.sh taking a long time to execute.
This commit is contained in:
WereCatf 2016-03-13 10:34:25 +02:00
parent 5c62f25a1d
commit 91eae35f3c

View File

@ -62,6 +62,7 @@ if [[ "$(apt-cache policy ramlog | grep Installed)" != "" ]]; then
fi
fi
fi
while [ -f /tmp/firstrun_running ]; do sleep 1; done
if [ -f "/var/run/reboot" ]; then reboot; fi
rm -f /tmp/create_swap.sh
EOT
@ -201,6 +202,7 @@ main() {
display_alert "Creating 128Mb emergency swap area"
display_alert "SSH keys recreation. One moment please"
display_alert "Updating packages"
touch /tmp/firstrun_running
/tmp/create_swap.sh &
if [ "X${HARDWARE}" = "Xsun8i" -o "X${HARDWARE}" = "Xsun7i" ]; then
@ -209,6 +211,7 @@ main() {
update-rc.d -f firstrun remove >/dev/null 2>&1
sed -i 's/allow-hotplug\ eth0/auto eth0/' /etc/network/interfaces.default
rm /tmp/firstrun_running
} # main
main