jw-pkg/scripts/jannet
2007-09-20 16:23:36 +00:00

111 lines
1.8 KiB
Bash

#!/bin/sh
myname=`basename $0`
opts="v"
channel_present()
{
if smart channel --show $1 2>&1 | grep -q baseurl >/dev/null; then
return 0
fi
return 1
}
usage()
{
cat << EOT
$myname command [arguments]
command is one of
help: show this help screen
init: initialize
uninit: undo initialization
install: install packages in [arguments]
update: update all jannet software on the system
info: query information about installed software
EOT
if [ "$1" ]; then
exit $1
fi
}
get_opts()
{
set -- `getopt $opts $*`
while [ "$1" != -- ] ; do
case "$1" in
-v)
opt_verbose=true
;;
*)
eusage
;;
esac
shift
done
shift
}
cmd="$1"
shift
get_opts $*
case $cmd in
init)
if ! channel_present ftp.jannet.de; then
echo -n "adding installation source ... "
sudo smart channel -y --add ftp.jannet.de \
type=yast2 \
baseurl=ftp://dspadm:dspasswd@ftp.jannet.de/pub/packages/linux/suse/10.1/inst-source \
>/dev/null 2>&1
if channel_present; then echo done; else echo failed; fi
fi
;;
uninit)
if channel_present ftp.jannet.de; then
echo -n "removing installation source ... "
sudo smart channel -y --remove ftp.jannet.de >/dev/null 2>&1
echo done
fi
;;
update)
sudo smart update ftp.jannet.de
sudo smart upgrade -y
;;
install)
sudo smart update ftp.jannet.de
sudo smart install -y $*
;;
info)
if [ "$opt_verbose" = true ]; then
rpm -qai | grep -iB 7 "jannet.de\|c-mexx.com"
else
rpm -qai | \
grep -iB 7 "jannet.de\|c-mexx.com" | \
sed '/Name/ !d; s/Name *: //; s/ *.*//' | \
xargs rpm -q | \
sort -u
fi
;;
cpp-glib)
sudo rpm -U --replacefiles --replacepkgs --oldpackage \
ftp://dspadm@ftp.jannet.de/pub/packages/linux/suse/10.1/inst-source/rpm/i586/glib2-2.8.5-19.i586.rpm
;;
help)
usage 0
;;
*)
usage 1
;;
esac