Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions pishrink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ EOFRC
help() {
local help
read -r -d '' help << EOM
Usage: $0 [-adhnrsvzZ] imagefile.img [newimagefile.img]
Usage: $0 [-adhmnrsvzZ] imagefile.img [newimagefile.img]

-s Don't expand filesystem when image is booted the first time
-v Be verbose
Expand All @@ -179,23 +179,27 @@ Usage: $0 [-adhnrsvzZ] imagefile.img [newimagefile.img]
-Z Compress image after shrinking with xz
-a Compress image in parallel using multiple cores
-d Write debug messages in a debug log file
-m minimum size of the image 6Go as LibreElec doesn't allow to expand filesystem
EOM
echo "$help"
exit 1
}

should_skip_autoexpand=false
debug=false
libreelec=0
#1500000 = 1.5M * 4k octets = 6 GO
update_check=true
repair=false
parallel=false
verbose=false
ziptool=""

while getopts ":adnhrsvzZ" opt; do
while getopts ":admnhrsvzZ" opt; do
case "${opt}" in
a) parallel=true;;
d) debug=true;;
m) libreelec=1500000;;
n) update_check=false;;
h) help;;
r) repair=true;;
Expand All @@ -215,7 +219,7 @@ if [ "$debug" = true ]; then
exec 2> >(stdbuf -i0 -o0 -e0 tee -a "$LOGFILE" >&2)
fi

echo -e "PiShrink $version - https://github.com/Drewsif/PiShrink\n"
echo -e "PiShrink $version - https://github.com/Drewsif/PiShrink mod CCA\n"

# Try and check for updates
if $update_check; then
Expand Down Expand Up @@ -352,7 +356,7 @@ else
logVariables $LINENO extra_space
for space in 5000 1000 100; do
if [[ $extra_space -gt $space ]]; then
minsize=$(($minsize + $space))
minsize=$(($minsize + $space + $libreelec))
break
fi
done
Expand Down Expand Up @@ -452,4 +456,4 @@ fi
aftersize=$(ls -lh "$img" | cut -d ' ' -f 5)
logVariables $LINENO aftersize

info "Shrunk $img from $beforesize to $aftersize"
info "Shrunk $img from $beforesize to $aftersize"