archboot/usr/bin/archboot-not-installed.sh

19 lines
546 B
Bash
Raw Normal View History

2023-02-07 09:22:33 +01:00
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-only
# created by Tobias Powalowski <tpowa@archlinux.org>
2023-02-07 09:14:40 +01:00
if [[ ! "$(cat /etc/hostname)" == "archboot" ]]; then
echo "This script should only be run in booted archboot environment. Aborting..."
exit 1
fi
rm -r /usr/share/licenses
pacman -Sy
pacman -Q | cut -d ' ' -f1 >packages.txt
for i in $(cat packages.txt); do
rm -r /var/lib/pacman/local/$i*
if pacman -S $i --noconfirm &>>log.txt; then
echo $i >> uninstalled.txt
else
pacman -S $i --noconfirm --overwrite '*'
fi
done