2 ########################################################################
3 # Begin $rc_base/init.d/partresize
5 # Description : Resize the root partition to the drivesize
6 # and setup some platform or hardware options in
9 # Authors : Arne Fitzenreiter - arne_f@ipfire.org
15 ########################################################################
22 if [ -e "/.partresize" ]; then
24 boot_mesg
"Mounting root file system in read/write mode ..."
25 mount
-o remount
,rw
/ > /dev
/null
28 boot_mesg
"Create /etc/mtab..."
30 mount
-f / || failed
=1
34 # check if serial console enabled
36 if [ ! "$(grep "console
=ttyS0
" /proc/cmdline)" == "" ]; then
39 if [ -e /sys
/class
/dmi
/id
/product_name
]; then
40 IFS
= read -r DMI_PRODUCT_NAME
< /sys
/class
/dmi
/id
/product_name
;
41 case ${DMI_PRODUCT_NAME} in
42 APU|apu
[1-4]|PC\ Engines\ apu
[1-4] )
48 # Enable the serial console on all systems on Azure
49 if running_on_azure
; then
53 # Install AP6112 wlan config on NanoPi R1
54 case "$(< /proc/device-tree/model )" in
55 "FriendlyElec NanoPi-R1")
56 cp -f /lib
/firmware
/brcm
/brcmfmac43430-sdio.AP6212.txt \
57 /lib
/firmware
/brcm
/brcmfmac43430-sdio.txt
61 mount
/boot
> /dev
/null
62 if [ -e /boot
/grub
/grub.cfg
]; then
63 # swtich permanent to serial console if it was selected on first boot
64 if [ "${scon}" = "on" ]; then
65 # Enable also serial console on GRUB
66 echo "GRUB_TERMINAL=\"serial console\"" >> /etc
/default
/grub
67 echo "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200\"" >> /etc
/default
/grub
68 sed -i -e "s|panic=10|& console=ttyS0,115200n8|g" /etc
/default
/grub
71 # Re-generate GRUB configuration
72 /usr
/sbin
/grub-mkconfig
-o /boot
/grub
/grub.cfg
74 umount
/boot
> /dev
/null
77 mount |
while read -r dev tmp1 mountpoint tmp2
; do
78 [ "${dev}" = "rootfs" ] && continue
80 if [ "${mountpoint}" = "/" ]; then
81 # Find root partition number
84 # Find path to the root device
86 if [ ! -b "${dev::-1}" -a "${root_dev: -1}" = "p" ]; then
90 boot_mesg
"Growing root partition to maximum size..."
91 echo -e ',+' | sfdisk
--no-reread -f -N${part_num} "${root_dev}" 2>/dev
/null
93 # Update c,h,s values of the boot partition...
94 if [ ${part_num} -ne 1 -a -b "${root_dev}1" ]; then
95 echo -e ',' | sfdisk
--no-reread -f -N1 ${DRV} &> /dev
/null
98 # The filesystem should be resized after
106 boot_mesg
"Rebooting system..."
107 mount
-o remount
,ro
/ &>/dev
/null
115 echo "Usage: ${0} {start}"
120 # End $rc_base/init.d/partresize