[feature] Edit Pishrink.sh File
Add the capability of expanding the fs in readonly systems Tasks: [T-2066]
This commit is contained in:
parent
43f1a885cd
commit
f79f2851c9
10
pishrink.sh
10
pishrink.sh
|
@ -78,7 +78,7 @@ function set_autoexpand() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$mountdir/etc/rc.local" ]] && [[ "$(md5sum "$mountdir/etc/rc.local" | cut -d ' ' -f 1)" != "1c579c7d5b4292fd948399b6ece39009" ]]; then
|
if [[ -f "$mountdir/etc/rc.local" ]] && [[ "$(md5sum "$mountdir/etc/rc.local" | cut -d ' ' -f 1)" != "196b00c95212d896ac0c016c961d667a" ]]; then
|
||||||
echo "Creating new /etc/rc.local"
|
echo "Creating new /etc/rc.local"
|
||||||
if [ -f "$mountdir/etc/rc.local" ]; then
|
if [ -f "$mountdir/etc/rc.local" ]; then
|
||||||
mv "$mountdir/etc/rc.local" "$mountdir/etc/rc.local.bak"
|
mv "$mountdir/etc/rc.local" "$mountdir/etc/rc.local.bak"
|
||||||
|
@ -116,6 +116,10 @@ EOF
|
||||||
|
|
||||||
cat <<EOF > /etc/rc.local &&
|
cat <<EOF > /etc/rc.local &&
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
sudo mount -o remount,rw /
|
||||||
|
sudo mount -o remount,rw /boot
|
||||||
|
|
||||||
echo "Expanding /dev/$ROOT_PART"
|
echo "Expanding /dev/$ROOT_PART"
|
||||||
resize2fs /dev/$ROOT_PART
|
resize2fs /dev/$ROOT_PART
|
||||||
rm -f /etc/rc.local; cp -f /etc/rc.local.bak /etc/rc.local; /etc/rc.local
|
rm -f /etc/rc.local; cp -f /etc/rc.local.bak /etc/rc.local; /etc/rc.local
|
||||||
|
@ -126,6 +130,10 @@ exit
|
||||||
}
|
}
|
||||||
raspi_config_expand() {
|
raspi_config_expand() {
|
||||||
/usr/bin/env raspi-config --expand-rootfs
|
/usr/bin/env raspi-config --expand-rootfs
|
||||||
|
|
||||||
|
sudo mount -o remount,rw /
|
||||||
|
sudo mount -o remount,rw /boot
|
||||||
|
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
return -1
|
return -1
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue