summaryrefslogtreecommitdiff
path: root/update-cleansystem
diff options
context:
space:
mode:
Diffstat (limited to 'update-cleansystem')
-rwxr-xr-xupdate-cleansystem23
1 files changed, 12 insertions, 11 deletions
diff --git a/update-cleansystem b/update-cleansystem
index 4ea6a24..7c652ab 100755
--- a/update-cleansystem
+++ b/update-cleansystem
@@ -22,6 +22,9 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+set -e
+
+# libretools.conf gives us libremessages
source /etc/libretools.conf
cleansystem=/etc/libretools.d/cleansystem
@@ -47,16 +50,14 @@ if [ ! -w "$cleansystem" ]; then
exit 1
fi
-tmpdir="`mktemp -d --tmpdir cleansystem.XXXXXXXXXX`"
-mkdir -p "${tmpdir}"/var/lib/pacman
+# 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 -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=$?
-
-rm -rf "$tmpdir"
-
-exit $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 > "$cleansystem"
+pacman -Sy --needed --noconfirm base base-devel sudo "$@"