]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
mkbuild: adding --update-manifest and other changes (see CHANGELOG)
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Tue, 23 Dec 2008 21:24:11 +0000 (21:24 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Tue, 23 Dec 2008 21:24:11 +0000 (21:24 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@707 04377dda-e619-0410-9926-eae83683ac58

trunk/conf/simplepkg.conf
trunk/doc/CHANGELOG
trunk/lib/common.sh
trunk/mkbuild/generic.mkSlackBuild
trunk/mkbuild/kde4.mkSlackBuild
trunk/mkbuild/perl.mkSlackBuild
trunk/src/createpkg
trunk/src/mkbuild
trunk/src/simplaret

index 8554f521b7b91d9933aa33cc94ab4c9695e471bb..003d40ea698264c15343dd3d9e35849c1e151baf 100644 (file)
@@ -78,6 +78,12 @@ MKBUILDS_SVN_GROUP=""
 # Set sources default directory
 SOURCE_DIR="/var/simplepkg/sources"
 
+# Set SOURCE_DIR folder owner
+SOURCE_DIR_USER=""
+
+# Set SOURCE_DIR folder group
+SOURCE_DIR_GROUP=""
+
 # Set color style. Possible values are: color,gray, none.
 COLOR_MODE="none"
 
@@ -109,6 +115,9 @@ SIGN_PACKAGES_USER=""
 # GPG key id used for package signature, leave blank to use default key.
 SIGN_PACKAGES_KEYID=""
 
+# Whether to use gpg-agent to sign packages
+SIGN_PACKAGES_WITH_GPG_AGENT="off"
+
 #---------------------------------------------------------------------
 #                        SIMPLARET SECTION
 #---------------------------------------------------------------------
index de955e9386fa658d7aa3c3ca75f81d6bc75bec63..391b011653f07046d1cad9b124f4f627a8cc0e35 100644 (file)
@@ -15,6 +15,7 @@ simplepkg changelog
       - new config parameter "TMP" 
       - renamed function use_svn to templates_under_svn
     - simplaret:
+       - support for HTTPS
        - simplaret_search_and_process_patch do not donwload a package with the same
          package name twice in any case
        - simplaret_set_arch: mapping non-present architectures to i486
@@ -27,6 +28,7 @@ simplepkg changelog
       - default configuration making createpkg repository integrated with simplaret
       - new repositories
     - mkbuild:
+      - code cleanup
       - all previous "commit" functions and command line options changed to "submit" as they
         don't really commit files into the svn repository
       - function svn_mkdir moved to common.sh
@@ -48,7 +50,8 @@ simplepkg changelog
       - renamed all "MAKEPKG" config parameters to "PACKAGES", "MAKEPKG_REPOS" to "PACKAGES_DIR"
       - new config parameters PACKAGES_REPOS_STYLE, MOVE_SLACK_REQUIRED, MKBUILDS_SVN_USER,
         PACKAGES_SVN_USER, PACKAGES_SVN_GROUP, MKBUILDS_SVN_GROUP, PACKAGES_REPOS_NOARCH,
-        PACKAGES_SVN, CREATEPKG_AUTHOR, SIGN_PACKAGES, SIGN_PACKAGES_USER. SIGN_PACKAGES_KEYID
+        PACKAGES_SVN, CREATEPKG_AUTHOR, SIGN_PACKAGES, SIGN_PACKAGES_USER. SIGN_PACKAGES_KEYID,
+        SIGN_PACKAGES_WITH_GPG_AGENT, SOURCE_DIR_USER, SOURCE_DIR_GROUP
       - cleaner -s option output
     - lspkg: fix on package search routine
     - jail-commit: using unified diff
index 9a123aa7e8457a521cd8e66839a588cc2a213962..39199ac15fbfc75a4cabea8c0857e8ffbf503e87 100644 (file)
@@ -545,6 +545,22 @@ function get_group {
 
 }
 
+function is_writable_folder {
+
+  # check if a folder is writable
+  # usage: is_writable_folder <folder>
+
+  local tmpfile folder="$1"
+
+  if mkdir -p $folder &> /dev/null && tmpfile=`mktemp $folder/is_writable_folder.XXXXXX`; then     
+    rm -f $tmpfile
+    return 0
+  else
+    return 1
+  fi
+
+}
+
 # -----------------------------------------------
 #              subversion functions
 # -----------------------------------------------
index fbc7b4a9348c1d2a25dc6b3ee52921e82a34aa1b..0036fa97cc7519b1ba0e7cb7a0375c8410c30d69 100644 (file)
@@ -275,6 +275,7 @@ if [ -e "$CWD/Manifest" ]; then
 
     MANIFEST_LINE="`head -n $MANIFEST_COUNT $CWD/Manifest | tail -n 1`"
     MANIFEST_FILE="`echo $MANIFEST_LINE | awk '{ print $2 }'`"
+    MANIFEST_FILE_TYPE="`echo $MANIFEST_LINE | awk '{ print $1 }'`"
 
     if [ -e "$SRC_DIR/$MANIFEST_FILE" ]; then
       MANIFEST_FILE="$SRC_DIR/$MANIFEST_FILE"
@@ -286,7 +287,7 @@ if [ -e "$CWD/Manifest" ]; then
       continue
     fi
 
-    echo "Checking Manifest for $MANIFEST_FILE integrity..."
+    echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..."
 
     SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`"
     SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`"
@@ -295,6 +296,8 @@ if [ -e "$CWD/Manifest" ]; then
     if [ "$SIZE_SRC" != "$SIZE_MANIFEST" ]; then
       echo "SIZE Manifest: $SIZE_MANIFEST; SIZE $SRC: $SIZE_SRC"
       exit $ERROR_MANIFEST
+    else
+      echo "Size match."
     fi
 
     # Check source code integrity
@@ -309,6 +312,8 @@ if [ -e "$CWD/Manifest" ]; then
       if [ "$ALGO_SRC" != "$ALGO_MANIFEST" ]; then
         echo "$ALGO Manifest: $ALGO_MANIFEST; $ALGO $SRC: $ALGO_SRC"
         exit $ERROR_MANIFEST
+      else
+        echo "$ALGO match."
       fi
     done
 
index f432ce9c2bd3a494b233dbe0aafb293ef7405c70..204d2c694e39bd41bcee5b0007a3479849866726 100644 (file)
@@ -262,6 +262,7 @@ if [ -e "$CWD/Manifest" ]; then
 
     MANIFEST_LINE="`head -n $MANIFEST_COUNT $CWD/Manifest | tail -n 1`"
     MANIFEST_FILE="`echo $MANIFEST_LINE | awk '{ print $2 }'`"
+    MANIFEST_FILE_TYPE="`echo $MANIFEST_LINE | awk '{ print $1 }'`"
 
     if [ -e "$SRC_DIR/$MANIFEST_FILE" ]; then
       MANIFEST_FILE="$SRC_DIR/$MANIFEST_FILE"
@@ -273,7 +274,7 @@ if [ -e "$CWD/Manifest" ]; then
       continue
     fi
 
-    echo "Checking Manifest for $MANIFEST_FILE integrity..."
+    echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..."
 
     SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`"
     SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`"
@@ -282,6 +283,8 @@ if [ -e "$CWD/Manifest" ]; then
     if [ "$SIZE_SRC" != "$SIZE_MANIFEST" ]; then
       echo "SIZE Manifest: $SIZE_MANIFEST; SIZE $SRC: $SIZE_SRC"
       exit $ERROR_MANIFEST
+    else
+      echo "Size match."
     fi
 
     # Check source code integrity
@@ -296,6 +299,8 @@ if [ -e "$CWD/Manifest" ]; then
       if [ "$ALGO_SRC" != "$ALGO_MANIFEST" ]; then
         echo "$ALGO Manifest: $ALGO_MANIFEST; $ALGO $SRC: $ALGO_SRC"
         exit $ERROR_MANIFEST
+      else
+        echo "$ALGO match."
       fi
     done
 
index 1862b256d8f82eb0066b0b21bedb8969a97ad5f3..de16b089b0cc82451df9e7c4eedcb19048601fbc 100644 (file)
@@ -223,6 +223,7 @@ if [ -e "$CWD/Manifest" ]; then
 
     MANIFEST_LINE="`head -n $MANIFEST_COUNT $CWD/Manifest | tail -n 1`"
     MANIFEST_FILE="`echo $MANIFEST_LINE | awk '{ print $2 }'`"
+    MANIFEST_FILE_TYPE="`echo $MANIFEST_LINE | awk '{ print $1 }'`"
 
     if [ -e "$SRC_DIR/$MANIFEST_FILE" ]; then
       MANIFEST_FILE="$SRC_DIR/$MANIFEST_FILE"
@@ -234,7 +235,7 @@ if [ -e "$CWD/Manifest" ]; then
       continue
     fi
 
-    echo "Checking Manifest for $MANIFEST_FILE integrity..."
+    echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..."
 
     SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`"
     SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`"
@@ -243,6 +244,8 @@ if [ -e "$CWD/Manifest" ]; then
     if [ "$SIZE_SRC" != "$SIZE_MANIFEST" ]; then
       echo "SIZE Manifest: $SIZE_MANIFEST; SIZE $SRC: $SIZE_SRC"
       exit $ERROR_MANIFEST
+    else
+      echo "Size match."
     fi
 
     # Check source code integrity
@@ -257,6 +260,8 @@ if [ -e "$CWD/Manifest" ]; then
       if [ "$ALGO_SRC" != "$ALGO_MANIFEST" ]; then
         echo "$ALGO Manifest: $ALGO_MANIFEST; $ALGO $SRC: $ALGO_SRC"
         exit $ERROR_MANIFEST
+      else
+        echo "$ALGO match."
       fi
     done
 
index 325d120ed374b5699732cacb7b0c752504731108..09e38c140fb028d5060706ce330e2c25c433d29f 100644 (file)
@@ -257,6 +257,8 @@ function load_parameters {
   SLACKBUILDS_SVN="`eval_parameter SLACKBUILDS_SVN http://slack.sarava.org/slackbuilds`"
   SVN_USER="`eval_parameter PACKAGES_SVN_USER`"
   SVN_GROUP="`eval_parameter PACKAGES_SVN_GROUP`"
+  SOURCE_DIR_USER="`eval_parameter SOURCE_DIR_USER`"
+  SOURCE_DIR_GROUP="`eval_parameter SOURCE_DIR_GROUP`"
 
   COLOR_MODE="`eval_parameter COLOR_MODE none`"
   CREATEPKG_ARCH="`eval_parameter CREATEPKG_ARCH $(default_arch)`"
@@ -267,11 +269,18 @@ function load_parameters {
   SIGN_PACKAGES="`eval_boolean_parameter SIGN_PACKAGES $off`"
   SIGN_PACKAGES_USER="`eval_parameter SIGN_PACKAGES_USER`"
   SIGN_PACKAGES_KEYID="`eval_parameter SIGN_PACKAGES_KEYID`"
+  SIGN_PACKAGES_WITH_GPG_AGENT="`eval_boolean_parameter SIGN_PACKAGES_WITH_GPG_AGENT $off`"
 
   if [ ! -z "$SIGN_PACKAGES_KEYID" ]; then
     SIGN_PACKAGES_KEYID="`echo $SIGN_PACKAGES_KEYID | tr '[:lower:]' '[:upper:]'`"
   fi
 
+  if [ "$SIGN_PACKAGES_WITH_GPG_AGENT" -eq $on ]; then
+    GPG_AGENT_OPTION="--use-agent"
+  else
+    GPG_AGENT_OPTION=""
+  fi
+
   REMOVE_OLD_PACKAGE="`eval_boolean_parameter REMOVE_OLD_PACKAGE $off`"
   MOVE_BIN_PACKAGE="`eval_boolean_parameter MOVE_BIN_PACKAGE $off`"
   MOVE_SLACK_REQUIRED="`eval_boolean_parameter MOVE_SLACK_REQUIRED $off`"
@@ -676,6 +685,16 @@ cd $SCRIPT_BASE
 # Check if package was built
 handle_error $? $PACKAGE
 
+# Fix source folder user
+if [ ! -z "$SOURCE_DIR_USER" ]; then
+  chown -R $SOURCE_DIR_USER $SOURCE_DIR
+fi
+
+# Fix source folder group
+if [ ! -z "$SOURCE_DIR_GROUP" ]; then
+  chgrp -R $SOURCE_DIR_USER $SOURCE_DIR
+fi
+
 # Get package name, arch, version and build number
 PKG_NAME="`ls -1 -c $PACKAGES_DIR/$PACKAGE-*-*-*.tgz | head -n 1 | xargs basename`"
 PACKAGE_NAME="`package_name $PKG_NAME`"
@@ -719,11 +738,11 @@ if [ $SIGN_PACKAGES -eq $on ]; then
   if [ ! -z "$SIGN_PACKAGES_USER" ]; then
     tmp_sign_folder="`mktemp -d $TMP/createpkg_sign.XXXXXX`"
     chown $SIGN_PACKAGES_USER $tmp_sign_folder
-    su $SIGN_PACKAGES_USER -c "gpg --use-agent --armor -sb -u $SIGN_KEYID -o $tmp_sign_folder/$PKG_NAME.asc $PACKAGES_DIR/$PKG_NAME"
+    su $SIGN_PACKAGES_USER -c "gpg $GPG_AGENT_OPTION --armor -sb -u $SIGN_KEYID -o $tmp_sign_folder/$PKG_NAME.asc $PACKAGES_DIR/$PKG_NAME"
     cp $tmp_sign_folder/$PKG_NAME.asc $PACKAGES_DIR/$PKG_NAME.asc
     rm -rf $tmp_sign_folder
   else
-    gpg --use-agent --armor -sb -u $SIGN_KEYID $PACKAGES_DIR/$PKG_NAME
+    gpg $GPG_AGENT_OPTION --armor -sb -u $SIGN_KEYID $PACKAGES_DIR/$PKG_NAME
   fi
 
 fi
index 84120ffd1e46eda75cb9c0e02f171b084ff14392..f7566f58fcbb85650c2d2dd723b17e7ae30aee05 100755 (executable)
@@ -164,6 +164,12 @@ function set_parameters {
         ACTION="commit_all"
         shift
       ;;
+      '-um'|'--update-manifest')
+        ACTION="update_manifest"
+        MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+        SOURCE_FILE="$3"
+        shift 2
+      ;;
       '-n'|'--new')
         # New mkbuild configure file
         MKBUILD_NAME="${2//.mkbuild}.mkbuild"
@@ -729,6 +735,7 @@ function file_metainfo {
 
   local sum="" file="$1" file_type="`echo $2 | tr '[:lower:]' '[:upper:]'`"
   local size algo candidate folders path manifest_file="$3"
+  local dist_name="`basename $file`"
 
   if [ -d "$file" ]; then
     return
@@ -741,30 +748,28 @@ function file_metainfo {
   if [ ! -e "$file" ]; then
     if [ "$file_type" == "DIST" ]; then
 
-      folders="$WORK $TMP $SOURCE_DIR"
-      if ! is_the_same /tmp $TMP; then
-        folders="$folders /tmp"
+      # Add DIST information only if source is not under revision control
+      if [ $SVN_MOD -eq $on -o $GIT_MOD -eq $on ]; then
+         return
       fi
 
-      echo "Trying to find $(basename $file)) at $folders..."
+      # Force DIST file name at Manifest
+      dist_name="$DIST_SRC_NAME"
 
-      for path in $folders; do
-        candidate="$(find $path -name $(basename $file))"
-        if [ ! -z "$candidate" ]; then
-          break
-        fi
-      done
+      # Determine file location
+      get_dist_file
 
-      if [ ! -z "$candidate" ]; then
-        echo "Using $(basename $file) found at $(dirname $candidate) to hash at the Manifest."
-        file="$candidate"
+      # Update Manifest metadata
+      if [ -e "$DIST_SRC_LOCATION" ]; then
+        file="$DIST_SRC_LOCATION"
+        echo "Using $(basename $file) found at $(dirname $file) to hash at the Manifest."
       else
-        echo "$file_type `basename $file` " >> $manifest_file # end space is important
+        echo "$file_type $dist_name " >> $manifest_file # end space is important
         return 1
       fi
 
     else
-      echo "$file_type `basename $file` " >> $manifest_file # end space is important
+      echo "$file_type $dist_name " >> $manifest_file # end space is important
       return 1
     fi
   fi
@@ -773,7 +778,7 @@ function file_metainfo {
     sum="$sum `echo $algo | tr '[:lower:]' '[:upper:]'` `gethash $algo $file`"
   done
 
-  echo $file_type `basename $file` `file_size $file` $sum >> $manifest_file
+  echo $file_type $dist_name `file_size $file` $sum >> $manifest_file
 
 }
 
@@ -789,7 +794,7 @@ function update_manifest_info {
   fi
 
   # Update Manifest file
-  if [ ! -e "`dirname $file`/Manifest" ]; then
+  if [ ! -e "$WORK/Manifest" ]; then
     touch $WORK/Manifest
   fi
 
@@ -797,7 +802,7 @@ function update_manifest_info {
   tmpfile="`mktemp $TMP/mkbuild_manifest.XXXXXX`"
 
   # Update metadata
-  sed -e "/^$file_type `basename $file` /d" `dirname $file`/Manifest > $tmpfile
+  sed -e "/^$file_type `basename $file` /d" $WORK/Manifest > $tmpfile
   file_metainfo $file $file_type $tmpfile
 
   if [ "$?" != "0" ]; then
@@ -806,13 +811,13 @@ function update_manifest_info {
   fi
 
   # Save Manifest changes
-  sort $tmpfile > `dirname $file`/Manifest
+  sort $tmpfile > $WORK/Manifest
 
   rm -f $tmpfile
 
 }
 
-function update_manifest {
+function edit_manifest {
 
   # Update Manifest file
   verbose "Updating Manifest..."
@@ -849,6 +854,127 @@ function update_manifest {
 
 }
 
+function get_dist_file {
+
+  # get package source code
+  # usage: get_dist_file [file]
+
+  local folders path candidate file="$1"
+  local protocol="`echo $URL | cut -d : -f 1 | tr '[:upper:]' '[:lower:]'`"
+
+  # Determine file location
+  if [ -d "$file" ]; then
+
+    file="$DIST_SRC_NAME"
+    for candidate in $(find $SOURCE_FILE -name $(basename $file)); do
+      if [ ! -z "$candidate" ]; then
+        break 2
+      fi
+    done
+
+    if [ ! -z "$candidate" ]; then
+      echo "Using $(basename $candidate) found at $(dirname $candidate) to hash at the Manifest."
+      file="$candidate"
+    else
+      echo "Can't find $file at $DIST_SRC_NAME."
+      return 1
+    fi
+
+  elif [ -z "$file" ]; then
+
+    file="$DIST_SRC_NAME"
+    folders="$WORK $TMP $SOURCE_DIR"
+    if ! is_the_same /tmp $TMP; then
+      folders="$folders /tmp"
+    fi
+
+    echo "Trying to find $(basename $file) at $folders..."
+
+    for path in $folders; do
+      for candidate in $(find $path -name $(basename $file)); do
+        if [ ! -z "$candidate" ]; then
+          break 2
+        fi
+      done
+    done    
+
+    if [ ! -z "$candidate" ]; then
+
+      echo "Using $(basename $candidate) found at $(dirname $candidate) to hash at the Manifest."
+      file="$candidate"
+
+    elif [ "$protocol" == "https" ] || \
+         [ "$protocol" == "http" ] || \
+         [ "$protocol" == "ftp" ]; then
+
+      # TODO: config file parameter should control whether to donwload
+      # Try to donwload the file
+      if [ ! -e "$file" ]; then
+        if is_writable_folder $SOURCE_DIR/$PKG_NAME; then
+          file="$SOURCE_DIR/$PKG_NAME/`basename $DIST_SRC_NAME`"
+          wget "$URL" -O "$file"
+          if [ "$?" != "0" ]; then
+            echo "Could not download $file"
+            return 1
+          fi
+        elif is_writable_folder $TMP; then
+          file="$TMP/`basename $DIST_SRC_NAME`"
+          if [ ! -e "$file" ]; then
+            wget "$URL" -O "$file"
+            if [ "$?" != "0" ]; then
+              echo "Could not download $file"
+              return 1
+            fi
+          fi
+        elif ! is_the_same /tmp $TMP; then
+          file="/tmp/`basename $DIST_SRC_NAME`"
+          if [ ! -e "$file" ]; then
+            wget "$URL" -O "$file"
+            if [ "$?" != "0" ]; then
+              echo "Could not download $file"
+              return 1
+            fi
+          fi
+        else
+          echo "Could not download $file"
+          return 1
+        fi
+      fi
+    fi
+  fi
+
+  DIST_SRC_LOCATION="$file"
+
+}
+
+function update_manifest {
+
+  # Get mkbuild values
+  get_mkbuild_values
+  # Add DIST information only if source is not under revision control
+  if [ $SVN_MOD -eq $on -o $GIT_MOD -eq $on ]; then
+    echo "Source is under version control system, can't add hashes to Manifest."
+    return
+  fi
+
+  echo "Updating DIST information at $MKBUILD_NAME Manifest..."
+
+  # Determine file location
+  get_dist_file
+
+  # Update Manifest metadata
+  if [ -e "$DIST_SRC_LOCATION" ]; then
+    update_manifest_info $DIST_SRC_LOCATION dist
+    # TODO: that should appear also when adding DIST information at edit_manifest
+    echo "Please make sure that the following hashes are correct:"
+    grep -e "^DIST $DIST_SRC_NAME " $WORK/Manifest
+  else
+    echo "Can't get $DIST_SRC_NAME."
+  fi
+
+}
+
 function if_previous_error {
 
   if [ "$?" != "0" ]; then
@@ -859,13 +985,13 @@ function if_previous_error {
 
 function verbose {
 
- if [ $VERBOSE -eq $on ]; then
-   echo $*
- fi
 if [ $VERBOSE -eq $on ]; then
+    echo $*
 fi
 
 }
 
-function make_slackbuild {
+function get_mkbuild_values {
 
   # Get values
   # Author name
@@ -1016,9 +1142,17 @@ function make_slackbuild {
   SLACKBUILD_PATH=`get_slackbuild_path`
   verbose "[[SLACKBUILD PATH]]=\"$SLACKBUILD_PATH\""
 
+}
+
+function make_slackbuild {
+
   #--------------------------------------------------------------
   #-                   Start build SlackBuild                   -
   #--------------------------------------------------------------
+
+  # Get mkbuild values
+  get_mkbuild_values
+
   verbose -e "\nStart SlackBuild make"
   SLACKBUILD_TEMP=$SLACKBUILD.tmp
   cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP
@@ -1059,7 +1193,7 @@ function make_slackbuild {
   change_other_parameters
 
   # Update Manifest file
-  update_manifest
+  edit_manifest
 
   # Commit SlackBuild
   [ $SUBMIT_SLACKBUILD -eq $on ] && submit_slackbuild
@@ -1151,6 +1285,9 @@ set_parameters "$@"
 verbose -e "$BASENAME version $PROG_VERSION\n"
 if [ ! -z $MKBUILD_NAME ]; then
   case $ACTION in
+    'update_manifest')
+      update_manifest $*
+    ;;
     'commit_slackbuild')
       commit_changes $SLACKBUILDS_DIR $*
     ;;
index 7edd92a3435e2273cb7871f73cfd0e0e804966aa..a1ffe2db34f1bb7c94dc5ef977ee1714ff3e84cd 100755 (executable)
@@ -98,7 +98,7 @@ function simplaret_download {
   local curl_timeout curl_passive_ftp curl_verbose
   local ncftpget_timeout ncftpget_passive_ftp
 
-  protocol="`echo $1 | cut -d : -f 1`"
+  protocol="`echo $1 | cut -d : -f 1 | tr '[:upper:]' '[:lower:]'`"
   file="`basename $2`"
 
   if [ ! -d "$3" ]; then
@@ -117,7 +117,7 @@ function simplaret_download {
     echo ""
   fi
 
-  if [ "$protocol" == "http" ]; then
+  if [ "$protocol" == "http" ] || [ "$protocol" == "https" ]; then
 
     echo Getting $1/$2:
     if [ "$HTTP_TOOL" == "wget" ]; then