fix the calculation again to be used by truncate. use truncate instead of dd. add build instructions for truncate to the helper script to build it on macOS
This commit is contained in:
parent
9ec17c9c1d
commit
a9b0244e29
|
@ -43,5 +43,11 @@ cp -a e2fsck/e2fsck "$BASE"
|
|||
cp -a resize/resize2fs "$BASE"
|
||||
cp -a misc/tune2fs "$BASE"
|
||||
|
||||
download https://ftp.gnu.org/gnu/coreutils/coreutils-8.29.tar.xz
|
||||
cd core*
|
||||
./configure --prefix "$TARGET" --disable-nls
|
||||
make
|
||||
cp -a src/truncate "$BASE"
|
||||
|
||||
cd "$BASE"
|
||||
diskutil eject "/Volumes/Ramdisk"
|
||||
|
|
6
pishrink
6
pishrink
|
@ -86,9 +86,7 @@ sleep 1
|
|||
#Truncate the file
|
||||
endresult=$(($newpartend * 512))
|
||||
endresult=$(($endresult + 1))
|
||||
dd if="$img" of="$img-shrinked.img" bs=512 count=$endresult
|
||||
aftersize=$(ls -lh "$img-shrinked.img" | tr -s " " | cut -d " " -f 5)
|
||||
rm -f "$img"
|
||||
mv "$img-shrinked.img" "$img"
|
||||
truncate -s $endresult "$img"
|
||||
aftersize=$(ls -lh "$img" | tr -s " " | cut -d " " -f 5)
|
||||
|
||||
echo "Shrunk $img from $beforesize to $aftersize"
|
||||
|
|
Loading…
Reference in New Issue