}
upgrade () {
- local i to_install packages
+ local packages
case "$1" in
first)
packages="$packages_first"
return 1
esac
- for i in $(echo $packages)
- do
- pkg $i && to_install="$to_install $i"
- done
-
- if [ -n "$to_install" ];then
- eval pkgadd $to_install
- else
- return 0
- fi
+ pkgadd_if_installed $packages
}
# funkcija utrpa ispravan sources.list
# make a silent installation of carnet and srce keyrings
install_keyrings () {
pkgadd carnet-keyring srce-keyring debian-archive-keyring
- pkgadd dpkg apt debconf python-apt
+ pkgadd_if_installed dpkg apt debconf python-apt dpkg-dev
dpkg-reconfigure carnet-keyring srce-keyring debian-archive-keyring
apt_update
fi
}
+# check which of the given packages are installed
+grep_installed () {
+ local package installed
+
+ for package in $*; do
+ if pkg $package; then
+ installed="$installed $package"
+ fi
+ done
+
+ echo $installed
+}
+
+# only upgrade packages if they are already installed
+pkgadd_if_installed () {
+ local packages
+
+ packages=$( grep_installed $* )
+
+ if [ "$packages" ]; then
+ eval pkgadd $packages
+ fi
+}
+
# make a silent upgrade to new libc6
upgrade_libc () {
- DEBIAN_FRONTEND=noninteractive pkgadd libc6 tzdata
+ DEBIAN_FRONTEND=noninteractive pkgadd_if_installed libc6 libc6-dev tzdata
}
# upgrade apache2/php5 to lenny
upgrade_apache2 () {
- local package packages
-
- for package in \
- libapache2-mod-php5 \
- php5-cli \
- php5-cn \
- apache2-cn \
- php5-odbc \
- php5-suhosin \
- php-suhosin-cn
- do
- if pkg $package; then
- packages="$packages $package"
- fi
- done
-
- eval pkgadd $packages
+ pkgadd_if_installed libapache2-mod-php5 php5-cli php5-cn apache2-cn \
+ php5-odbc php5-suhosin php-suhosin-cn
}
upgrade_amavis () {