mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-24 01:42:58 +02:00
flash-image: add automatic resizing /var partition at first boot.
This commit is contained in:
46
src/initscripts/init.d/fsresize
Normal file
46
src/initscripts/init.d/fsresize
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/fsresize
|
||||
#
|
||||
# Description : Resize the /var filesystem
|
||||
#
|
||||
# Authors : Arne Fitzenreiter - arne_f@ipfire.org
|
||||
#
|
||||
# Version : 1.00
|
||||
#
|
||||
# Notes :
|
||||
#
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
boot_mesg "Autoresize /var partition to use the whole drive ..."
|
||||
|
||||
# Ensure that / is writeable
|
||||
mount
|
||||
|
||||
# Detect device
|
||||
ROOT=`mount | grep -m1 " / " | cut -d" " -f1`;
|
||||
DRV=${ROOT::`expr length $ROOT`-1}
|
||||
boot_mesg " * check filesystem on ${DRV}4 before resize ..."
|
||||
fsck -f ${DRV}4
|
||||
|
||||
boot_mesg " * resize ${DRV}4 ..."
|
||||
resize2fs -p ${DRV}4
|
||||
evaluate_retval
|
||||
|
||||
# Erase symlink, it should run only once
|
||||
rm -f /etc/rc.d/rcsysinit.d/S26fsresize
|
||||
|
||||
exit 0;
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ${0} {start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/26fsresize
|
||||
45
src/initscripts/init.d/partresize
Normal file
45
src/initscripts/init.d/partresize
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/partresize
|
||||
#
|
||||
# Description : Resize the /var partition to the drivesize
|
||||
#
|
||||
# Authors : Arne Fitzenreiter - arne_f@ipfire.org
|
||||
#
|
||||
# Version : 1.00
|
||||
#
|
||||
# Notes :
|
||||
#
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
|
||||
# Ensure that / is writeable
|
||||
mount -o remount,rw /
|
||||
|
||||
# Detect device
|
||||
ROOT=`mount | grep -m1 " / " | cut -d" " -f1`;
|
||||
DRV=${ROOT::`expr length $ROOT`-1}
|
||||
|
||||
boot_mesg "Change Partition 4 to all free space ..."
|
||||
echo -e 'd\n4\nn\np\n4\n\n\nw\nq\n' | fdisk ${DRV}
|
||||
|
||||
# Erase symlink, it should run only once
|
||||
rm -f /etc/rc.d/rcsysinit.d/S25partresize
|
||||
|
||||
boot_mesg "Rebooting ..."
|
||||
reboot -f
|
||||
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ${0} {start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/partresize
|
||||
|
||||
Reference in New Issue
Block a user