]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/initscripts/init.d/fsresize
Merge remote-tracking branch 'mfischer/daq' into next
[ipfire-2.x.git] / src / initscripts / init.d / fsresize
index 3dbd1addd50230fed436e5d919ccc1b7f9ac779b..79aeb36fc7e089a2818afc4061b67210ec78ee9c 100644 (file)
 
 case "${1}" in
        start)
-               boot_mesg "Background Autoresize root partition to use the whole drive"
-               # Detect device
-               ROOT=`mount | grep -m1 " / " | cut -d" " -f1`;
-               DRV=${ROOT::`expr length $ROOT`-1}
+               if [ -e "/.resizefs" ]; then
+                       boot_mesg "Re-sizing root partition..."
 
-               boot_mesg "resize ${DRV}3 ..."
-               nice -n 19 $0 background ${DRV}3 > /dev/null &
-               ;;
-       background)
-               resize2fs -p $2
+                       # Find root device
+                       mount | while read -r dev tmp1 mountpoint tmp2; do
+                               # Skip generic entries
+                               [ "${dev}" = "rootfs" ] && continue
 
-               # Erase symlink, it should run only once
-               rm -f /etc/rc.d/rcsysinit.d/S42fsresize
-               sync
-               exit 0;
+                               if [ "${mountpoint}" = "/" ]; then
+                                       # Resize filesystem
+                                       resize2fs -p "${dev}"
 
+                                       # Remove marker
+                                       rm -f /.resizefs
+                                       break
+                               fi
+                       done
+               fi
                ;;
 
        *)