Wednesday, September 22, 2010

pactesting [update]

Looks like the resync isn't needed. Pacman will only sync and download the active repos in the config file. It doesn't remove the synced tarballs from the /var/lib/pacman directory. So, here's my updated script.

#!/bin/sh

config='/etc/pacman-testing.conf'
packages=""

# make sure the script is being run as root
if [[ $(id -u) != 0 ]]; then
    echo "error: you must be root to run this script"
    exit 1
fi

# Sync pacman with testing repos
pacman -Sy --config $config

# make sure packages exist
echo "checking package name(s)..."
for i in $@; do
    pacman -Qi $i > /dev/null
    [[ "$?" = "1" ]] && echo "skipping..." && continue
    packages=$packages" $i"
done

if [[ $packages = "" ]]; then
    echo "error: no existing packages received, resyncing repos and exiting..."
    exit 1
fi

# upgrade packages
pacman -S --config $config $packages

exit 0

No comments:

Post a Comment