openmamba-netsrpms script modifications for automatic updates
This commit is contained in:
parent
4834a30427
commit
c1e003b953
@ -1,3 +1,8 @@
|
||||
Changes in version 2.2.20 <silvan.calarco@mambasoft.it> 20110426
|
||||
- openmamba-update: moved from openmamba-release package
|
||||
- openmamba-netsrpms: new name of netsrpminstall.sh script with multiple package and automatic update support
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Changes in version 2.2.19 <silvan.calarco@mambasoft.it> 20110423
|
||||
- xramdr: removed (now correctly managed by KDE interface/graphics drivers)
|
||||
- added current version information in SRPMS flash, win32codecs and skype specfiles to allow automatic upgrade
|
||||
|
18
Makefile
18
Makefile
@ -105,6 +105,7 @@ pck_catalogs3 := $(wildcard usbinstall/po/*.po)
|
||||
s,@vendor@,$(RPM_VENDOR),g;\
|
||||
s,@sysconfigfile@,$(SYSCONFIGFILE),g;\
|
||||
s,@datadir@,${datadir},g;\
|
||||
s,@bindir@,$(bindir),g;\
|
||||
s,@distrobindir@,$(distrobindir),g;\
|
||||
s,@distrokdedir@,$(distrokdedir),g;\
|
||||
s,@distrosrpmsdir@,$(distrosrpmsdir),g;\
|
||||
@ -177,10 +178,6 @@ install-kde-distro-addons: dist-update
|
||||
$(INSTALL_DATA) kde/wallpapers/{$(COMPIZ_WALLPAPERS)} $(DESTDIR)$(mambaimagesdir)
|
||||
$(INSTALL_SCRIPT) kde/bin/konsole-nofork $(DESTDIR)$(kde4bindir)
|
||||
|
||||
install-netsrpm: menu/netsrpm-install.sh
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(distrobindir)
|
||||
$(INSTALL_PROGRAM) menu/netsrpm-install.sh $(DESTDIR)$(distrobindir)/netsrpm-install.sh
|
||||
|
||||
install-distromenu: dist-update
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(xdg_directorydir)
|
||||
$(INSTALL_DATA) menu/applications/distroutils.directory \
|
||||
@ -267,15 +264,20 @@ install-usbinstall:
|
||||
$(INSTALL_SCRIPT) usbinstall/usbinstall.sh $(DESTDIR)$(usbinstalldatadir)
|
||||
$(INSTALL_DATA) usbinstall/usbinstall.desktop $(DESTDIR)$(xdg_appsdir)
|
||||
|
||||
install-openmamba-update:
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(bindir)
|
||||
$(INSTALL_SCRIPT) openmamba-update/openmamba-update $(DESTDIR)$(bindir)
|
||||
$(INSTALL_SCRIPT) openmamba-update/openmamba-netsrpms $(DESTDIR)$(bindir)
|
||||
|
||||
install: $(pck_infiles:.in=) \
|
||||
install-kde-distro-addons \
|
||||
install-netsrpm \
|
||||
install-distromenu \
|
||||
install-srpms \
|
||||
install-mambabase \
|
||||
install-mambawelcome \
|
||||
install-mambareport \
|
||||
install-usbinstall \
|
||||
install-openmamba-update \
|
||||
install-bootrecover \
|
||||
install-locales \
|
||||
install-icons \
|
||||
@ -288,9 +290,11 @@ dist: clean
|
||||
echo "ChangeLog not updated; not releasing" 1>&2;\
|
||||
exit 1;; \
|
||||
esac
|
||||
@mkdir /tmp/$(distdir)
|
||||
@cp -a * /tmp/$(distdir)/
|
||||
@rm -f $(dist_archive);\
|
||||
tar cf - --exclude=$(dist_archive) -C .. $(distdir) | \
|
||||
bzip2 -9 -c > $(dist_archive)
|
||||
tar cf - -C /tmp $(distdir) | bzip2 -9 -c > $(dist_archive)
|
||||
@rm -rf /tmp/$(distdir)
|
||||
@echo "file \`$(dist_archive)' created"
|
||||
|
||||
dist-rpm: dist
|
||||
|
@ -168,7 +168,7 @@ fi
|
||||
if [ "$INSTALL_FLASH" = "1" ]; then
|
||||
echo $"Installing flash plugin"
|
||||
dcop_write $"Installing Flash plugin..." 10
|
||||
konsole-nofork --background-mode -e /usr/share/openmamba/bin/netsrpm-install.sh flashplugin i586
|
||||
konsole-nofork --background-mode -e /usr/bin/openmamba-netsrpms flashplugin
|
||||
echo $"Executing nspluginscan"
|
||||
nspluginscan
|
||||
rpm -q gnash && {
|
||||
@ -180,18 +180,18 @@ fi
|
||||
if [ "$INSTALL_CODECS" = "1" ]; then
|
||||
echo $"Installing win32 codecs"
|
||||
dcop_write $"Installing Win32 codecs..." 10
|
||||
konsole-nofork --background-mode -e /usr/share/openmamba/bin/netsrpm-install.sh win32codecs i586
|
||||
konsole-nofork --background-mode -e /usr/bin/openmamba-netsrpms win32codecs
|
||||
fi
|
||||
|
||||
if [ "$INSTALL_MSTTCF" = "1" ]; then
|
||||
dcop_write $"Installing MS TrueType core fonts..." 10
|
||||
konsole-nofork --background-mode -e /usr/share/openmamba/bin/netsrpm-install.sh msttcorefonts noarch
|
||||
konsole-nofork --background-mode -e /usr/bin/openmamba-netsrpms msttcorefonts
|
||||
fi
|
||||
|
||||
if [ "$INSTALL_SKYPE" = "1" ]; then
|
||||
rpm -q libqt4 >/dev/null || apt_get_parsed install -y libqt4
|
||||
dcop_write $"Installing Skype software..." 10
|
||||
konsole-nofork --background-mode -e /usr/share/openmamba/bin/netsrpm-install.sh skype i586
|
||||
konsole-nofork --background-mode -e /usr/bin/openmamba-netsrpms skype
|
||||
fi
|
||||
|
||||
if [ "$INSTALL_JDK" = "1" ]; then
|
||||
|
@ -8,7 +8,7 @@ Comment[es]=Instala el Broadcom B43 firmware por red
|
||||
Comment[fr]=Installation du Broadcom B43 firmware depuis le réseau
|
||||
Comment[it]=Installa il firmware Broadcom B43 dalla rete
|
||||
Encoding=UTF-8
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @distrobindir@/netsrpm-install.sh b43-firmware i586
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @bindir@/openmamba-netsrpms b43-firmware
|
||||
Icon=network-wireless
|
||||
MimeType=
|
||||
Path=
|
||||
|
@ -8,7 +8,7 @@ Comment[es]=Instala el plugin Flash por red
|
||||
Comment[fr]=Installation du plugin Flash depuis le réseau
|
||||
Comment[it]=Installa il plugin Flash dalla rete
|
||||
Encoding=UTF-8
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @distrobindir@/netsrpm-install.sh flashplugin i586
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @bindir@/openmamba-netsrpms flashplugin
|
||||
Icon=distromenu-flash
|
||||
MimeType=
|
||||
Path=
|
||||
|
@ -9,6 +9,6 @@ Comment=Install Java Runtime Environment (JRE) from network
|
||||
Comment[es]=Instala el Java Runtime Environment (JRE) por red
|
||||
Comment[it]=Installa il Java Runtime Environment (JRE) dalla rete
|
||||
Comment[fr]=Installation du Java Runtime Environment (JRE) depuis le réseau
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @distrobindir@/netsrpm-install.sh jre i586
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @bindir@/openmamba-netsrpms jre
|
||||
Icon=distromenu-java
|
||||
Categories=X-@distroID@-NetInstall;
|
||||
|
@ -9,6 +9,6 @@ Comment=Install MS TrueType Core Fonts for the Web
|
||||
Comment[es]=Instala las fuentes MS TrueType para el Web
|
||||
Comment[it]=Installa i font MS TrueType per il Web
|
||||
Comment[fr]=Installation des polices MS TrueType pour le Web
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @distrobindir@/netsrpm-install.sh msttcorefonts noarch
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @bindir@/openmamba-netsrpms msttcorefonts
|
||||
Icon=fonts-package
|
||||
Categories=X-@distroID@-NetInstall;
|
||||
|
@ -8,7 +8,7 @@ Comment[es]=Instala Skype por red
|
||||
Comment[fr]=Installation du Skype depuis le réseau
|
||||
Comment[it]=Installa Skype dalla rete
|
||||
Encoding=UTF-8
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @distrobindir@/netsrpm-install.sh skype i586
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @bindir@/openmamba-netsrpms skype
|
||||
Icon=distromenu-skype
|
||||
MimeType=
|
||||
Path=
|
||||
|
@ -9,6 +9,6 @@ Comment=Install the multimedia win32 codecs
|
||||
Comment[es]=Instala y pon al día los Win32 codecs multimediales
|
||||
Comment[it]=Installa ed aggiorna i codec multimediali Win32
|
||||
Comment[fr]=Installation et mise à jour des codecs multimédias Win32
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @distrobindir@/netsrpm-install.sh win32codecs i586
|
||||
Exec=/opt/kde/bin/konsole-nofork --background-mode -e @bindir@/openmamba-netsrpms win32codecs
|
||||
Icon=applications-multimedia
|
||||
Categories=X-@distroID@-NetInstall;
|
||||
|
@ -1,118 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# netsrpm-install.sh - Build srpms that download sources from network
|
||||
#
|
||||
# Copyright (C) 2003-2008 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
# Copyright (C) 2005 by Massimo Pintore <massimo.pintore@qilinux.it>
|
||||
# Copyright (C) 2005-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
||||
|
||||
me="${0##*/}"
|
||||
|
||||
if [ -z "$1" -o -z "$2" ]; then
|
||||
echo "Usage:"
|
||||
echo "$me <pgkname> <arch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pckname="$1"
|
||||
pckarch="$2"
|
||||
|
||||
function check_if_already_installed() {
|
||||
rpm -q $1 &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
kdialog \
|
||||
--caption "$pckname" \
|
||||
--msgbox "$pckname: "$"already installed."
|
||||
else
|
||||
kdialog \
|
||||
--caption "$pckname" \
|
||||
--sorry $"There was an error installing $pckname!"
|
||||
fi
|
||||
}
|
||||
|
||||
tmpfile=`mktemp -q -t $me.XXXXXXXX` ||
|
||||
{ echo "$me: "$"error: "$"cannot create temporary files." >&2
|
||||
{ (exit 1); exit 1; }; }
|
||||
|
||||
tmpdir=`mktemp -d -q -t $me.XXXXXXXX` ||
|
||||
{ echo "$me: "$"error: "$"cannot create temporary files." >&2
|
||||
{ (exit 1); exit 1; }; }
|
||||
|
||||
DISTRO_SRPMS_DIR=@distrosrpmsdir@
|
||||
|
||||
rpmdir=$(rpm --eval=%{_rpmdir} 2>/dev/null)
|
||||
[ "$rpmdir" ] ||
|
||||
{ echo "$m3: "$"error: "$"cannot set \`rpmdir'."" "$"Aborting..." >&2
|
||||
{ (exit 1); exit 1; }; }
|
||||
|
||||
SYSTEM_RPMS_DIR=$rpmdir/$pckarch
|
||||
|
||||
SRPM_NAME=`\
|
||||
find $DISTRO_SRPMS_DIR \
|
||||
-regex ".*/${pckname//+/\\+}-[^-]*-[^-]*" -printf "%f " 2>/dev/null`
|
||||
|
||||
SRPM_VERSION=`\
|
||||
echo $SRPM_NAME | \
|
||||
sed "s|${pckname//+/\\+}-\([^-]*-[^-]*\).src.rpm|\1|" 2>/dev/null`
|
||||
|
||||
if [ -z "$SRPM_NAME" -o -z "$SRPM_VERSION" ]; then
|
||||
echo "$me: "$"cannot set \`SRPM_PATH' and/or \`SRPM_VERSION'."" "$"Aborting..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRPM_PATH=${DISTRO_SRPMS_DIR}/${SRPM_NAME}
|
||||
RPM_PATH=${SYSTEM_RPMS_DIR}/${pckname}-${SRPM_VERSION}.${pckarch}.rpm
|
||||
|
||||
if [ ! -f $SRPM_PATH ]; then
|
||||
echo "$me: "$"missing SRPM \`$SRPM_PATH'."" "$"Aborting..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get license agreement
|
||||
( rpm2cpio $SRPM_PATH > $tmpfile &&
|
||||
cd $tmpdir &&
|
||||
cpio --quiet --extract --make-directories < $tmpfile ) 2>/dev/null
|
||||
|
||||
if [ -f $tmpdir/LICENSE ]; then
|
||||
kdialog \
|
||||
--caption "LICENSE" \
|
||||
--textbox $tmpdir/LICENSE 600 400
|
||||
[ $? -ne 0 ] && exit 1
|
||||
fi
|
||||
|
||||
kdialog \
|
||||
--title "$pckname" \
|
||||
--passivepopup \
|
||||
$"$1 installation in progress..."
|
||||
|
||||
# build rpm
|
||||
echo "$me: "$"rebuilding package \`$SRPM_PATH'..."
|
||||
rpmbuild --rebuild $SRPM_PATH
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "$me: "$"error rebuilding \`$SRPM_PATH'."" "$"Aborting..." >&2
|
||||
check_if_already_installed $1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# install rpm
|
||||
sudo rpm -hUv --force $RPM_PATH
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "$me: "$"error installing \`$SRPM_PATH'."" "$"Aborting..." >&2
|
||||
check_if_already_installed $1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# erase rpm
|
||||
rm -f $RPM_PATH
|
||||
|
||||
rpm -q $1 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
kdialog \
|
||||
--title "$pckname" \
|
||||
--passivepopup \
|
||||
$"Installation of $1 successfully completed."
|
||||
else
|
||||
kdialog \
|
||||
--caption "$pckname" \
|
||||
--sorry $"There was an error installing $1!"
|
||||
fi
|
154
openmamba-update/openmamba-netsrpms
Executable file
154
openmamba-update/openmamba-netsrpms
Executable file
@ -0,0 +1,154 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# netsrpm-install.sh - Build srpms that download sources from network
|
||||
#
|
||||
# Copyright (C) 2003-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
# Copyright (C) 2005 by Massimo Pintore <massimo.pintore@qilinux.it>
|
||||
# Copyright (C) 2005-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
||||
|
||||
me="${0##*/}"
|
||||
DISTRO_SRPMS_DIR=/usr/share/openmamba/SRPMS
|
||||
rpmdir=$(rpm --eval=%{_rpmdir} 2>/dev/null)
|
||||
|
||||
while [ "$1" ]; do
|
||||
case $1 in
|
||||
-c) CHECK_MODE=1 ;;
|
||||
-u) UPGRADE_MODE=1 ;;
|
||||
*) PACKAGES="$PACKAGES $1"
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "$PACKAGES" ]; then
|
||||
echo "Usage:
|
||||
$me [-c] pkgname ...
|
||||
|
||||
-c: only check and exit (returns: 0: up-to-date; 1: needs update; 2: not installed)
|
||||
-u: only upgrade if already installed
|
||||
"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
function check_if_already_installed() {
|
||||
rpm -q $1 &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
kdialog \
|
||||
--caption "$pckname" \
|
||||
--msgbox "$pckname: "$"already installed."
|
||||
else
|
||||
kdialog \
|
||||
--caption "$pckname" \
|
||||
--sorry $"There was an error installing"" $pckname!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
for pckname in $PACKAGES; do
|
||||
|
||||
SRPM_NAME=`\
|
||||
find $DISTRO_SRPMS_DIR \
|
||||
-regex ".*/${pckname//+/\\+}-[^-]*-[^-]*" -printf "%f " 2>/dev/null`
|
||||
|
||||
[ "$SRPM_NAME" ] || {
|
||||
echo "$me: $pckname is missing in $DISTRO_SRPMS_DIR; aborting."
|
||||
exit 255
|
||||
}
|
||||
|
||||
SRPM_VERSION=`\
|
||||
echo $SRPM_NAME | \
|
||||
sed "s|${pckname//+/\\+}-\([^-]*-[^-]*\).src.rpm|\1|" 2>/dev/null`
|
||||
|
||||
RPM_INSTALLED=`rpm -q $pckname`
|
||||
[ $? -eq 0 ] || RPM_INSTALLED=
|
||||
|
||||
RPM_INSTALLED_VERSION=`\
|
||||
echo $RPM_INSTALLED | \
|
||||
sed "s|${pckname//+/\\+}-\([^-]*-[^-]*\)\..*|\1|" 2>/dev/null`
|
||||
|
||||
echo "Package name: $pckname"
|
||||
echo "Installed version: $RPM_INSTALLED_VERSION"
|
||||
echo "Last version: $SRPM_VERSION"
|
||||
echo
|
||||
|
||||
[ "$RPM_INSTALLED_VERSION" != "$SRPM_VERSION" ] && {
|
||||
if [ "$RPM_INSTALLED_VERSION" ]; then
|
||||
UPDATE_NEEDED=1
|
||||
elif [ "$UPGRADE_MODE" ]; then
|
||||
continue
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! "$CHECK_MODE" ]; then
|
||||
SRPM_PATH=${DISTRO_SRPMS_DIR}/${SRPM_NAME}
|
||||
|
||||
if [ ! -f $SRPM_PATH ]; then
|
||||
echo "$me: "$"missing SRPM \`$SRPM_PATH'."" "$"Aborting..." >&2
|
||||
exit 255
|
||||
fi
|
||||
|
||||
tmpfile=`mktemp -q -t $me.XXXXXXXX` || {
|
||||
echo "$me: error: cannot create temporary files; aborting."
|
||||
exit 255
|
||||
}
|
||||
|
||||
tmpdir=`mktemp -d -q -t $me.XXXXXXXX` || {
|
||||
echo "$me: error: cannot create temporary directory; aborting."
|
||||
exit 255
|
||||
}
|
||||
|
||||
# get license agreement
|
||||
( rpm2cpio $SRPM_PATH > $tmpfile &&
|
||||
cd $tmpdir &&
|
||||
cpio --quiet --extract --make-directories < $tmpfile ) 2>/dev/null
|
||||
|
||||
if [ -f $tmpdir/LICENSE ]; then
|
||||
kdialog \
|
||||
--caption "LICENSE" \
|
||||
--textbox $tmpdir/LICENSE 600 400
|
||||
[ $? -ne 0 ] && exit 1
|
||||
fi
|
||||
|
||||
kdialog \
|
||||
--title "$pckname" \
|
||||
--passivepopup \
|
||||
$"$pckname installation in progress..."
|
||||
|
||||
# build rpm
|
||||
echo "$me: "$"rebuilding package \`$SRPM_PATH'..."
|
||||
rpmbuild --rebuild $SRPM_PATH --define="%_rpmdir $tmpdir"
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "$me: "$"error rebuilding \`$SRPM_PATH'."" "$"Aborting..." >&2
|
||||
check_if_already_installed $pckname
|
||||
exit 255
|
||||
fi
|
||||
RPM_PATH=`find $tmpdir -name \*.rpm`
|
||||
|
||||
# install rpm
|
||||
sudo rpm -hUv --force $RPM_PATH
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "$me: "$"error installing \`$SRPM_PATH'."" "$"Aborting..." >&2
|
||||
check_if_already_installed $pckname
|
||||
exit 255
|
||||
fi
|
||||
|
||||
rpm -q $pckname 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
kdialog \
|
||||
--title "$pckname" \
|
||||
--passivepopup \
|
||||
$"Installation of $pckname successfully completed."
|
||||
else
|
||||
kdialog \
|
||||
--caption "$pckname" \
|
||||
--sorry $"There was an error installing $pckname!"
|
||||
fi
|
||||
rm -rf $tmpdir $tmpfile
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$UPDATE_NEEDED" ] && {
|
||||
echo "Update needed."
|
||||
exit 1
|
||||
}
|
||||
exit 0
|
147
openmamba-update/openmamba-update
Executable file
147
openmamba-update/openmamba-update
Executable file
@ -0,0 +1,147 @@
|
||||
# openmamba update script
|
||||
# Copyright (c) 2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
#
|
||||
# Released under the terms of the GNU GPLv3 License
|
||||
|
||||
VERSION=0.2
|
||||
TEXTDOMAIN=openmamba-update
|
||||
TEXTDOMAINDIR=/usr/share/locale/
|
||||
INSTALL_DATE=`date +%Y%m%d-%H%M`
|
||||
LOG_FILE=/var/log/openmamba-update-$INSTALL_DATE.log
|
||||
KERNEL_RELEASE=`uname -r`
|
||||
PROGRESS_POS=0
|
||||
PKGGROUPS_DB=/usr/share/openmamba/pkggroups.db
|
||||
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/mamba-tempfile
|
||||
|
||||
. $PKGGROUPS_DB
|
||||
|
||||
function pkg_parser() {
|
||||
while read line; do
|
||||
echo $line
|
||||
done
|
||||
}
|
||||
|
||||
function pkg_tool() {
|
||||
sudo smart $@ | pkg_parser
|
||||
}
|
||||
|
||||
echo $"\
|
||||
openmamba update script - version $VERSION
|
||||
Copyright (c) 2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
"
|
||||
|
||||
script_ver=1.0
|
||||
script_name="$(basename $0 2>/dev/null)"
|
||||
|
||||
function usage() {
|
||||
|
||||
echo "Usage: $script_name [OPTION][groupname ..]
|
||||
|
||||
Options:
|
||||
-f, --full
|
||||
Perform a full update
|
||||
-h, --help
|
||||
Display this message.
|
||||
-l, --list
|
||||
List available groups and exit
|
||||
-v, --verbose
|
||||
Produce mode verbose output
|
||||
-y, --assume-yes
|
||||
Assume yes to all answers"
|
||||
}
|
||||
|
||||
OPTS=`LANG=C getopt -o hlvyf \
|
||||
--long help,list,verbose,assume-yes,full \
|
||||
-n "$script_name" -- "$@"`
|
||||
[ $? = 0 ] || exit 1
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while :; do
|
||||
case "$1" in
|
||||
-f|--full) full_update_mode=1 ;;
|
||||
-h|--help)
|
||||
usage; exit 0 ;;
|
||||
-l) list_mode=1 ;;
|
||||
-v) verbose_mode=1 ;;
|
||||
-y) assume_yes=1 ;;
|
||||
--) shift; break ;;
|
||||
*) echo "\
|
||||
(bug) -- $script_name: \`getopt' error: bad command \`$1'" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
while [ "$1" ]; do
|
||||
installnames="$installnames $1"
|
||||
shift
|
||||
done
|
||||
|
||||
[ "$list_mode" ] && echo "Available installation groups (*=installed,+=needs update):"
|
||||
for i in `seq 1 ${#PKG_GROUPS[*]}`; do
|
||||
eval instpkgs=(\$`echo ${PKG_GROUPS[$i-1]}`)
|
||||
totpkgs=`expr $totpkgs + ${#instpkgs[*]}`
|
||||
checkinstalled=(`rpm -q --whatprovides ${instpkgs[*]} | grep -v 'no package provides'`)
|
||||
if [ ${#checkinstalled[*]} -eq 0 ]; then
|
||||
[ "$list_mode" ] && echo -n " "
|
||||
elif [ ${#checkinstalled[*]} -lt ${#instpkgs[*]} ]; then
|
||||
[ "$list_mode" ] && echo -n "+ "
|
||||
needupdategroups="${needupdategroups} `expr $i-1`"
|
||||
else
|
||||
[ "$list_mode" ] && echo -n "* "
|
||||
fi
|
||||
if [ "$list_mode" ]; then
|
||||
echo -n -e "${PKG_NAMES[$i-1]}"
|
||||
for j in `seq 30 -1 ${#PKG_NAMES[$i-1]}`; do
|
||||
echo -n " "
|
||||
done
|
||||
echo -e "${PKG_DESC[$i-1]} (${#checkinstalled[*]}/${#instpkgs[*]})"
|
||||
if [ "$verbose_mode" ]; then
|
||||
for j in `seq 0 ${#instpkgs[*]}`; do
|
||||
[ `expr $j % 5` -eq 0 ] && echo -n " "
|
||||
echo -n "${instpkgs[$j]} "
|
||||
[ `expr $j % 5` -eq 4 ] && echo
|
||||
done
|
||||
echo; echo
|
||||
fi
|
||||
fi
|
||||
done
|
||||
[ "$list_mode" ] && exit 0
|
||||
|
||||
#[ ! "$full_update_mode" -a ! "$installnames" ] && installnames="base"
|
||||
|
||||
if [ "$installnames" ]; then
|
||||
for i in `seq 0 ${#PKG_GROUPS[*]}`; do
|
||||
for n in $installnames; do
|
||||
[ "${PKG_NAMES[$i]}" = "$n" ] && installgroups="$installgroups $i"
|
||||
done
|
||||
done
|
||||
elif [ "$needupdategroups" ]; then
|
||||
echo -n "The following groups need to be updated: "
|
||||
for n in $needupdategroups; do
|
||||
echo -n "${PKG_NAMES[$n]} "
|
||||
installgroups="$installgroups $n"
|
||||
done
|
||||
echo
|
||||
[ "$assume_yes" ] || {
|
||||
echo -n "Proceed with update [Y/n]?"
|
||||
read ans
|
||||
[ "$ans" = "n" -o "$ans" = "N" ] && exit 0
|
||||
}
|
||||
fi
|
||||
|
||||
for i in $installgroups; do
|
||||
eval instpkgs=\$`echo ${PKG_GROUPS[$i]}`
|
||||
for i in $instpkgs; do
|
||||
rpm -q --whatprovides $i >/dev/null || {
|
||||
finalinstalllist=(${finalinstalllist[*]} $i)
|
||||
}
|
||||
done
|
||||
done
|
||||
|
||||
if [ "${finalinstalllist[*]}" ]; then
|
||||
[ "$verbose_mode" ] && echo $"Installing: ${finalinstalllist[*]}"
|
||||
pkg_tool install -y ${finalinstalllist[*]}
|
||||
exit $?
|
||||
fi
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user