Monday, September 20, 2010

pactesting -- script to install packages from the testing repos

Pretty simple script to install packages from the testing repos, the comments say it all. The pacman-testing.conf file is a copy of pacman.conf with only the [testing] and [community-testing] repos enabled.

#!/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 reveived, resyncing repos and exiting..."
    pacman -Sy
    exit 1
fi

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

# resync with regular repos
pacman -Sy

exit 0

No comments:

Post a Comment