clean-system, mirror & suite replacement

This commit is contained in:
Son
2020-08-10 16:55:26 +02:00
parent 7a914bd31e
commit a07975ddcb
38 changed files with 369 additions and 458 deletions

View File

@@ -29,7 +29,7 @@ compress="xz"
# Choose filesystem format to format ( ext3 or ext4 )
fstype="ext3"
# If you have your own preferred mirrors, set them here.
mirror=${4:-"http://http.kali.org/kali"}
mirror=${mirror:-"http://http.kali.org/kali"}
# Gitlab url Kali repository
kaligit="https://gitlab.com/kalilinux"
# Github raw url
@@ -285,7 +285,7 @@ systemd-nspawn_exec /third-stage
systemd-nspawn_exec dpkg-divert --remove --rename /usr/bin/dpkg
# Clean system
systemd-nspawn_exec << EOF
systemd-nspawn_exec << 'EOF'
rm -f /0
rm -rf /bsp
fc-cache -frs
@@ -300,10 +300,9 @@ rm -rf /var/lib/apt/lists/*
rm -rf /var/cache/apt/*.bin
rm -rf /var/cache/apt/archives/*
rm -rf /var/cache/debconf/*.data-old
for logs in $(find /var/log -type f); do > $logs; done
history -c
EOF
#Clear all logs
for logs in `find $work_dir/var/log -type f`; do > $logs; done
# Disable the use of http proxy in case it is enabled.
if [ -n "$proxy_url" ]; then
@@ -311,11 +310,10 @@ if [ -n "$proxy_url" ]; then
rm -rf ${work_dir}/etc/apt/apt.conf.d/66proxy
fi
# Mirror replacement
if [[ ! -z "${@:5}" || "$suite" != "kali-rolling" ]]; then
mirror=${@:5}
[ ! -z "${@:5}" ] || mirror="http://http.kali.org/kali"
[ "$suite" != "kali-rolling" ] && suite=kali-rolling
# Mirror & suite replacement
if [[ ! -z "${4}" || ! -z "${5}" ]]; then
mirror=${4}
suite=${5}
fi
# Define sources.list
@@ -414,7 +412,6 @@ else
fi
# Clean up all the temporary build stuff and remove the directories.
# Comment this out to keep things around if you want to see what may have gone
# wrong.
# Comment this out to keep things around if you want to see what may have gone wrong.
echo "Cleaning up temporary build system"
rm -rf "${basedir}"