With option -p delete also users bash history
This commit is contained in:
parent
6eb7ea8d50
commit
2ef298e9b8
|
@ -163,7 +163,7 @@ 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
|
||||
-p Remove logs, apt archives, dhcp leases, ssh hostkeys and users bash history
|
||||
-d Write debug messages in a debug log file
|
||||
EOM
|
||||
echo "$help"
|
||||
|
@ -305,11 +305,12 @@ else
|
|||
fi
|
||||
|
||||
if [[ $prep == true ]]; then
|
||||
info "Syspreping: Removing logs, apt archives, dhcp leases and ssh hostkeys"
|
||||
info "Syspreping: Removing logs, apt archives, dhcp leases, ssh hostkeys and users bash history"
|
||||
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_*
|
||||
ln -s /lib/systemd/system/regenerate_ssh_host_keys.service $mountdir/etc/systemd/system/multi-user.target.wants/regenerate_ssh_host_keys.service
|
||||
find $mountdir/home/ -name ".bash_history" -type f -exec rm -vf {} \;
|
||||
ln -sv /lib/systemd/system/regenerate_ssh_host_keys.service $mountdir/etc/systemd/system/multi-user.target.wants/regenerate_ssh_host_keys.service
|
||||
umount "$mountdir"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue