]>
Commit | Line | Data |
---|---|---|
a6d0d790 AF |
1 | #!/bin/sh |
2 | ######################################################################## | |
3 | # Begin $rc_base/init.d/partresize | |
4 | # | |
3e011c27 | 5 | # Description : Resize the root partition to the drivesize |
a6d0d790 AF |
6 | # |
7 | # Authors : Arne Fitzenreiter - arne_f@ipfire.org | |
8 | # | |
b8101c50 | 9 | # Version : 1.04 |
a6d0d790 AF |
10 | # |
11 | # Notes : | |
12 | # | |
13 | ######################################################################## | |
14 | ||
15 | . /etc/sysconfig/rc | |
16 | . ${rc_functions} | |
17 | ||
18 | case "${1}" in | |
19 | start) | |
20 | ||
fbb2ebd6 AF |
21 | boot_mesg "Mounting root file system in read/write mode ..." |
22 | mount -o remount,rw / > /dev/null | |
23 | evaluate_retval | |
a6d0d790 | 24 | |
1ee33dda AF |
25 | boot_mesg "Create /etc/mtab..." |
26 | > /etc/mtab | |
27 | mount -f / || failed=1 | |
28 | (exit ${failed}) | |
29 | evaluate_retval | |
30 | ||
a6d0d790 AF |
31 | # Detect device |
32 | ROOT=`mount | grep -m1 " / " | cut -d" " -f1`; | |
ac6945db AF |
33 | if [ "${ROOT:`expr length $ROOT`-2:1}" == "p" ]; then |
34 | DRV=${ROOT::`expr length $ROOT`-2} | |
35 | else | |
36 | DRV=${ROOT::`expr length $ROOT`-1} | |
37 | fi | |
a6d0d790 | 38 | |
da23c4be | 39 | boot_mesg "Change Partition ${DRV}3 to all free space ..." |
6450609d AF |
40 | echo -e ',+' | sfdisk --no-reread -f -N3 ${DRV} 2>/dev/null |
41 | ||
42 | boot_mesg "Update c,h,s values of ${DRV}1 ..." | |
43 | echo -e ',' | sfdisk --no-reread -f -N1 ${DRV} 2>&1 > /dev/null | |
a6d0d790 AF |
44 | |
45 | # Erase symlink, it should run only once | |
46 | rm -f /etc/rc.d/rcsysinit.d/S25partresize | |
47 | ||
48 | boot_mesg "Rebooting ..." | |
fbb2ebd6 | 49 | sync |
b8101c50 AF |
50 | mount -o remount,ro / 2>&1 > /dev/null |
51 | sleep 15 | |
a6d0d790 AF |
52 | reboot -f |
53 | ||
54 | ;; | |
55 | *) | |
56 | echo "Usage: ${0} {start}" | |
57 | exit 1 | |
58 | ;; | |
59 | esac | |
60 | ||
61 | # End $rc_base/init.d/partresize |