mirror of
https://github.com/lisanet/PiShrink-macOS.git
synced 2026-03-16 12:33:49 +00:00
do not truncate if used directly on the SD
This commit is contained in:
11
pishrink.sh
11
pishrink.sh
@@ -150,8 +150,9 @@ part1=`parted $img rm $partnum`
|
|||||||
part2=`parted $img unit B mkpart primary $partstart $newpartend`
|
part2=`parted $img unit B mkpart primary $partstart $newpartend`
|
||||||
|
|
||||||
#Truncate the file
|
#Truncate the file
|
||||||
endresult=`parted -m $img unit B print free | tail -1 | cut -d ':' -f 2 | tr -d 'B\n'`
|
if [[ -f $img ]]; then
|
||||||
truncate -s $endresult $img
|
endresult=`parted -m $img unit B print free | tail -1 | cut -d ':' -f 2 | tr -d 'B\n'`
|
||||||
aftersize=`ls -lah $img | cut -d ' ' -f 5`
|
truncate -s $endresult $img
|
||||||
|
aftersize=`ls -lah $img | cut -d ' ' -f 5`
|
||||||
echo "Shrunk $img from $beforesize to $aftersize"
|
echo "Shrunk $img from $beforesize to $aftersize"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user