]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
simplaret: remove jail-upgrade
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Tue, 23 Jan 2007 14:00:05 +0000 (14:00 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Tue, 23 Jan 2007 14:00:05 +0000 (14:00 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@114 04377dda-e619-0410-9926-eae83683ac58

doc/CHANGELOG
simplepkg.SlackBuild
src/jail-upgrade [deleted file]
src/simplaret

index 0ebd749523a18ae58431f8197f2df46f75212064..97648cc3acea330d0becfa4a0c44c4d24419df7e 100644 (file)
@@ -1,6 +1,12 @@
 simplepkg changelog
 -------------------
 
+0.4.9pre9: createpkg:
+             - speedup
+             - ncftpget support
+             - timeout support
+            deleted jail-upgrade
+
 0.4.9pre8: createpkg: bugfix
            common.sh:
              - enhanced config file evaluation
index 5ab80af163c8338f057425baf1b703ac2e328588..c25ffc9c5cd11ab6fd145c9920c46019c6d1cc40 100755 (executable)
@@ -24,8 +24,10 @@ cp install/doinst.sh $PACK_DIR/install
 
 mkdir -p $PACK_DIR/$SBINDIR
 for binary in $SBINARY_LIST; do
-  cp src/$binary $PACK_DIR/$SBINDIR
-  chmod +x $PACK_DIR/$SBINDIR/$binary
+  if [ -f "src/$binary" ]; then
+    cp src/$binary $PACK_DIR/$SBINDIR
+    chmod +x $PACK_DIR/$SBINDIR/$binary
+  fi
 done
 
 mkdir -p $PACK_DIR/$BINDIR
@@ -53,8 +55,11 @@ chmod +x $PACK_DIR/etc/$PACKAGE/vserver-legacy.s/*.sh
 cp conf/simplepkg.conf.new $PACK_DIR/etc/$PACKAGE
 cp conf/repos.conf.new $PACK_DIR/etc/$PACKAGE
 cp conf/createpkg.conf.new $PACK_DIR/etc/$PACKAGE
-cd $PACK_DIR/usr/sbin && ln -s jail-upgrade vserver-upgrade
-cd -
+
+if [ -f "$PACK_DIR/usr/sbin/jail-upgrade" ]; then
+  cd $PACK_DIR/usr/sbin && ln -s jail-upgrade vserver-upgrade
+  cd -
+fi
 
 cd $PACK_DIR
 chown -R root.root *
diff --git a/src/jail-upgrade b/src/jail-upgrade
deleted file mode 100755 (executable)
index 0c3d236..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/bin/bash
-#
-# jail-upgrade v0.5: upgrade packages in jails
-# feedback: rhatto@riseup.net | GPL
-#
-#  Jail-upgrade is free software; you can redistribute it and/or modify it under the
-#  terms of the GNU General Public License as published by the Free Software
-#  Foundation; either version 2 of the License, or any later version.
-#
-#  Jail-upgrade is distributed in the hope that it will be useful, but WITHOUT ANY
-#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-#  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License along with
-#  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-#  Place - Suite 330, Boston, MA 02111-1307, USA
-#
-
-COMMON="/usr/libexec/simplepkg/common.sh"
-
-function jail_upgrade {
-
-  local patches_dir storage_dir
-
-  echo upgrading jail $1...
-
-  if [ "$SIMPLARET" == "simplaret" ]; then
-
-    VERSION="`default_version`"
-    ARCH="`default_arch`"
-
-    if [ -z "$ARCH" ]; then
-      ARCH="i386"
-    fi
-
-    patches_dir="$PATCHES_DIR/$ARCH/$VERSION"
-    storage_dir="$STORAGE/$ARCH/$VERSION"
-
-  elif [ "$SIMPLARET" == "swaret" ]; then
-
-    patches_dir="$PACTHES_DIR"
-    storage_dir="$STORAGE"
-
-  fi
-
-  if [ -d "$patches_dir" ]; then
-    for file in `find $patches_dir -name *tgz`; do
-      pack=`package_name $file`
-      if check_for_upgrade $file $1; then
-        ROOT=$1 upgradepkg $file
-             upgraded $pack
-      fi
-    done
-  else
-    if [ "$SIMPLARET" == "simplaret" ]; then
-      echo error: cant upgrade for arch $ARCH and version $VERSION on $1: no such patch dir $patches_dir
-    elif [ "$SIMPLARET" == "swaret" ]; then
-      echo error: cant upgrade on $1: no such patch dir $patches_dir
-    fi
-  fi
-
-  # optionally, search all packages in the repositories and apply a patch if:
-  #   - the package is installed in the jail
-  #   - it hasn't already applied in the jail
-  #   - has different version or build from the current installed package
-  if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "YES" ] ||
-     [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "1" ]; then
-     if [ -d "$storage_dir" ]; then
-       for file in `find $storage_dir -name *tgz`; do
-          pack=`package_name $file`
-          if check_for_upgrade $file $1; then
-            # the package is installed
-            if ! echo $UPGRADED | grep -q $pack; then
-              # it hasnt already applied
-              ROOT=$1 upgradepkg $file
-              upgraded $pack
-            fi
-          fi
-       done
-     fi
-  fi
-
-  # clear the upgraded package list
-  unset UPGRADED
-
-}
-
-function check_for_upgrade {
-
-  # check if package $1 is installed in the $2 root environment
-  # and should be upgraded
-  local pack found file
-
-  found="0"
-  file="$1"
-  pack="`package_name $file`"
-
-  if [ -d "$2/var/log/packages/" ] && [ ! -z "$file" ]; then
-    for installed in `ls $2/var/log/packages/$pack* 2> /dev/null`; do
-      if [[ "$pack" == "`package_name $installed.tgz`" ]]; then
-        if [[ "`basename $installed`" != "`basename $file .tgz`" ]]; then
-          found="1"
-        fi
-      fi
-    done
-  fi
-
-  # if the package is installed, return true, otherwise false
-  if [ "$found" == "0" ]; then
-    return 1
-  elif [ "$found" == "1" ]; then
-    return 0
-  fi
-
-}
-
-function upgraded {
-
-  UPGRADED="$UPGRADED $1 "
-
-}
-
-if [ -f "$COMMON" ]; then
-  source $COMMON
-  eval_config `basename $0`
-else
-  echo "error: file $COMMON not found, check your `basename $0` installation"
-  exit 1
-fi
-
-if [ ! -z "$PATCHES" ]; then
-  if [ -d "$PATCHES" ]; then
-    PATCHES_DIR="$PATCHES" 
-  else
-    echo "error: folder $PATCHES does not exist"
-  fi
-fi
-
-if [ "$SIMPLARET" != "simplaret" ] || [ "$SIMPLARET" == "swaret" ]; then
-  echo invalid value $SIMPLARET for SIMPLARET, please check your $CONF
-  exit 1
-fi
-
-UPGRADED=""
-
-if [ -z "$1" ]; then
-  if [ -d "/var/log/packages" ]; then
-    jail_upgrade /
-  fi
-  for vserver in `ls $JAIL_ROOT`; do
-    if [ -d "$JAIL_ROOT/$vserver/var/log/packages" ]; then
-      jail_upgrade $JAIL_ROOT/$vserver
-    fi
-  done
-elif [ -d "$JAIL_ROOT/$1" ]; then
-  if [ -d "$JAIL_ROOT/$1/var/log/packages" ]; then
-    jail_upgrade $JAIL_ROOT/$1
-  else
-    echo error: jail $JAIL_ROOT/$1 dont looks like a slackware system
-  fi
- elif [ -f "$1" ]; then
-  basename="`basename $1 tgz`"
-  if [ "`basename $1 | sed -e "s/^$basename//"`" == "tgz" ]; then
-    arch="`package_arch $1`"
-    # TODO
-    # - atualizar nas jaulas de mesma arquitetura
-    true
-  fi
-else
-  echo "error: jail $0 does not exist"
-  exit 1
-fi
-
index b77322ec318f5a4f32c5c2fa534ad9be9db09e5d..adef9b8ee764dcc1f21966881f39a51870ff1b40 100755 (executable)
@@ -554,7 +554,11 @@ function simplaret_search_and_download_patch {
 
     # finally, get the package
     if [ "$get" == "yes" ]; then
-      simplaret_get $sugested
+      if [ "$S_UPGRADE" == "1" ]; then
+        simplaret_install $sugested
+      else
+        simplaret_get $sugested
+      fi
       if [ "$?" == "0" ]; then
         DOWNLOADED_PATCHES="$DOWNLOADED_PATCHES $ARCH:$VERSION:$sugested " # the ending space is important
       fi
@@ -600,7 +604,6 @@ function simplaret_get_jail_patches {
   echo fetching patches for arch $ARCH and version $VERSION for jail $root
 
   # list all available patches from PATCHES and ROOT repositories
-  # old behaviour: for sugested in `simplaret_search --formatted | grep patches`; do
   for sugested in `simplaret_search --formatted | grep patches | grep -v ",repos," | grep -v ",noarch,"`; do
     simplaret_search_and_download_patch
   done
@@ -608,9 +611,6 @@ function simplaret_get_jail_patches {
   # grab patches from every other places
   if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "1" ]; then
 
-    # old behaviour was just one loop:
-    # for sugested in `simplaret_search --formatted | grep -v patches`; do
-
     for sugested in `simplaret_search --formatted | grep patches | grep ",repos," | grep ",noarch,"`; do
       simplaret_search_and_download_patch
     done
@@ -631,6 +631,10 @@ function simplaret_get_patches {
 
   local jailpath
 
+  if [ "$1" == "--upgrade" ]; then
+    IS_UPGRADE="1"
+  fi
+
   # first get patches from the root system
   simplaret_get_jail_patches
 
@@ -691,10 +695,11 @@ function simplaret_install {
       ROOT=$root upgradepkg --install-new $package
     else
       echo "error: could not install package $package: file not found"
+      return 1
     fi
   else
     echo "error: could not install package $package"
-    exit 1
+    return 1
   fi
 
 }
@@ -743,7 +748,7 @@ case $1 in
   "--get-patches" | "get-patches") simplaret_get_patches ;;
   "--purge" | "purge") shift ; simplaret_purge $* ;;
   "--install" | "install") simplaret_install $2 ;;
-  "--upgrade" | "upgrade") simplaret_get_patches ; jail-upgrade ;;
+  "--upgrade" | "upgrade") simplaret_get_patches --upgrade ;;
   "--remove" | "remove") removepkg $2 ;;
   *) simplaret_usage ;;
 esac