mirror of
https://github.com/lisanet/PiShrink-macOS.git
synced 2026-03-12 02:23:51 +00:00
New indents broke rc.local md5sum, startup script
The indentation was introduced incad2e0e11a, not when the safety hash check was added in2c6f069c2f, my first guess. The indentations makes the rc.local begin with spaces instead of `#!/bin/bash` and will not run. But it gets better. The md5 safety check is based on rc.local without indents, so after the added indentations the if-block will never be skipped. If the script is run a second time, the original rc.local backed up in rc.local.bak will be overwritten, and on boot result in a never ending loop, trying to expand the filesystem each time. A user could run the pishrink.sh a second time on a disk image, e.g. after making more edits.
This commit is contained in:
@@ -63,11 +63,12 @@ if [ "$should_skip_autoexpand" = false ]; then
|
|||||||
if [ `md5sum $mountdir/etc/rc.local | cut -d ' ' -f 1` != "a27a4d8192ea6ba713d2ddd15a55b1df" ]; then
|
if [ `md5sum $mountdir/etc/rc.local | cut -d ' ' -f 1` != "a27a4d8192ea6ba713d2ddd15a55b1df" ]; then
|
||||||
echo Creating new /etc/rc.local
|
echo Creating new /etc/rc.local
|
||||||
mv $mountdir/etc/rc.local $mountdir/etc/rc.local.bak
|
mv $mountdir/etc/rc.local $mountdir/etc/rc.local.bak
|
||||||
|
#Do not touch the following 6 lines including EOF. The md5sum check above depends on having the extact same bytes.
|
||||||
cat <<\EOF > $mountdir/etc/rc.local
|
cat <<\EOF > $mountdir/etc/rc.local
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
/usr/bin/raspi-config --expand-rootfs
|
/usr/bin/raspi-config --expand-rootfs
|
||||||
rm -f /etc/rc.local; cp -f /etc/rc.local.bak /etc/rc.local; reboot
|
rm -f /etc/rc.local; cp -f /etc/rc.local.bak /etc/rc.local; reboot
|
||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
chmod +x $mountdir/etc/rc.local
|
chmod +x $mountdir/etc/rc.local
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user