block-mount: Fixed two bugs in fstab.init. /etc/fstab was used where /tmp/fstab shoul...
authorDaniel Dickinson <crazycshore@gmail.com>
Mon, 12 Jul 2010 16:35:39 +0000 (16:35 +0000)
committerDaniel Dickinson <crazycshore@gmail.com>
Mon, 12 Jul 2010 16:35:39 +0000 (16:35 +0000)
SVN-Revision: 22148

package/block-mount/files/fstab.init

index d755eccf08a4305cfa8240b4d1136a82db6872f8..fdcd4f52a278115cb8a3ba73333894206f244c59 100644 (file)
@@ -41,9 +41,13 @@ do_swapoff() {
 start() {
        config_load fstab
        mkdir -p /var/lock
-       lock /var/lock/fstab.lck
-       echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /etc/fstab
-       lock -u /var/lock/fstab.lck
+       lock -w /var/lock/fstab.lck && {
+               lock /var/lock/fstab.lck
+               [ -e /tmp/fstab ] || { 
+                       echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp/fstab
+               }
+               lock -u /var/lock/fstab.lck
+       }
        config_foreach do_swapon swap
        config_foreach do_mount mount
 }