parent
43f1a885cd
commit
87e1ff064e
|
@ -8,7 +8,7 @@ using multiple cores is supported.
|
|||
## Usage ##
|
||||
|
||||
```
|
||||
Usage: $0 [-adhrspvzZ] imagefile.img [newimagefile.img]
|
||||
Usage: $0 [-adhrsvzZ] imagefile.img [newimagefile.img]
|
||||
|
||||
-s Don't expand filesystem when image is booted the first time
|
||||
-v Be verbose
|
||||
|
@ -16,7 +16,6 @@ Usage: $0 [-adhrspvzZ] imagefile.img [newimagefile.img]
|
|||
-z Compress image after shrinking with gzip
|
||||
-Z Compress image after shrinking with xz
|
||||
-a Compress image in parallel using multiple cores
|
||||
-p Remove logs, apt archives, dhcp leases and ssh hostkeys
|
||||
-d Write debug messages in a debug log file
|
||||
```
|
||||
|
||||
|
|
16
pishrink.sh
16
pishrink.sh
|
@ -155,7 +155,7 @@ EOF1
|
|||
help() {
|
||||
local help
|
||||
read -r -d '' help << EOM
|
||||
Usage: $0 [-adhrspvzZ] imagefile.img [newimagefile.img]
|
||||
Usage: $0 [-adhrsvzZ] imagefile.img [newimagefile.img]
|
||||
|
||||
-s Don't expand filesystem when image is booted the first time
|
||||
-v Be verbose
|
||||
|
@ -163,7 +163,6 @@ Usage: $0 [-adhrspvzZ] imagefile.img [newimagefile.img]
|
|||
-z Compress image after shrinking with gzip
|
||||
-Z Compress image after shrinking with xz
|
||||
-a Compress image in parallel using multiple cores
|
||||
-p Remove logs, apt archives, dhcp leases and ssh hostkeys
|
||||
-d Write debug messages in a debug log file
|
||||
EOM
|
||||
echo "$help"
|
||||
|
@ -175,15 +174,13 @@ debug=false
|
|||
repair=false
|
||||
parallel=false
|
||||
verbose=false
|
||||
prep=false
|
||||
ziptool=""
|
||||
|
||||
while getopts ":adhprsvzZ" opt; do
|
||||
while getopts ":adhrsvzZ" opt; do
|
||||
case "${opt}" in
|
||||
a) parallel=true;;
|
||||
d) debug=true;;
|
||||
h) help;;
|
||||
p) prep=true;;
|
||||
r) repair=true;;
|
||||
s) should_skip_autoexpand=true ;;
|
||||
v) verbose=true;;
|
||||
|
@ -312,15 +309,6 @@ else
|
|||
echo "Skipping autoexpanding process..."
|
||||
fi
|
||||
|
||||
if [[ $prep == true ]]; then
|
||||
info "Syspreping: Removing logs, apt archives, dhcp leases and ssh hostkeys"
|
||||
mountdir=$(mktemp -d)
|
||||
mount "$loopback" "$mountdir"
|
||||
rm -rvf $mountdir/var/cache/apt/archives/* $mountdir/var/lib/dhcpcd5/* $mountdir/var/log/* $mountdir/var/tmp/* $mountdir/tmp/* $mountdir/etc/ssh/*_host_*
|
||||
umount "$mountdir"
|
||||
fi
|
||||
|
||||
|
||||
#Make sure filesystem is ok
|
||||
checkFilesystem
|
||||
|
||||
|
|
Loading…
Reference in New Issue