summaryrefslogtreecommitdiff
path: root/update-cleansystem
blob: 98eb0dcd77106dd18cab8325dc2dd05a9857e6d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Updates the cleansystem file
# Creates a fake Parabola root and prints all packages installable from base
# and base-devel plus extras

set -e

if [ ! -w / ]; then
    echo "Run as root."
    exit 1
fi

# Maintain a clean database in the system
db_dir="${DB:-/var/lib/libretools/clean}"

[ ! -d "${db_dir}" ] && mkdir -p "${db_dir}"

# We sync first because updating info gets printed to stdout too
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

pacman -Sy --needed --noconfirm base base-devel sudo $@

exit $?