]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
mkjail: now install_packages uses simplaret --install
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Tue, 23 Jan 2007 18:28:57 +0000 (18:28 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Tue, 23 Jan 2007 18:28:57 +0000 (18:28 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@116 04377dda-e619-0410-9926-eae83683ac58

conf/simplepkg.conf.new
doc/CHANGELOG
lib/common.sh
src/simplaret

index 028e4d3f52c5cacc550847b6cc8e6cf956ad5804..e1b989d3673353649ac34edb93a72a3953e1845b 100644 (file)
 # where jails are placed
 JAIL_ROOT="/vservers"
 
-# package grabber program (can be swaret if you have it installed)
-# just change to swaret if you know what you're doing
-SIMPLARET="simplaret"
-
 # whether mkjail should clean the package cache before installation
 # to enable it, set to "1" or "yes"
 SIMPLARET_CLEAN="1"
index 97648cc3acea330d0becfa4a0c44c4d24419df7e..62355f0924b619567c105b451c5a4309457ecb1e 100644 (file)
@@ -5,7 +5,9 @@ simplepkg changelog
              - speedup
              - ncftpget support
              - timeout support
+             - sets the correct architecture
             deleted jail-upgrade
+            removed swaret support
 
 0.4.9pre8: createpkg: bugfix
            common.sh:
index aea8ba2fc74cd94a52f818eef1a6877e14d7db5c..4c337e2182648f9e2b99071a5b14de6571d7d267 100644 (file)
@@ -30,6 +30,7 @@
 BASE_CONF="/etc/simplepkg"
 CONF="$BASE_CONF/simplepkg.conf"
 JAIL_LIST="$BASE_CONF/jailist"
+SIMPLARET="simplaret"
 
 # pkgtool stuff
 function package_name {
@@ -92,108 +93,47 @@ function package_build {
 
 function install_packages {
 
+  local check installed unable_to_install
+
   # check if is time to clean the local repository
-  if [[ "$SIMPLARET_CLEAN"  == "1" ]]; then
+  if [ "$SIMPLARET_CLEAN"  == "1" ]; then
     ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge
-  elif [[ ! -z "$SIMPLARET_PURGE_WEEKS" ]] && [[ "$SIMPLARET_PURGE_WEEKS" != "0" ]]; then
+  elif [ ! -z "$SIMPLARET_PURGE_WEEKS" ] && [ "$SIMPLARET_PURGE_WEEKS" != "0" ]; then
     ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge -w $SIMPLARET_PURGE_WEEKS
   fi
 
   # now tries to install each package listed in the template
   for pack in `cat $TEMPLATE | grep -v -e "^#" | cut -d : -f 1`; do
 
-    package_downloaded="0"
+    # try to install the package
+    ROOT=/$JAIL_ROOT ARCH=$ARCH VERSION=$VERSION $SIMPLARET --install $pack $extraoptions
 
-    if [ "$SIMPLARET" == "simplaret" ]; then
-      extrafolder="$ARCH/$VERSION/"
-      extraoptions=""
-    else
-      unset extrafolder
-      extraoptions="-a"
-    fi
+    # check if the package was installed
+    installed=`eval "ls /$JAIL_ROOT/var/log/packages/ | egrep '^$pack-[^-]+-[^-]+-[^-]+$'"`
+    check=$?
 
-    # first search the package in the patches folder
-    for file in `find $PATCHES_DIR/$extrafolder -name $pack*tgz`; do
-      if [[ "`package_name $file`" == "$pack" ]]; then
-        package_downloaded="1"
-        package_file="$file"
-        break
+    if [ ! -z "$installed" ] && [ "$check" == "0" ]; then
+      # the package is installed
+      if [ ! -z "$SIMPLARET_DELETE_DURING" ] && [ "$SIMPLARET_DELETE_DURING" != "0" ]; then
+        SILENT=1 ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge
       fi
-    done
-
-    # then search the package in the standard packages folder
-    if [[ "$package_downloaded" != "1" ]]; then
-      for file in `find $STORAGE/$extrafolder -name $pack*tgz`; do
-        if [[ "`package_name $file`" == "$pack" ]]; then
-          package_downloaded="1"
-          package_file="$file"
-          break
-        fi
-      done
-    fi
-
-    # if the package wasnt found, try to donwload it
-    if [[ "$package_downloaded" != "1" ]]; then
-      ARCH=$ARCH VERSION=$VERSION $SIMPLARET --get $pack $extraoptions
-
-      # it can be stored at the patches folder
-      for file in `find $PATCHES_DIR/$extrafolder -name $pack*tgz`; do
-        if [[ "`package_name $file`" == "$pack" ]]; then
-          package_file="$file"
-          break
-        fi
-      done
-
-      # or it can be stored at the standard packages folder
-      if [ -z "$package_file" ]; then
-        for file in `find $STORAGE/$extrafolder -name $pack*tgz`; do
-          if [[ "`package_name $file`" == "$pack" ]]; then
-            package_file="$file"
-            break
-          fi
-        done
-      fi
-
-    fi
-
-    # now tries to install the package, if available
-    if [ -z "$package_file" ]; then
-      echo error: could not install package $pack
     else
-      installed_packs="`ls /$JAIL_ROOT/$server/var/log/packages/$pack* 2> /dev/null`"
-      if [ ! -z "$installed_packs" ]; then
-        for installed in $installed_packs; do
-          if [[ "$pack" == "`package_name $installed.tgz`" ]]; then
-            echo "package $pack already installed in $JAIL_ROOT/$server ($installed)"
-            package_installed="1"
-            break
-          fi
-          if [[ "$package_installed" != "1" ]]; then
-            installpkg -root /$JAIL_ROOT/$server $package_file
-            unset package_installed
-            if [ ! -z "$SIMPLARET_DELETE_DURING" ] && [ "$SIMPLARET_DELETE_DURING" != "0" ]; then
-              SILENT=1 ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge
-            fi
-            break
-          fi
-        done
-      else
-        installpkg -root /$JAIL_ROOT/$server $package_file
-        if [ ! -z "$SIMPLARET_DELETE_DURING" ] && [ "$SIMPLARET_DELETE_DURING" != "0" ]; then
-          SILENT=1 ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge
-        fi
-      fi
+      echo error: could not install package $pack
+      unable_to_install="$unable_to_install\n\t$pack"
     fi
 
-    unset package_file
-
   done
 
   # purge packages, if needed
-  if [[ "$SIMPLARET_DELETE_DOWN" == "1" ]]; then
+  if [ "$SIMPLARET_DELETE_DOWN" == "1" ]; then
     ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge
   fi
 
+  if [ ! -z "$unable_to_install" ]; then
+    echo "mkjail was unable to install the following packages on $JAIL_ROOT:"
+    echo -e "$unable_to_install"
+  fi
+
 }
 
 function remove_packages {
@@ -246,7 +186,6 @@ function eval_config {
 
   if [ -f "$CONF" ]; then
 
-    SIMPLARET="`eval_parameter SIMPLARET simplaret`"
     STORAGE="`eval_parameter STORAGE /var/simplaret/packages`"
     JAIL_ROOT="`eval_parameter JAIL_ROOT /vservers`"
     PATCHES_DIR="`eval_parameter PATCHES_DIR /var/simplaret/patches`"
index 7b68b60eb2f82ae81dd3313f74002f7e60701f25..7d9ebff925faa1c30f62cf07b8bb2cb6ea8987e0 100755 (executable)
@@ -377,8 +377,8 @@ function simplaret_purge {
   done
 
   if [ -z "$SILENT" ]; then
-    echo done purging simplaret cache
-    echo please run simplaret --update to retrieve new package listings on this arch and version
+    echo $BASENAME: done purging simplaret cache
+    echo $BASENAME: please run $BASENAME --update to retrieve new package listings on this arch and version
   fi
 
 }