qubes-linux-template-builder/scripts_archlinux/09_cleanup.sh
Marek Marczykowski d13a4eff88 archlinux: do not use additional sudo inside scripts_archlinux/*
The whole build process is started as root (check Makefile), so there is
no need for additional sudo. This makes some things much simpler
(for example appending to some files).
2013-04-28 22:50:18 +02:00

32 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
set -e
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
echo "--> Starting cleanup actions"
# Remove unused packages and their dependencies (make dependencies)
cleanuppkgs=`./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman -Qdt | cut -d " " -f 1`
echo "--> Packages that can be cleaned up: $cleanuppkgs"
if [ -n "$cleanuppkgs" ] ; then
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc $cleanuppkgs
fi
# Remove non required linux kernel
echo "--> Cleaning up linux kernel"
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc linux
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -S linux-firmware
# Clean pacman cache
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Scc
umount mnt_archlinux_dvd
#rm -f $INSTALLDIR/var/lib/rpm/__db.00* $INSTALLDIR/var/lib/rpm/.rpm.lock
#yum -c $PWD/yum.conf $YUM_OPTS clean packages --installroot=$INSTALLDIR
# Make sure that rpm database has right format (for rpm version in template, not host)
#echo "--> Rebuilding rpm database..."
#chroot `pwd`/mnt /bin/rpm --rebuilddb 2> /dev/null