Skip to content

Instantly share code, notes, and snippets.

@assimilat
Created August 24, 2023 16:08
Show Gist options
  • Save assimilat/89ffb23d10ac9e076987e760ffdc620f to your computer and use it in GitHub Desktop.
Save assimilat/89ffb23d10ac9e076987e760ffdc620f to your computer and use it in GitHub Desktop.
pacman system update via pm2ml and aria2
#!/bin/bash
HAVE_SUDO="";
rm /tmp/sudo.tmp
while [ -z "${HAVE_SUDO}" ];
do
if [ -z "$(grep 'USER=root' /tmp/sudo.tmp)" ];
then
echo "Need sudo privs!";
echo "Login sudo now!";
sudo env | sed -e "s/[ ]/\n/g" > /tmp/sudo.tmp;
else
HAVE_SUDO="1";
fi
done
for i in $(ls /var/cache/pacman/pkg/ | grep "[.]1[.]...$\|aria2$");
do
sudo rm /var/cache/pacman/pkg/${i};
done
cd /;
pm2ml -uso /var/cache/pacman/pkg/ > /tmp/update.ml;
sudo aria2c -c -V -M /tmp/update.ml && pacman -Su --noconfirm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment