Fix spacing

This commit is contained in:
Drew Bonasera 2016-08-22 04:11:37 -04:00
parent ba76ae0063
commit 75dafa2801
1 changed files with 13 additions and 12 deletions

View File

@ -5,10 +5,10 @@ usage() { echo "Usage: $0 [-s] imagefile.img [newimagefile.img]"; exit -1; }
should_skip_autoexpand=false should_skip_autoexpand=false
while getopts ":s" opt; do while getopts ":s" opt; do
case "${opt}" in case "${opt}" in
s) should_skip_autoexpand=true ;; s) should_skip_autoexpand=true ;;
*) usage ;; *) usage ;;
esac esac
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
@ -24,15 +24,15 @@ if [[ ! -e $img ]]; then
exit -2 exit -2
fi fi
if (( EUID != 0 )); then if (( EUID != 0 )); then
echo "ERROR: You need to be running as root." echo "ERROR: You need to be running as root."
exit -3 exit -3
fi fi
#Check that what we need is installed #Check that what we need is installed
A=`which parted 2>&1` A=`which parted 2>&1`
if (( $? != 0 )); then if (( $? != 0 )); then
echo "ERROR: parted is not installed." echo "ERROR: parted is not installed."
exit -4 exit -4
fi fi
#Copy to new file if requested #Copy to new file if requested
@ -40,8 +40,8 @@ if [ -n "$2" ]; then
echo "Copying $1 to $2..." echo "Copying $1 to $2..."
cp --reflink=auto --sparse=always "$1" "$2" cp --reflink=auto --sparse=always "$1" "$2"
if (( $? != 0 )); then if (( $? != 0 )); then
echo "ERROR: Could not copy file..." echo "ERROR: Could not copy file..."
exit -5 exit -5
fi fi
img=$2 img=$2
fi fi
@ -63,13 +63,14 @@ 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. ###Do not touch the following 6 lines including EOF###
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
###End no touch zone###
chmod +x $mountdir/etc/rc.local chmod +x $mountdir/etc/rc.local
fi fi
umount $mountdir umount $mountdir