1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2025-01-23 23:32:48 +01:00
OpenVoiceOS/buildroot-external/rootfs-overlay/etc/init.d/init_resize.sh

32 lines
645 B
Bash
Raw Normal View History

2018-10-26 19:51:01 +02:00
#!/bin/bash
set -e
mount -t proc proc /proc
mount -t sysfs sys /sys
mount -t tmpfs tmp /run
mount /boot
mount / -o remount,rw
sed -i 's| init=/etc/init.d/init_resize.sh||' /boot/cmdline.txt
sync
DEVICE="/dev/mmcblk0"
PARTNR="p2"
CURRENTSIZEB=`fdisk -l $DEVICE$PARTNR | grep "Disk $DEVICE$PARTNR" | cut -d' ' -f5`
CURRENTSIZE=`expr $CURRENTSIZEB / 1024 / 1024`
MAXSIZEMB=`printf %s\\n 'unit MB print list' | parted | grep "Disk ${DEVICE}" | cut -d' ' -f3 | tr -d MB`
echo "[ok] applying resize operation.."
parted ${DEVICE} resizepart ${PARTNR} ${MAXSIZEMB}
echo "[done]"
partprobe $DEVICE
umount /boot
mount / -o remount,ro
sync
reboot