All pastes #1498586 Raw Edit

Something

public text v1 · immutable
#1498586 ·published 2009-07-17 19:26 UTC
rendered paste body
#!/bin/bash
#Finding updates to lib32 packages

get_pkgver(){
    echo $1 | rev | awk -F"-" '{print $2}' | rev;
}

get_pkgrel(){
    echo $1 | rev | awk -F"-" '{print $1}' | rev;
}

get_pkgname(){
    source_string=$1;
    substring="-$2-$3";
    echo ${source_string%$substring};
}
check_all(){
    if [ $_pkgver != $pkgver ];then
	echo "$pkgname $_pkgver new $pkgver is old";
    else
	if [ $_pkgrel != $pkgrel ];then
	    echo "$pkgname $_pkgrel is newrel $pkgrel is old";
	fi
    fi

}

find_package(){
    _pkgname=${1#"lib32-"};
    #testing first core
    result=`ls -1 /var/lib/pacman/sync/core | grep ^$_pkgname -m1`;
    if [ -z $result ]; then
	result=`ls -1 /var/lib/pacman/sync/extra | grep ^$_pkgname -m1`;
    fi
    _pkgver=`get_pkgver $result`;
    _pkgrel=`get_pkgrel $result`;
}

list=`ls -1 /var/lib/pacman/sync/community/ | grep ^lib32-`
#MAIN
for i in $list; do
    pkgver=`get_pkgver $i`;
    pkgrel=`get_pkgrel $i`;
    pkgname=`get_pkgname $i $pkgver $pkgrel`
    find_package $pkgname;
    check_all;
done