]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
simplaret: get-patches update
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 1 Feb 2007 00:59:09 +0000 (00:59 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 1 Feb 2007 00:59:09 +0000 (00:59 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@147 04377dda-e619-0410-9926-eae83683ac58

src/simplaret

index c39bcd7a6b820c79fdb5b8c10d6c798daa32949a..3876c37b7c7e7aec47414c76709834f7969ef471 100755 (executable)
@@ -96,6 +96,7 @@ function simplaret_download {
   fi
 
   if [ "$protocol" == "http" ]; then
+
     echo Getting $1/$file:
     if [ "$HTTP_TOOL" == "wget" ]; then
       wget $wget_timeout $wget_verbose $1/$2 -O $3/$file
@@ -106,13 +107,16 @@ function simplaret_download {
       echo $BASENAME: please check your config file $CONF
       exit 1
     fi
+
   elif [ "$protocol" == "ftp" ]; then
     echo Getting $1/$file:
+
     if [ "$PASSIVE_FTP" == "1" ]; then
       wget_passive_ftp="--passive-ftp"
       ncftpget_passive_ftp="-F"
       curl_passive_ftp="--ftp-pasv"
     fi 
+
     if [ "$FTP_TOOL" == "ncftpget" ]; then
       ncftpget -c $ncftpget_timeout $ncftpget_passive_ftp $1/$2 > $3/$file
     elif [ "$FTP_TOOL" == "wget" ]; then
@@ -124,7 +128,9 @@ function simplaret_download {
       echo $BASENAME: please check your config file $CONF
       exit 1
     fi
+
   elif [ "$protocol" == "file" ]; then
+
     url="`echo $1 | sed -e 's/file:\/\///'`"
     if [ -f "$3/$file" ]; then
       rm -f $3/$file
@@ -138,6 +144,11 @@ function simplaret_download {
     else
       echo " failed."
     fi
+
+  else
+
+    echo $BASENAME error: invalid protocol $protocol
+
   fi
 
   if [ "$4" == "--no-verbose" ]; then
@@ -522,7 +533,7 @@ function simplaret_get {
 function simplaret_search_and_download_patch {
 
   local package_version package_build installed_version
-  local installed_build repos_type get is_patch
+  local installed_build repos_type get is_patch package_match
 
   # get the repository type
   repos_type="`echo $sugested | cut -d , -f 2`"
@@ -544,6 +555,9 @@ function simplaret_search_and_download_patch {
   # check if the patch was already downloaded
   if echo "$DOWNLOADED_PATCHES" | grep -q " $ARCH:$VERSION:$sugested "; then
     echo "Jail $root needs package $sugested (already downloaded, skipping)"
+    if [ "$IS_UPGRADE" != "1" ]; then
+      return
+    fi
   fi
 
   # search if its installed in the jail
@@ -565,17 +579,19 @@ function simplaret_search_and_download_patch {
     if [ "$package_installed" == "1" ]; then
       if [ "$repos_type" == "patches" ]; then
 
-        if [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then
+        if  [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then
           get="yes"
-        elif  [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then
+          package_match="no"
+        elif [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then
           get="yes"
         fi
 
       elif [ "$repos_type" == "root" ] && [ "$is_patch" == "yes" ]; then
 
-        if [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then
+        if  [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then
           get="yes"
-        elif  [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then
+          package_match="no"
+        elif [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then
           get="yes"
         fi
 
@@ -585,6 +601,7 @@ function simplaret_search_and_download_patch {
         # otherwise all installed packages would be downloaded
         if [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then
           get="yes"
+          package_match="no"
         fi
       fi
     fi
@@ -592,7 +609,11 @@ function simplaret_search_and_download_patch {
     # finally, get the package
     if [ "$get" == "yes" ]; then
       if [ "$IS_UPGRADE" == "1" ]; then
-        simplaret_install $sugested
+        if [ "$package_match" == "no" ]; then
+          simplaret_install $sugested
+        else
+          simplaret_get $sugested
+        fi
       else
         simplaret_get $sugested
       fi