Skip to content

Instantly share code, notes, and snippets.

@nbyouri
Last active August 29, 2015 14:26
Show Gist options
  • Save nbyouri/83b737b7cb54763486b9 to your computer and use it in GitHub Desktop.
Save nbyouri/83b737b7cb54763486b9 to your computer and use it in GitHub Desktop.
xfce src version checker
#!/bin/ksh
# Check xfce package versions against pkgsrc. Produce a markdown table.
xfce_site="http://archive.xfce.org/src/xfce/"
set -A pkgs "exo garcon gtk-xfce-engine libxfce4ui libxfce4util thunar-desktop-pkg
thunar-volman thunar tumbler xfce4-appfinder xfce4-dev-tools xfce4-docs xfce4-panel
xfce4-power-manager xfce4-session xfconf xfdesktop xfwm4"
get_pkgsrc_version() {
case $1 in
'exo'|'garcon'|'thunar'|'tumbler')
pkg='xfce4-'$1
note='imported as '$pkg
;;
'xfconf')
pkg='xfce4-conf'
note='imported as '$pkg
;;
'xfdesktop')
pkg='xfce4-desktop'
note='imported as '$pkg
;;
'xfwm4')
pkg='xfce4-wm'
note='imported as '$pkg
;;
'gtk-xfce-engine')
pkg='xfce4-gtk2-engine'
note='imported as '$pkg
;;
'thunar-volman')
status='linux only, depends on udev'
;;
'xfce4-power-manager')
status='netbsd upower backend needed, wip'
;;
*)
pkg=$1
note='imported'
;;
esac
pkg_url="http://pkgsrc.se/search.php?so=$pkg"
pkgse_version=`curl -s -L $pkg_url|grep -o '<b>version .*</b>'|awk -F"<" '{sub(/<b>version\ /, "");print $1}'`
if [ -z $pkgse_version ]; then
echo $status " | /"
else
echo $note" | "$pkgse_version
fi
}
get_last_version() {
#echo "package | status | upstream |pkgsrc"
#echo "-------| --------| ------|------"
for pkg in ${pkgs[@]}; do
html=`curl -s -L $xfce_site$pkg|fgrep "folder"|tail -1`
folder=`echo $html | awk -F"\"" '{print "/"$4}'`
if [ `echo $html | sed '/^$/d' |wc -l` -gt 0 ]; then
html=`curl -s -L $xfce_site$pkg$folder | fgrep "archive"|tail -1`
archive=`echo $html | awk -F"\"" '{print $4}'`
latest_version=`echo $archive | awk -F"-" '{sub(/\.tar\..*/, ""); print $NF}'`
if [ `echo $html | sed '/^$/d' | wc -l` -gt 0 ]; then
echo "$pkg | `get_pkgsrc_version $pkg`|$latest_version"
fi
fi
done
}
get_last_version | column -s " " -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment