Files
bpfire/src/initscripts/init.d/partresize
Arne Fitzenreiter b8101c50ea partresize: update c,h,s values before resize.
Some cards fail with wrong translations so the values are updated before resize.
2014-02-05 10:52:46 +01:00

63 lines
1.4 KiB
Bash

#!/bin/sh
########################################################################
# Begin $rc_base/init.d/partresize
#
# Description : Resize the root partition to the drivesize
#
# Authors : Arne Fitzenreiter - arne_f@ipfire.org
#
# Version : 1.04
#
# Notes :
#
########################################################################
. /etc/sysconfig/rc
. ${rc_functions}
case "${1}" in
start)
boot_mesg "Mounting root file system in read/write mode ..."
mount -o remount,rw / > /dev/null
evaluate_retval
boot_mesg "Create /etc/mtab..."
> /etc/mtab
mount -f / || failed=1
(exit ${failed})
evaluate_retval
# Detect device
ROOT=`mount | grep -m1 " / " | cut -d" " -f1`;
if [ "${ROOT:`expr length $ROOT`-2:1}" == "p" ]; then
DRV=${ROOT::`expr length $ROOT`-2}
else
DRV=${ROOT::`expr length $ROOT`-1}
fi
boot_mesg "Update c,h,s values of ${DRV} ..."
echo -e ',' | sfdisk --no-reread -f -N1 ${DRV} 2>&1 > /dev/null
echo -e ',' | sfdisk --no-reread -f -N3 ${DRV} 2>&1 > /dev/null
boot_mesg "Change Partition ${DRV}3 to all free space ..."
echo -e ',+' | sfdisk --no-reread -N3 ${DRV} 2>/dev/null
# Erase symlink, it should run only once
rm -f /etc/rc.d/rcsysinit.d/S25partresize
boot_mesg "Rebooting ..."
sync
mount -o remount,ro / 2>&1 > /dev/null
sleep 15
reboot -f
;;
*)
echo "Usage: ${0} {start}"
exit 1
;;
esac
# End $rc_base/init.d/partresize