Created
October 19, 2014 17:51
-
-
Save cyanidium/c87229c534a15852127a to your computer and use it in GitHub Desktop.
For Arch Linux. If you're trying to keep your installed package count under control this might help sort out what you need installed and what was installed by something else.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This script will change any explicity/manually installed packages that are | |
# dependended on by other packages into packages installed as dependencies. The | |
# idea is to minimise the manually installed packages throughout upgrades. | |
# | |
PACMAN=yaourt | |
TEMPDIR=$(mktemp -d /tmp/packages.XXXXXXXXXX) | |
${PACMAN} -Qe > ${TEMPDIR}/manual.lst | |
${PACMAN} -Qet > ${TEMPDIR}/needed.lst | |
sort ${TEMPDIR}/manual.lst > ${TEMPDIR}/manual.srt | |
sort ${TEMPDIR}/needed.lst > ${TEMPDIR}/needed.srt | |
comm -3 ${TEMPDIR}/manual.srt ${TEMPDIR}/needed.srt | cut -d' ' -f1 | cut -d'/' -f2 > ${TEMPDIR}/really-deps.srt | |
exit | |
if [ ! -z $(cat ${TEMPDIR}/really-deps.srt) ]; then | |
${PACMAN} --noconfirm --asdeps -S $(cat ${TEMPDIR}/really-deps.srt) | |
fi | |
rm ${TEMPDIR}/manual.lst ${TEMPDIR}/needed.lst ${TEMPDIR}/manual.srt ${TEMPDIR}/needed.srt ${TEMPDIR}/really-deps.srt | |
rmdir ${TEMPDIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment