firstrun and resize fs rework

if
ext4
! /root/.no_rootfs_resize
This commit is contained in:
Igor Pečovnik
2015-12-25 19:30:56 +01:00
parent 65bb88cb33
commit ba57365853
2 changed files with 94 additions and 69 deletions

View File

@@ -19,9 +19,12 @@ N=/etc/init.d/resize2fs
case "$1" in
start)
echo -e "[\e[0;32m ok \x1B[0m] Resizing SD card file-system"
/sbin/resize2fs $device >/dev/null 2>&1
update-rc.d -f resize2fs remove >/dev/null 2>&1
root_partition=$(findmnt --target / -o SOURCE -n)
rootfstype=$(blkid -s TYPE -o value $root_partition)
if [[ $rootfstype == ext4 && ! -f "/root/.no_rootfs_resize" ]]; then
echo -e "[\e[0;32m ok \x1B[0m] Resizing SD card file-system"
/sbin/resize2fs $device >/dev/null 2>&1
fi
echo -e "[\e[0;32m ok \x1B[0m] Force password change upon first login"
chage -d 0 root
echo -e "[\e[0;32m ok \x1B[0m] Creating 128Mb emergency swap area"
@@ -32,6 +35,7 @@ case "$1" in
swapon /var/swap >/dev/null 2>&1
echo "/var/swap none swap sw 0 0" >> /etc/fstab
echo 'vm.swappiness=0' >> /etc/sysctl.conf
update-rc.d -f resize2fs remove >/dev/null 2>&1
;;
stop)
echo -e "[\e[0;32m ok \x1B[0m] Resizing in next start"