aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-11-13 01:06:04 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-11-13 01:06:04 +0000
commite84a823cf917ac13db1bbd8e52072196b894e2a8 (patch)
treed15cfc7dc55b7e0b72a37fd13e054e61b8e183a7
parent8164018d0940b8cc542cb5995a1e7c85187bbdb7 (diff)
downloadsimplepkg-e84a823cf917ac13db1bbd8e52072196b894e2a8.tar.gz
simplepkg-e84a823cf917ac13db1bbd8e52072196b894e2a8.tar.bz2
changing jail-upgrade behavior
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@26 04377dda-e619-0410-9926-eae83683ac58
-rw-r--r--conf/simplepkg.conf.new8
-rw-r--r--lib/common.sh13
-rwxr-xr-xsrc/jail-upgrade19
3 files changed, 35 insertions, 5 deletions
diff --git a/conf/simplepkg.conf.new b/conf/simplepkg.conf.new
index 2b9e165..50db875 100644
--- a/conf/simplepkg.conf.new
+++ b/conf/simplepkg.conf.new
@@ -12,3 +12,11 @@ DEFAULT_VERSION="10.2"
STORAGE="/var/simplaret/packages"
PASSIVE_FTP="1"
+# Enabling this option, jail-upgrade will look at your
+# standard repositories for new packages; if it find a package
+# with different version of your current installed package and
+# also this package isnt in the packages folder, then the new
+# package is apllied; if in doubt, just say no or leave blank.
+# Otherwise set it either to "yes" or "1"
+CONSIDER_ALL_PACKAGES_AS_PATCHES="0"
+
diff --git a/lib/common.sh b/lib/common.sh
index 5c9a4fa..6f66050 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -206,8 +206,19 @@ function eval_config {
echo "$SIMPLARET not found, please install it before run $0"
fi
- if [ -z "PATCHES_DIR" ]; then
+ if [ -z "$PATCHES_DIR" ]; then
echo error: please adjust a value for PATCHES_DIR at $CONF
fi
+
+ CONSIDER_ALL_PACKAGES_AS_PATCHES="`echo $CONSIDER_ALL_PACKAGES_AS_PATCHES | tr '[:lower:]' '[:upper:]'`"
+ if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" != "YES" ] && \
+ [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" != "1" ]; then
+ # Enabling this option, jail-upgrade will look at your
+ # standard repositories for new packages; if it find a package
+ # with different version of your current installed package and
+ # also this package isnt in the packages folder, then the new
+ # package is apllied; if in doubt, just say no or leave blank.
+ CONSIDER_ALL_PACKAGES_AS_PATCHES="0"
+ fi
}
diff --git a/src/jail-upgrade b/src/jail-upgrade
index df6e013..c879bfa 100755
--- a/src/jail-upgrade
+++ b/src/jail-upgrade
@@ -23,19 +23,19 @@ function swaret_jail_upgrade {
echo upgrading jail $1...
if [ ! -d "$PATCHES_DIR" ]; then
- # cd $PATCHES_DIR
- # for file in `ls *tgz`; do
for file in `find $PATCHES_DIR -name *tgz`; do
pack=`package_name $file`
for installed in `ls $1/var/log/packages/$pack* 2> /dev/null`; do
if [[ $pack == `package_name $installed.tgz` ]]; then
if [[ "`basename $installed`" != "`basename $file .tgz`" ]]; then
ROOT=$1 upgradepkg $file
+ UPGRADED="$UPGRADED $pack"
fi
fi
done
done
fi
+
}
function simplaret_jail_upgrade {
@@ -50,14 +50,13 @@ function simplaret_jail_upgrade {
fi
if [ -d "$PATCHES_DIR/$ARCH/$VERSION" ]; then
- # cd $PATCHES_DIR/$ARCH/$VERSION
- # for file in `ls *tgz`; do
for file in `find $PATCHES_DIR/$ARCH/$VERSION -name *tgz`; do
pack=`package_name $file`
for installed in `ls $1/var/log/packages/$pack* 2> /dev/null`; do
if [[ "$pack" == "`package_name $installed.tgz`" ]]; then
if [[ "`basename $installed`" != "`basename $file .tgz`" ]]; then
ROOT=$1 upgradepkg $file
+ UPGRADED="$UPGRADED $pack"
fi
fi
done
@@ -66,6 +65,16 @@ function simplaret_jail_upgrade {
echo error: cant upgrade for arch $ARCH and version $VERSION on $1: no such patch dir $PATCHES_DIR/$ARCH/$VERSION
fi
+ if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "YES" ] ||
+ [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "1" ]; then
+ # TODO: search all packages in the repositories
+ # apply a patch if:
+ # - it hasnt already applied
+ # - has a different version from the current installed
+ # - has a different build number from the current installed
+ true
+ fi
+
}
if [ -f "$COMMON" ]; then
@@ -93,6 +102,8 @@ else
exit 1
fi
+UPGRADED=""
+
if [ -z "$1" ]; then
if [ -d "/var/log/packages" ]; then
$upgrade_method /