diff options
Diffstat (limited to 'update-cleansystem')
-rwxr-xr-x | update-cleansystem | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/update-cleansystem b/update-cleansystem index 4ea6a24..53d21d9 100755 --- a/update-cleansystem +++ b/update-cleansystem @@ -3,6 +3,7 @@ # Creates a fake Parabola root and writes to cleansystem all # packages installable from base and base-devel plus extras. +set -e # Copyright 2012 Nicolás Reynolds, Luke Shumaker # ---------- GNU General Public License 3 ---------- @@ -42,21 +43,18 @@ if [ "$1" == '-h' ]; then exit 0 fi -if [ ! -w "$cleansystem" ]; then - error 'This script must be run as root' - exit 1 -fi +# Maintain a clean database in the system +db_dir="${DB:-/var/lib/libretools/clean}" -tmpdir="`mktemp -d --tmpdir cleansystem.XXXXXXXXXX`" -mkdir -p "${tmpdir}"/var/lib/pacman +[ ! -d "${db_dir}" ] && mkdir -p "${db_dir}" # We sync first because updating info gets printed to stdout too -pacman -r "${tmpdir}" --config /etc/pacman.conf -Sy 2>/dev/null -pacman -r "${tmpdir}" --config /etc/pacman.conf \ - -Sp --print-format "%n" \ - base base-devel sudo "$@" | sort > "$cleansystem" -exitcode=$? +pacman -b "${db_dir}" --config /etc/pacman.conf -Sy 2>/dev/null +pacman -b "${db_dir}" \ + --config /etc/pacman.conf \ + -Sp --print-format "%n" \ + base base-devel sudo ${@} | sort > /etc/libretools.d/cleansystem -rm -rf "$tmpdir" +pacman -Sy --needed --noconfirm base base-devel sudo $@ -exit $exitcode +exit $? |