You are not logged in.
So, I decided to hack together a little script that might be useful to someone else too. I wanted to script that would show me all available updates, from from the official repos as well as from the aur. I also wanted to see at a glance what the installed versions of each package and the new version to be installed are.
The output looks something like this:
[shaun@shaun-asus-x202e ~]$ auru
Available updates from core:
vlc 2.1.2-2 2.1.2-3
Available updates from AUR:
ansible 1.4.3-1 1.4.4-1
Would you like to install all updates without further prompting?
y/n->Here's the code that I put into a dropbox shared file called arch_functions and source it from ~/.bashrc. Replace the test_apacman function and associated commands with aur wrapper of choice. Once this is in place, I simply run auru once a day on all my machines and I get all the information I need, and only press a y or n in order install all updates.
bold="\033[1m"
endbold="\033[0m"
test_apacman() {
hash apacman 2>/dev/null || \
{
#packer -S apacman --noedit --noconfirm
#sudo pacman -S --needed --noconfirm base-devel jshon git curl
hash wget 2>/dev/null || sudo pacman -S --needed --noconfirm wget
origdir=$(pwd)
cd ${HOME}
mkdir -p ./tmpaur/
cd ./tmpaur/
wget https://aur.archlinux.org/packages/ap/apacman/apacman.tar.gz
tar xfv apacman*
cd apacman
makepkg
sudo pacman -U --needed --noconfirm apacman-*.pkg.tar.xz
cd "$origdir"
}
}
auru() {
updatesavail=0
## check that dependencies are installed
# expac
hash expac || sudo pacman -S --needed --noconfirm expac
# apacman
test_apacman
### check core updates
pacman -Syy
echo -en "${bold}Available updates from core:${endbold}\n"
pacmanupdates=$(sudo pacman -Qu)
for pacmanupdate in "$pacmanupdates"
do
if [ "$pacmanupdate" == "" ]
then
echo "No core updates"
else
pkg=$(echo "$pacmanupdate" | awk '{print $1}')
pkgvernow=$(echo "$pacmanupdate" | awk '{print $2}')
pkgveravail=$(sudo pacman -Si ${pkg} | grep Version | awk '{print $3}')
#echo -en "$pkg\t$pkgvernow\t$pkgveravail\n"
printf '%-25s' "$pkg"
printf '%-20s' "$pkgvernow"
printf '%-20s\n' "$pkgveravail"
updatesavail=$((updatesavail + 1))
fi
done
### check aur updates
echo -en "${bold}Available updates from AUR:${endbold}\n"
aurupdates=$(apacman --auronly --quickcheck)
for aurupdate in "$aurupdates"
do
if [ "$aurupdate" == "" ]
then
echo "No AUR updates"
else
pkg="$aurupdate"
pkgvernow=$(sudo pacman -Q ${pkg} | awk '{print $2}')
pkgveravail=$(apacman -Ss ${pkg} | grep "aur/${pkg} " | awk '{print $2}')
printf '%-25s' "$pkg"
printf '%-20s' "$pkgvernow"
printf '%-20s\n' "$pkgveravail"
updatesavail=$((updatesavail + 1))
fi
done
### apply updates if any
if [ $updatesavail -gt 0 ]
then
echo "Would you like to install all updates without further prompting?"
read -p "y/n->" answer
if [ "$answer" == "y" ]
then
sudo pacman -Su --noconfirm
apacman -Su --auronly --noedit --noconfirm --needed
fi
fi
}Last edited by senorsmile (2014-01-20 04:41:14)
Offline