2015-12-02 19:33:32 +00:00
|
|
|
#!/bin/bash
|
2014-10-08 05:39:24 +00:00
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
|
# Provides: resize2fs
|
|
|
|
|
# Required-Start: $local_fs
|
|
|
|
|
# Required-Stop:
|
|
|
|
|
# Should-Start:
|
2014-10-12 07:26:41 +00:00
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
|
# Default-Stop: 0 1 6
|
2016-06-08 20:04:12 +00:00
|
|
|
# Short-Description: Resize the root filesystem to fill whole rootfs partition
|
2014-10-08 05:39:24 +00:00
|
|
|
# Description:
|
|
|
|
|
### END INIT INFO
|
|
|
|
|
|
2016-06-09 21:21:51 +00:00
|
|
|
case "$1" in
|
|
|
|
|
start)
|
2017-01-14 20:35:53 +00:00
|
|
|
local rootpart=$(findmnt -n -o SOURCE /) # i.e. /dev/mmcblk0p1
|
2014-10-08 05:39:24 +00:00
|
|
|
|
2016-06-09 21:21:51 +00:00
|
|
|
# if ext4 and rootfs should be resized then do it
|
2017-01-14 20:35:53 +00:00
|
|
|
if [[ $(findmnt -n -o FSTYPE /) == ext4 && ! -f /root/.no_rootfs_resize ]]; then
|
2016-06-08 20:40:33 +00:00
|
|
|
echo -e "\n### [resize2fs] Start resizing partition now\n" >>/var/log/armhwinfo.log
|
2017-01-14 20:35:53 +00:00
|
|
|
/sbin/resize2fs $rootpart >>/var/log/armhwinfo.log 2>&1
|
2015-12-25 18:30:56 +00:00
|
|
|
fi
|
2016-06-09 21:21:51 +00:00
|
|
|
|
|
|
|
|
# disable further executions of this script
|
2015-12-25 18:30:56 +00:00
|
|
|
update-rc.d -f resize2fs remove >/dev/null 2>&1
|
2015-12-02 19:33:32 +00:00
|
|
|
;;
|
2014-10-08 05:39:24 +00:00
|
|
|
esac
|