home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
tusportal.tus.k12.pa.us
/
tusportal.tus.k12.pa.us.tar
/
tusportal.tus.k12.pa.us
/
Wyse
/
latest-image.raw
/
0.img
/
usr
/
sbin
/
addon-install
< prev
next >
Wrap
Text File
|
2010-09-30
|
2KB
|
65 lines
#!/bin/bash
function usage()
{
echo "Usage: $0 <addon.rpm>" >/dev/stderr
exit 1
}
ADDON=$1
if test -z $ADDON; then
echo "No addon specified" >/dev/stderr
usage
fi
if ! rpm -qp $ADDON >/dev/null 2>&1; then
echo "$ADDON is not a RPM file" >/dev/stderr
usage
fi
if [ -f /etc/architecture ] ; then
SLETC_ARCH=$(cat /etc/architecture)
else
SUSE_VERSION=$(echo $(awk -F '=' '/VERSION/ {print $2}' /etc/SuSE-release))
SUSE_PATCHLEVEL=$(echo $(awk -F '=' '/PATCHLEVEL/ {print $2}' /etc/SuSE-release))
if [ $SUSE_PATCHLEVEL -eq 0 ] ; then
SLETC_ARCH=sletc"$SUSE_VERSION"
else
SLETC_ARCH=sletc"$SUSE_VERSION"sp"$SUSE_PATCHLEVEL"
fi
fi
ARCH=`rpm -qp --queryformat "%{ARCH}" $ADDON`
if [ x$ARCH != x$SLETC_ARCH ]; then
echo "Package is not for this SLETC version" > /dev/stderr
exit 1
fi
NAME=`rpm -qp --queryformat "%{NAME}\n" $ADDON`
if ! rpm -qlp $ADDON | grep "/var/lib/addons/$NAME.squash" >/dev/null 2>&1; then
echo "Package is not a valid Thin Client RPM" > /dev/stderr
exit 1
fi
if rpm -q $NAME >/dev/null 2>&1; then
INSTALLED="yes"
else
INSTALLED="no"
fi
addonRequires=`rpm -qp --requires $ADDON | grep "ADDON:"`
for req in $addonRequires; do
found="no"
reqName=`echo $req | cut -d: -f2`
if ! rpm -q $reqName >/dev/null 2>&1; then
echo "Dependency '$reqName' was not found" >/dev/stderr
exit 1
fi
done
if test $INSTALLED = "yes";then
rpm -e --nodeps $NAME
fi
rpm -Uh --nodeps --force $ADDON