autospec/unmaintained/autoupdate-kde.in

163 lines
3.9 KiB
Plaintext
Raw Permalink Normal View History

2011-04-26 21:39:44 +02:00
#!/bin/bash
# autoupdate-kde -- update all the KDE packages
# Copyright (C) 2005,2006 Davide Madrisan <davide.madrisan@gmail.com>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the
# Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.
#
# Report bugs to <davide.madrisan@gmail.com>
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
echo $"this script requires bash version 2 or better" >&2 && exit 1
me=("${0##*/}" "0.1.1")
if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
. /etc/sysconfig/i18n
export LANG
fi
TEXTDOMAIN="@package@"; export TEXTDOMAIN
[ -r @libdir@/libmsgmng.lib ] ||
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
exit 1; }
. @libdir@/libmsgmng.lib
let "action_build = 0"
let "action_check = 0"
let "action_download = 0"
let "action_install = 0"
let "action_upload = 0"
# default package list
pcklist="\
arts
kdelibs
kdebase
kdeadmin
kdepim
kdemultimedia
kdegames
kdegraphics
kdenetwork
kdeutils
kdeartwork
kdesdk
kdeedu
kdebindings
kdetoys
kdeaccessibility
kdeaddons
kde-i18n
kdevelop
kdewebdev"
function usage() {
echo "\
$me, "$"version"" ${me[1]}""
"$"Update all the KDE packages.""
Copyright (C) 2005 Davide Madrisan <davide.madrisan@qilinux.it>""
"$"Usage"":
$me {-b|-c|-d|-i|-u} [-p=<pcklist>] <kdever>
"$"where the above options mean"":
-b, --build build the packages
-c, --check check the packages
-d, --download download the source packages
-i, --install install the rpm packages
-u, --upload upload the rpm packages
-p, --pcklist space separated list of packages
"$"Operation modes"":
-h, --help Print this help, then exit
"$"Some examples"":
$me -dbi --pcklist=\"arts kdelibs kdebase\"
"$"Report bugs to <davide.madrisan@qilinux.it>."
}
OPTS=`LANG=C getopt -o bcdiup:h \
--long build,check,download,install,upload,pcklist:,help -n "$me" -- "$@"`
[ $? = 0 ] || return 1
eval set -- "$OPTS"
while :; do
case $1 in
-b|--build)
let "action_build = 1" ;;
-c|--check)
let "action_check = 1" ;;
-d|--download)
let "action_download = 1" ;;
-i|--install)
let "action_install = 1" ;;
-u|--upload)
let "action_upload = 1" ;;
-p|--pcklist)
pcklist="$2"
shift ;;
-h|--help)
usage; exit ;;
--) shift; break ;;
*) notify.error $"\
(bug)"" -- $FUNCNAME: "$"\`getopt' error" ;;
esac
shift
done
kdever=$1
[ "$kdever" ] ||
{ echo $"missing mandatory arg (KDE version)"; exit 1; }
flist=`mktemp -q -t flist.XXXXXXXX` ||
{ echo $"can't create temporary files" 1>&2
exit 1; }
KDEURL="ftp://ftp.kde.org/pub/kde/stable/$kdever/src"
curl -s --url $KDEURL/ --list-only -o $flist 2>/dev/null
artsver=$(\
sed -n "/arts-[0-9\.]*.tar/{s,arts-,,;s,\.tar\..*,,p}" $flist)
kdevelopver=$(\
sed -n "/kdevelop-[0-9\.]*.tar/{s,kdevelop-,,;s,\.tar\..*,,p}" $flist)
rm -f $flist
function do_pck_update() {
actions="$1"
[ "$actions" ] ||
{ echo $"\
(bug)"" -- $FUNCNAME: "$"missing mandatory arg (#1)" 1>&2
exit 1; }
for pck in $pcklist; do
case "$pck" in
arts)
autospec -u arts -a"$actions" $artsver \
--define kdever=$kdever ;;
kdevelop)
autospec -u kdevelop -a"$actions" $kdevelopver \
--define kdever=$kdever ;;
*) autospec -u $pck -a"$actions" $kdever ;;
esac
done
}
# [1] download source packages
[ "$action_download" = "0" ] || do_pck_update "1,3"
# [2] build the new rpm and srpm packages
[ "$action_build" = "0" ] || do_pck_update "4,5"
# [3] check packages
[ "$action_check" = "0" ] || do_pck_update "7"
# [4] install packages
[ "$action_upload" = "0" ] || do_pck_update "8"
# [5] upload packages
[ "$action_install" = "0" ] || do_pck_update "11"
# ADDME ...