Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Ismael Luceno (e81d06b1cb1cd740c3d93238494a0ae096466005)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Ismael Luceno (e81d06b1cb1cd740c3d93238494a0ae096466005)
  • Date: Sat, 3 Jan 2015 21:36:17 -0600

GIT changes to master sorcery by Ismael Luceno <ismael AT sourcemage.org>:

ChangeLog | 3
usr/sbin/sorcery | 14 +++
var/lib/sorcery/modules/dl_handlers/dl_axel | 99
++++++++++++++++++++++++++++
3 files changed, 116 insertions(+)

New commits:
commit e81d06b1cb1cd740c3d93238494a0ae096466005
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

dl_axel: Add alternative http/https/ftp download handler

diff --git a/ChangeLog b/ChangeLog
index 138045b..2205d2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2015-01-04 Ismael Luceno <ismael AT sourcemage.org>
+ * dl_axel: Added alternative http/https/ftp download handler
+
2014-12-26 Ismael Luceno <ismael AT sourcemage.org>
* excluded: Ignore site-lisp's loaddefs.el
* excluded: Ignore backup files
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index e171c71..4d8b5a5 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -1477,6 +1477,7 @@ function set_dl_handler() {
local W_HELP="Use wget to download from urls using the http/ftp/https
protocols"
local A_HELP="Use aria2 to download from urls using the http/ftp/https
protocols"
local C_HELP="Use cURL to download from urls using the http/ftp/https
protocols"
+ local X_HELP="Use axel to download from urls using the http/ftp/https
protocols"

while
COMMAND=$(eval $DIALOG '--title "Currently using:
${HTTP_DL_HANDLER:-wget}" \
@@ -1488,6 +1489,7 @@ function set_dl_handler() {
0 0 0 \
"W" "wget (default)" "$W_HELP" \
"A" "aria2" "$A_HELP" \
+ "X" "axel" "$X_HELP" \
"C" "curl" "$C_HELP"')
do
case $COMMAND in
@@ -1517,6 +1519,18 @@ function set_dl_handler() {
modify_local_config HTTP_DL_HANDLER curl &&
HTTP_DL_HANDLER=curl
fi ;;
+ X)
+ if ! spell_ok axel; then
+ local error_msg
+ error_msg="Axel is not installed on this system!\nIf you want"
+ error_msg="$error_msg to use it, cast it first, then revisit"
+ error_msg="$error_msg this menu.\n\nYour download handler choice"
+ error_msg="$error_msg has not been saved!"
+ eval "$DIALOG --msgbox \"\$error_msg\" 0 0"
+ else
+ modify_local_config HTTP_DL_HANDLER axel &&
+ HTTP_DL_HANDLER=axel
+ fi
esac
break
done
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_axel
b/var/lib/sorcery/modules/dl_handlers/dl_axel
new file mode 100755
index 0000000..633c41c
--- /dev/null
+++ b/var/lib/sorcery/modules/dl_handlers/dl_axel
@@ -0,0 +1,99 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+##
+##=head1 SYNOPSIS
+##
+## Url handler functions for downloading http, https, and ftp urls
+##
+##=head1 DESCRIPTION
+##
+## This file contains functions for downloading and verifying
+## http, https, and ftp urls. It uses the "axel" program.
+##
+##=head1 COPYRIGHT
+##
+## Copyright 2015 by the Source Mage Team
+##
+##=head1 FUNCTIONS
+##
+##=over 4
+##
+#---------------------------------------------------------------------
+
+function dl_axel_get() {
+ debug libdownload "$FUNCNAME -- $@"
+ dl_command_check axel || return 254
+
+ local target=$1
+ local url_list=$2
+ # local hints=$3
+ local dl_target=$4
+ local dl_type=$5
+ local rc=1 url
+
+ [[ "$target" ]] &&
+ dl_connect || return 255
+
+ local AXEL_OPTIONS
+ dl_axel_set_options
+ dl_axel_call_axel "$target" $url_list
+ rc=$?
+
+ dl_disconnect
+
+ eval "$dl_target=\"$target\""
+ eval "$dl_type=\"file\""
+ return $rc
+
+}
+
+#---------------------------------------------------------------------
+# dl_axel_call_axel <filename> <url...>
+#
+# Private Function. Calls axel to download the url.
+#
+#---------------------------------------------------------------------
+function dl_axel_call_axel() {
+ debug 'dl_axel' "$funcname -- $@"
+ local FILE=$1
+ shift
+
+ rm -f "$FILE"
+ axel $AXEL_OPTIONS -o "$FILE" "$@" 2>&1
+}
+
+#---------------------------------------------------------------------
+# dl_axel_set_axel_options
+#
+# Private Function. Sets axel options
+#
+#---------------------------------------------------------------------
+function dl_axel_set_options() {
+ if [[ "$DOWNLOAD_RATE" ]]; then
+ RATE="-s $DOWNLOAD_RATE"
+ fi
+
+ AXEL_OPTIONS="$RATE"
+ debug 'dl_axel' "axel options: $AXEL_OPTIONS"
+}
+
+#---------------------------------------------------------------------
+##=back
+##
+##=head1 LICENSE
+##
+## This software 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
+## (at your option) any later version.
+##
+## This software 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 software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------



  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (e81d06b1cb1cd740c3d93238494a0ae096466005), Ismael Luceno, 01/03/2015

Archive powered by MHonArc 2.6.24.

Top of Page