]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
changing jail-upgrade behavior
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Mon, 13 Nov 2006 01:06:04 +0000 (01:06 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Mon, 13 Nov 2006 01:06:04 +0000 (01:06 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@26 04377dda-e619-0410-9926-eae83683ac58

conf/simplepkg.conf.new
lib/common.sh
src/jail-upgrade

index 2b9e1652850149e7365b24b57370dd94dbb45bad..50db875507df35dd1dd503733750a039209220cd 100644 (file)
@@ -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"
+
index 5c9a4fac4ab9a73de105cad5b7a6ee20ec876e91..6f6605079765361fe4f1d3afc36eddb6c47ae958 100644 (file)
@@ -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
 }
 
index df6e01329b02c31109c750594f8396daa00a3235..c879bfabf1dccf8f5e96091fb49aed871c1e36bd 100755 (executable)
@@ -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 /