40 lines
1.5 KiB
Bash
Executable file
40 lines
1.5 KiB
Bash
Executable file
#!/bin/bash -e
|
|
# vim: set ts=4 sw=4 sts=4 et :
|
|
### 09_cleanup.sh : Clean up the new chroot prior to image finalisation
|
|
echo "--> Archlinux 09_cleanup.sh"
|
|
|
|
set -e
|
|
[ "$VERBOSE" -ge 2 -o "$DEBUG" -gt 0 ] && set -x
|
|
|
|
# Remove unused packages and their dependencies (make dependencies)
|
|
cleanuppkgs="$("${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c 'pacman -Qdt | grep -v kernel | cut -d " " -f 1')"
|
|
if [ -n "$cleanuppkgs" ] ; then
|
|
echo " --> Packages that will be cleaned up: $cleanuppkgs"
|
|
"${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c "pacman --noconfirm -Rsc $cleanuppkgs"
|
|
else
|
|
echo " --> NB: No packages to clean up"
|
|
fi
|
|
|
|
echo " --> Removing video plugins..."
|
|
videopkgs="$("${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c 'pacman -Qs -q xf86-video')"
|
|
echo $videopkgs | "${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c 'pacman --noconfirm -Rsc -'
|
|
|
|
echo " --> Removing other font packages..."
|
|
"${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \
|
|
"pacman --noconfirm -Rsc xorg-fonts-100dpi xorg-fonts-75dpi"
|
|
|
|
# TODO: Be more deliberate here; is the umount necessary?
|
|
# Moreover, given where this script is called, should we be bothering
|
|
# alpine-chroot?
|
|
echo " --> Cleaning up pacman state..."
|
|
umount "${INSTALLDIR}/var/cache/pacman" || true
|
|
unset PACMAN_CACHE_DIR
|
|
"${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \
|
|
"pacman --noconfirm -Scc"
|
|
|
|
echo " --> Cleaning /etc/resolv.conf"
|
|
rm -f "${INSTALLDIR}/etc/resolv.conf"
|
|
cat > "${INSTALLDIR}/etc/resolv.conf" << EOF
|
|
# This file intentionally left blank
|
|
|
|
EOF
|