From 6e85e8676013a726b0c5d4b5e0ccebfc124fd80b Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 8 Sep 2017 13:21:45 +0100 Subject: [PATCH 1/3] modofied for RPi detection --- resize.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resize.sh b/resize.sh index 5903c6f..36c4a85 100755 --- a/resize.sh +++ b/resize.sh @@ -32,7 +32,14 @@ echo "The following filesystems have been found:" lsblk read -e -p "Which blockdevice: " -i "mmcblk0" myblkdev read -e -p "Which partition do you want to shrink: " -i "2" targetpartnr -targetpart="${myblkdev}p${targetpartnr}" +if [ -e /etc/os-release ] +then + echo 'os-release found' + if grep -q Raspbian /etc/os-release; then + echo 'Looks like this is Raspbian' + targetpart="${myblkdev}${targetpartnr}" + else + targetpart="${myblkdev}p${targetpartnr}" # Unmount directories, otherwise online shrinking from resize2fs would be # required but this throws an error. From b1b2f81c27da81421bd314a84bb2040e8a9e64c3 Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 8 Sep 2017 14:06:54 +0100 Subject: [PATCH 2/3] modified for RPi detection --- resize.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resize.sh b/resize.sh index 36c4a85..2b40ae7 100755 --- a/resize.sh +++ b/resize.sh @@ -40,7 +40,8 @@ then targetpart="${myblkdev}${targetpartnr}" else targetpart="${myblkdev}p${targetpartnr}" - + fi +fi # Unmount directories, otherwise online shrinking from resize2fs would be # required but this throws an error. if grep -s "${myblkdev}" /proc/mounts From b4ad9d18d160130c55fdaa15b2bb377e9e6d6a7a Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 8 Sep 2017 14:13:44 +0100 Subject: [PATCH 3/3] added raspbian instructions --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ffc378f..6008ba5 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,7 @@ cd edu-image ./resize.sh ``` -1. A backup of the image will be created in ~/backups that can be used to create new cards if needed. +1. A backup of the image will be created in ~/backups that can be used to create new cards if needed. If you're running this script on a Pi or a Desktop running Raspbian, then you'll need to install pv first: + ``` bash + sudo apt-get install pv + ```