]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/initscripts/init.d/partresize
flash-image: add automatic resizing /var partition at first boot.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / partresize
CommitLineData
a6d0d790
AF
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/partresize
4#
5# Description : Resize the /var partition to the drivesize
6#
7# Authors : Arne Fitzenreiter - arne_f@ipfire.org
8#
9# Version : 1.00
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
17
18case "${1}" in
19 start)
20
21 # Ensure that / is writeable
22 mount -o remount,rw /
23
24 # Detect device
25 ROOT=`mount | grep -m1 " / " | cut -d" " -f1`;
26 DRV=${ROOT::`expr length $ROOT`-1}
27
28 boot_mesg "Change Partition 4 to all free space ..."
29 echo -e 'd\n4\nn\np\n4\n\n\nw\nq\n' | fdisk ${DRV}
30
31 # Erase symlink, it should run only once
32 rm -f /etc/rc.d/rcsysinit.d/S25partresize
33
34 boot_mesg "Rebooting ..."
35 reboot -f
36
37 ;;
38 *)
39 echo "Usage: ${0} {start}"
40 exit 1
41 ;;
42esac
43
44# End $rc_base/init.d/partresize
45