Hello community,

here is the log from the commit of package plowshare for openSUSE:Factory 
checked in at 2016-11-24 21:25:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/plowshare (Old)
 and      /work/SRC/openSUSE:Factory/.plowshare.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "plowshare"

Changes:
--------
--- /work/SRC/openSUSE:Factory/plowshare/plowshare.changes      2016-08-20 
12:27:31.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.plowshare.new/plowshare.changes 2016-11-24 
21:25:35.000000000 +0100
@@ -1,0 +2,10 @@
+Thu Nov 24 09:35:32 UTC 2016 - [email protected]
+
+- Update to version 2.1.6:
+  * API function delete_filter_line: eat lines until regexp is met.
+    Bump PLOWSHARE_API_VERSION to 6.
+  * [core] Handle CONT signal (wait time will be updated on ^Z)
+  * [core] Introduce PLOWSHARE_CURL and PLOWSHARE_JS environment
+    variables to override default curl and js commands.
+
+-------------------------------------------------------------------

Old:
----
  plowshare-2.1.5.tar.gz

New:
----
  plowshare-2.1.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ plowshare.spec ++++++
--- /var/tmp/diff_new_pack.7ipdea/_old  2016-11-24 21:25:36.000000000 +0100
+++ /var/tmp/diff_new_pack.7ipdea/_new  2016-11-24 21:25:36.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           plowshare
-Version:        2.1.5
+Version:        2.1.6
 Release:        0
 Summary:        Download and upload files from file-sharing websites
 License:        GPL-3.0+
@@ -49,8 +49,8 @@
 %build
 
 %install
-make %{?_smp_mflags} DESTDIR=%{buildroot} install
-install -D -m 0644  scripts/%{name}.completion  
%{buildroot}%{_datadir}/bash-completion/completions/%{name}
+%make_install
+install -D -p -m 0644  scripts/%{name}.completion  
%{buildroot}%{_datadir}/bash-completion/completions/%{name}
 sed -i 's|/local||g' 
%{buildroot}%{_datadir}/bash-completion/completions/%{name}
 rm -rf  %{buildroot}%{_datadir}/doc/%{name}
 

++++++ plowshare-2.1.5.tar.gz -> plowshare-2.1.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/CHANGELOG 
new/plowshare-2.1.6/CHANGELOG
--- old/plowshare-2.1.5/CHANGELOG       2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/CHANGELOG       2016-10-30 10:46:54.000000000 +0100
@@ -1,3 +1,13 @@
+plowshare (2.1.6) stable; urgency=low
+
+  * API function delete_filter_line: eat lines until regexp is met.
+    Bump PLOWSHARE_API_VERSION to 6.
+  * [core] Handle CONT signal (wait time will be updated on ^Z) (#56)
+  * [core] Introduce PLOWSHARE_CURL and PLOWSHARE_JS environment variables
+    to override default curl and js commands.
+
+ -- Matthieu Crapet <[email protected]>  Sun, 30 Oct 2016 10:45:08 +0100
+
 plowshare (2.1.5) stable; urgency=low
 
   * Various documentation and help improvements
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/INSTALL new/plowshare-2.1.6/INSTALL
--- old/plowshare-2.1.5/INSTALL 2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/INSTALL 2016-10-30 10:46:54.000000000 +0100
@@ -62,7 +62,7 @@
 Note: You'll probably need to be root to install the plowshare package.
 
 # Mac OS X (with Homebrew)
-$ brew plowshare
+$ brew install plowshare
 
 2) Manual method: from git sources
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/docs/plowdel.1 
new/plowshare-2.1.6/docs/plowdel.1
--- old/plowshare-2.1.5/docs/plowdel.1  2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/docs/plowdel.1  2016-10-30 10:46:54.000000000 +0100
@@ -19,7 +19,7 @@
 .\" License along with this manual; if not, see
 .\" <http://www.gnu.org/licenses/>.
 
-.TH "plowdel" "1" "May 30, 2016" "GPL" "Plowshare for Bash 4"
+.TH "plowdel" "1" "July 13, 2016" "GPL" "Plowshare for Bash 4"
 
 .SH NAME
 plowdel \- Delete files from file sharing websites links
@@ -217,6 +217,13 @@
 .I FRAMEBUFFER
 This variable is considered to display captchas. See \fB--captchamethod=fb\fR 
documentation below.
 .TP
+.I HOME
+Search for user configuration directory in \fB~/.config/plowshare\fR (see 
FILES section above).
+If found, \fB~/.curlrc\fR will be used (use \fB--no-curlrc\fR to disable it).
+.TP
+.I PLOWSHARE_CURL
+Specifies an alternate curl command (\fB$PATH\fR search is considered). If not 
defined, \fBcurl\fR is used.
+.TP
 .I XDG_CONFIG_HOME
 The directory to store user configuration files. If not defined, 
\fB~/.config\fR is assumed.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/docs/plowdown.1 
new/plowshare-2.1.6/docs/plowdown.1
--- old/plowshare-2.1.5/docs/plowdown.1 2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/docs/plowdown.1 2016-10-30 10:46:54.000000000 +0100
@@ -19,7 +19,7 @@
 .\" License along with this manual; if not, see
 .\" <http://www.gnu.org/licenses/>.
 
-.TH "plowdown" "1" "May 30, 2016" "GPL" "Plowshare for Bash 4"
+.TH "plowdown" "1" "July 13, 2016" "GPL" "Plowshare for Bash 4"
 
 .SH NAME
 plowdown \- Simple download manager for file sharing websites
@@ -438,6 +438,16 @@
 .I FRAMEBUFFER
 This variable is considered to display captchas. See \fB--captchamethod=fb\fR 
documentation below.
 .TP
+.I HOME
+Search for user configuration directory in \fB~/.config/plowshare\fR (see 
FILES section above).
+If found, \fB~/.curlrc\fR will be used (use \fB--no-curlrc\fR to disable it).
+.TP
+.I PLOWSHARE_CURL
+Specifies an alternate curl command (\fB$PATH\fR search is considered). If not 
defined, \fBcurl\fR is used.
+.TP
+.I PLOWSHARE_JS
+Specifies an alternate js command (\fB$PATH\fR search is considered). If not 
defined, \fBjs\fR is used.
+.TP
 .I XDG_CONFIG_HOME
 The directory to store user configuration files. If not defined, 
\fB~/.config\fR is assumed.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/docs/plowlist.1 
new/plowshare-2.1.6/docs/plowlist.1
--- old/plowshare-2.1.5/docs/plowlist.1 2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/docs/plowlist.1 2016-10-30 10:46:54.000000000 +0100
@@ -19,7 +19,7 @@
 .\" License along with this manual; if not, see
 .\" <http://www.gnu.org/licenses/>.
 
-.TH "plowlist" "1" "May 30, 2016" "GPL" "Plowshare for Bash 4"
+.TH "plowlist" "1" "July 13, 2016" "GPL" "Plowshare for Bash 4"
 
 .SH NAME
 plowlist \- List links from shared folders websites
@@ -172,6 +172,22 @@
 (plowlist will try to open \fB~/.config/plowshare/modules.d/*/config\fR). One 
file per module (hoster).
 
 .\" 
****************************************************************************
+.\" * Environment Variables                                                    
*
+.\" 
****************************************************************************
+.SH "ENVIRONMENT VARIABLES"
+The following environment variables may affect plowlist:
+.TP
+.I HOME
+Search for user configuration directory in \fB~/.config/plowshare\fR (see 
FILES section above).
+If found, \fB~/.curlrc\fR will be used (use \fB--no-curlrc\fR to disable it).
+.TP
+.I PLOWSHARE_CURL
+Specifies an alternate curl command (\fB$PATH\fR search is considered). If not 
defined, \fBcurl\fR is used.
+.TP
+.I XDG_CONFIG_HOME
+The directory to store user configuration files. If not defined, 
\fB~/.config\fR is assumed.
+
+.\" 
****************************************************************************
 .\" * Exit codes                                                               
*
 .\" 
****************************************************************************
 .SH "EXIT CODES"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/docs/plowmod.1 
new/plowshare-2.1.6/docs/plowmod.1
--- old/plowshare-2.1.5/docs/plowmod.1  2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/docs/plowmod.1  2016-10-30 10:46:54.000000000 +0100
@@ -19,7 +19,7 @@
 .\" License along with this manual; if not, see
 .\" <http://www.gnu.org/licenses/>.
 
-.TH "plowmod" "1" "June 8, 2016" "GPL" "Plowshare for Bash 4"
+.TH "plowmod" "1" "July 13, 2016" "GPL" "Plowshare for Bash 4"
 
 .SH NAME
 plowmod \- Simple plowshare modules management tool
@@ -120,7 +120,13 @@
 .\" * Environment Variables                                                    
*
 .\" 
****************************************************************************
 .SH "ENVIRONMENT VARIABLES"
-The following environment variables may affect plowdown:
+The following environment variables may affect plowmod:
+.TP
+.I HOME
+Search for user configuration directory in \fB~/.config/plowshare\fR (see 
FILES section above).
+.TP
+.I PLOWSHARE_CURL
+Specifies an alternate curl command (\fB$PATH\fR search is considered). If not 
defined, \fBcurl\fR is used.
 .TP
 .I XDG_CONFIG_HOME
 The directory to store user configuration files. If not defined, 
\fB~/.config\fR is assumed.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/docs/plowprobe.1 
new/plowshare-2.1.6/docs/plowprobe.1
--- old/plowshare-2.1.5/docs/plowprobe.1        2016-06-11 11:03:12.000000000 
+0200
+++ new/plowshare-2.1.6/docs/plowprobe.1        2016-10-30 10:46:54.000000000 
+0100
@@ -19,7 +19,7 @@
 .\" License along with this manual; if not, see
 .\" <http://www.gnu.org/licenses/>.
 
-.TH "plowprobe" "1" "May 30, 2016" "GPL" "Plowshare for Bash 4"
+.TH "plowprobe" "1" "July 13, 2016" "GPL" "Plowshare for Bash 4"
 
 .SH NAME
 plowprobe \- Gather information from file sharing download links
@@ -186,6 +186,22 @@
 (plowprobe will try to open \fB~/.config/plowshare/modules.d/*/config\fR). One 
file per module (hoster).
 
 .\" 
****************************************************************************
+.\" * Environment Variables                                                    
*
+.\" 
****************************************************************************
+.SH "ENVIRONMENT VARIABLES"
+The following environment variables may affect plowprobe:
+.TP
+.I HOME
+Search for user configuration directory in \fB~/.config/plowshare\fR (see 
FILES section above).
+If found, \fB~/.curlrc\fR will be used (use \fB--no-curlrc\fR to disable it).
+.TP
+.I PLOWSHARE_CURL
+Specifies an alternate curl command (\fB$PATH\fR search is considered). If not 
defined, \fBcurl\fR is used.
+.TP
+.I XDG_CONFIG_HOME
+The directory to store user configuration files. If not defined, 
\fB~/.config\fR is assumed.
+
+.\" 
****************************************************************************
 .\" * Exit codes                                                               
*
 .\" 
****************************************************************************
 .SH "EXIT CODES"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/docs/plowup.1 
new/plowshare-2.1.6/docs/plowup.1
--- old/plowshare-2.1.5/docs/plowup.1   2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/docs/plowup.1   2016-10-30 10:46:54.000000000 +0100
@@ -19,7 +19,7 @@
 .\" License along with this manual; if not, see
 .\" <http://www.gnu.org/licenses/>.
 
-.TH "plowup" "1" "May 30, 2016" "GPL" "Plowshare for Bash 4"
+.TH "plowup" "1" "July 13, 2016" "GPL" "Plowshare for Bash 4"
 
 .SH NAME
 plowup \- Simple upload manager for file sharing websites
@@ -420,6 +420,16 @@
 .I FRAMEBUFFER
 This variable is considered to display captchas. See \fB--captchamethod=fb\fR 
documentation below.
 .TP
+.I HOME
+Search for user configuration directory in \fB~/.config/plowshare\fR (see 
FILES section above).
+If found, \fB~/.curlrc\fR will be used (use \fB--no-curlrc\fR to disable it).
+.TP
+.I PLOWSHARE_CURL
+Specifies an alternate curl command (\fB$PATH\fR search is considered). If not 
defined, \fBcurl\fR is used.
+.TP
+.I PLOWSHARE_JS
+Specifies an alternate js command (\fB$PATH\fR search is considered). If not 
defined, \fBjs\fR is used.
+.TP
 .I XDG_CONFIG_HOME
 The directory to store user configuration files. If not defined, 
\fB~/.config\fR is assumed.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/src/core.sh 
new/plowshare-2.1.6/src/core.sh
--- old/plowshare-2.1.5/src/core.sh     2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/src/core.sh     2016-10-30 10:46:54.000000000 +0100
@@ -22,11 +22,15 @@
 set -o pipefail
 
 # Each time an API is updated, this value will be increased
-declare -r PLOWSHARE_API_VERSION=5
+declare -r PLOWSHARE_API_VERSION=6
 
 # User configuration directory (contains plowshare.conf, exec/, storage/, 
modules.d/)
 declare -r PLOWSHARE_CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}/plowshare"
 
+# Dependencies
+declare -r PLOWCORE_JS=${PLOWSHARE_JS:-js}
+declare -r PLOWCORE_CURL=${PLOWSHARE_CURL:-curl}
+
 # Global error codes
 # 0 means success or link alive
 declare -r ERR_FATAL=1                    # Unexpected result (upstream site 
updated, etc)
@@ -83,6 +87,7 @@
 #
 # Global variables defined here (FIXME later):
 #   - PS_TIMEOUT       (plowdown, plowup) Timeout (in seconds) for one item
+#   - CONT_SIGNAL      SIGCONT signal received
 
 # log_report for a file
 # $1: filename
@@ -172,11 +177,11 @@
     fi
 
     if test $VERBOSE -lt 4; then
-        command curl "${OPTIONS[@]}" "${CURL_ARGS[@]}" || DRETVAL=$?
+        command "$PLOWCORE_CURL" "${OPTIONS[@]}" "${CURL_ARGS[@]}" || 
DRETVAL=$?
     else
         local FILESIZE TEMPCURL=$(create_tempfile)
         log_report "${OPTIONS[@]}" "${CURL_ARGS[@]}"
-        command curl "${OPTIONS[@]}" "${CURL_ARGS[@]}" --show-error --silent 
>"$TEMPCURL" 2>&1 || DRETVAL=$?
+        command "$PLOWCORE_CURL" "${OPTIONS[@]}" "${CURL_ARGS[@]}" 
--show-error --silent >"$TEMPCURL" 2>&1 || DRETVAL=$?
         FILESIZE=$(get_filesize "$TEMPCURL")
         log_report "Received $FILESIZE bytes. DRETVAL=$DRETVAL"
         log_report '=== CURL BEGIN ==='
@@ -372,6 +377,119 @@
     sed -ne :a -e "1,$N!{P;N;D;};N;ba"
 }
 
+# Delete lines up to regexp (included).
+# In a nutshell: eat lines until regexp is met, if nothing match,
+# delete lines until the end of input data (not really useful).
+# In vim, it would look like this: ":.,/regex/d" or ":.+5,/regex/+1d" 
($3=5,$2=1).
+#
+# Examples:
+# $ echo -e "aa\nbb\ncc\ndd\ee" >/tmp/f
+# $ delete_filter_line 'cc'     </tmp/f         # Returns: dd\nee
+# $ delete_filter_line 'cc' -1  </tmp/f         # Returns: cc\ndd\nee
+# $ delete_filter_line 'cc' -2  </tmp/f         # Returns: bb\ncc\ndd\nee
+# $ delete_filter_line 'cc' 1   </tmp/f         # Returns: ee
+#
+# $1: stop condition regex
+#     This is non greedy, first occurrence is taken
+# $2: (optional): offset, how many line to skip (default is 0) after matching 
regexp.
+#     Example ($2=-1): delete lines from line $3 to regexp (excluded)
+# $3: (optional): start line number (start at index 1, default is 1)
+# stdin: text data (multiline)
+# stdout: result
+delete_filter_line() {
+    local -i FUZZ=${2:-0}
+    local -i N=${3:-1}
+    local -r D=$'\001' # Change sed separator to allow '/' characters in regexp
+    local STR FILTER
+
+    if [[ ! $1 ]]; then
+        log_error "$FUNCNAME: invalid regexp, must not be empty"
+        return $ERR_FATAL
+    elif [ $N -le 0 ]; then
+        log_error "$FUNCNAME: wrong argument, start line must be strictly 
positive ($N given)"
+        return $ERR_FATAL
+    elif [ $N -gt 1 -a $FUZZ -lt -1 ]; then
+        log_debug "$FUNCNAME: before context ($FUZZ) could duplicates lines 
(already printed before line $N), continue anyway"
+    fi
+
+    # Notes:
+    # - We need to be careful when regex matches the first line ($3)
+    # - This head lines skip ($3) makes things really more complicated
+
+    (( --N ))
+    FILTER="\\${D}$1${D}" # /$1/
+
+    if [ $FUZZ -eq 0 ]; then
+        if (( $N > 0 )); then
+            # Line $N must be displayed
+            STR=$(sed -e "${N}p" -e "$N,${FILTER}d")
+        else
+            # 0,/regexp/ is valid, match can occur on first line
+            STR=$(sed -e "$N,${FILTER}d")
+        fi
+
+    elif [ $FUZZ -eq 1 ]; then
+        if (( $N > 0 )); then
+            STR=$(sed -e "${N}p" -e "$N,${FILTER}{${FILTER}N;d}")
+        else
+            STR=$(sed -e "$N,${FILTER}{${FILTER}N;d}")
+        fi
+
+    elif [ $FUZZ -eq -1 ]; then
+        if (( $N > 0 )); then
+            # If regexp matches at line $N do not print it twice
+            STR=$(sed -e "${N}p" -e "$N,${FILTER}{${N}d;${FILTER}p;d}")
+        else
+            STR=$(sed -e "$N,${FILTER}{${FILTER}p;d}")
+        fi
+
+    else
+        local -i FUZZ_ABS=$(( FUZZ < 0 ? -FUZZ : FUZZ ))
+
+        [ $FUZZ_ABS -gt 10 ] &&
+            log_notice "$FUNCNAME: are you sure you want to skip $((N+1)) 
lines?"
+
+        if [ $FUZZ -gt 0 ]; then
+            local SKIPS='N'
+
+            # printf '=%.0s' {1..n}
+            while (( --FUZZ_ABS )); do
+                SKIPS+=';N'
+            done
+
+            if (( $N > 0 )); then
+                STR=$(sed -e "${N}p" -e "$N,${FILTER}{${FILTER}{${SKIPS}};d}")
+            else
+                STR=$(sed -e "$N,${FILTER}{${FILTER}{${SKIPS}};d}")
+            fi
+        else
+            local LINES='.*'
+
+            while (( --FUZZ_ABS )); do
+                LINES+='\n.*'
+            done
+
+            if (( $N > 0 )); then
+                # Notes: could display duplicated lines when fuzz is below $N
+                # This is not a bug, just a side effect...
+                STR=$(sed -e "${N}p" -e "1h;1!H;x;s/^.*\\n\\($LINES\)$/\\1/;x" 
\
+                          -e "$N,${FILTER}{${N}d;${FILTER}{g;p};d}")
+            else
+                STR=$(sed -e "1h;1!H;x;s/^.*\\n\\($LINES\)$/\\1/;x" \
+                          -e "$N,${FILTER}{${FILTER}{g;p};d}")
+            fi
+        fi
+    fi
+
+    if [ -z "$STR" ]; then
+        log_error "$FUNCNAME failed (sed): \"$N,/$1/d\" (skip $FUZZ)"
+        log_notice_stack
+        return $ERR_FATAL
+    fi
+
+    echo "$STR"
+}
+
 # Check if a string ($2) matches a regexp ($1)
 # This is case sensitive.
 #
@@ -1220,7 +1338,7 @@
 # Detect if a JavaScript interpreter is installed
 # $? is zero on success
 detect_javascript() {
-    if ! type -P js >/dev/null 2>&1; then
+    if ! type -P "$PLOWCORE_JS" >/dev/null 2>&1; then
         log_notice 'Javascript interpreter not found. Please install one!'
         return $ERR_SYSTEM
     fi
@@ -1242,7 +1360,7 @@
     logcat_report "$TEMPSCRIPT"
     log_report '=== JAVASCRIPT END ==='
 
-    command js "$TEMPSCRIPT"
+    command "$PLOWCORE_JS" "$TEMPSCRIPT"
     rm -f "$TEMPSCRIPT"
     return 0
 }
@@ -1276,10 +1394,21 @@
     local MSG="Waiting $VALUE $UNIT_STR..."
     local CLEAR="     \b\b\b\b\b"
     if test -t 2; then
+        local START_DATE=$(date +%s)
+        CONT_SIGNAL=
         while [ "$REMAINING" -gt 0 ]; do
             log_notice_norc "\r$MSG $(splitseconds $REMAINING) left$CLEAR"
             sleep 1
-            (( --REMAINING ))
+            if [[ $CONT_SIGNAL ]]; then
+                local -i TMP_SECS
+                (( TMP_SECS = TOTAL_SECS - (CONT_SIGNAL - START_DATE) ))
+                (( TMP_SECS >= 0 )) || TMP_SECS=0
+                CONT_SIGNAL=
+                log_debug "SIGCONT detected, adjust wait time ($REMAINING => 
$TMP_SECS)"
+                REMAINING=$TMP_SECS
+            else
+                (( --REMAINING ))
+            fi
         done
         log_notice_norc "\r$MSG done$CLEAR\n"
     else
@@ -2481,7 +2610,7 @@
     local -A OBJ
 
     if [ -z "$MODULE" ]; then
-        log_error "$FUNCNAME: \$MODULE is undefined, abort."
+        log_error "$FUNCNAME: \$MODULE is undefined, abort"
         return $ERR_NOMODULE
     fi
 
@@ -2536,7 +2665,7 @@
     local -A OBJ
 
     if [ -z "$MODULE" ]; then
-        log_error "$FUNCNAME: \$MODULE is undefined, abort."
+        log_error "$FUNCNAME: \$MODULE is undefined, abort"
         return $ERR_NOMODULE
     fi
 
@@ -2570,7 +2699,7 @@
     local CONFIG
 
     if [ -z "$MODULE" ]; then
-        log_error "$FUNCNAME: \$MODULE is undefined, abort."
+        log_error "$FUNCNAME: \$MODULE is undefined, abort"
         return $ERR_NOMODULE
     fi
 
@@ -2621,25 +2750,42 @@
     sed -e 's/\xC2\?\xA0/ /g' -e 's/^[[:space:]]*//; s/[[:space:]]*$//'
 }
 
-# Do some cleanups before exiting program
-exit_handler() {
-    # Restore proper colors (just in case)
-    log_notice_norc ''
-
-    # Remove temporal files created by create_tempfile
-    rm -f "$TMPDIR/$(basename_file $0).$$".*
-}
+# Initialize plowcore: check environment variables and install signal handlers
+# $1: program name (used for error reporting only)
+core_init() {
+    local -r NAME=${1:-ERROR}
 
-# Install exit handler
-set_exit_trap() {
     if [ -z "$TMPDIR" ]; then
-        log_error 'ERROR: $TMPDIR is not defined.'
+        log_error "$NAME: \$TMPDIR is undefined, abort"
         return $ERR_SYSTEM
     elif [ ! -d "$TMPDIR" ]; then
-        log_error 'ERROR: $TMPDIR is not a directory.'
+        log_error "$NAME: \$TMPDIR is not a directory, abort"
         return $ERR_SYSTEM
     fi
-    trap exit_handler EXIT
+
+    if [ -n "$PLOWSHARE_CURL" ]; then
+        if ! type -P "$PLOWSHARE_CURL" >/dev/null 2>&1; then
+            log_error "$NAME: \$PLOWSHARE_CURL is invalid, abort"
+            return $ERR_SYSTEM
+        fi
+        log_debug "using custom curl: $PLOWSHARE_CURL"
+    fi
+
+    if [ -n "$PLOWSHARE_JS" ]; then
+        if ! type -P "$PLOWSHARE_JS" >/dev/null 2>&1; then
+            log_error "$NAME: \$PLOWSHARE_JS is invalid, abort"
+            return $ERR_SYSTEM
+        fi
+        log_debug "using custom js: $PLOWSHARE_JS"
+    fi
+
+    # Shutdown cleanups:
+    # - Restore proper colors (just in case)
+    # - Remove temporal files created by create_tempfile
+    trap 'log_notice_norc ""; rm -f "$TMPDIR/$(basename_file $0).$$".*' EXIT 
TERM
+
+    # SIGCONT notification
+    trap 'CONT_SIGNAL=$(date +%s)' CONT
 }
 
 # Check existence of executable in $PATH
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/src/delete.sh 
new/plowshare-2.1.6/src/delete.sh
--- old/plowshare-2.1.5/src/delete.sh   2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/src/delete.sh   2016-10-30 10:46:54.000000000 +0100
@@ -189,7 +189,7 @@
     exit $ERR_BAD_COMMAND_LINE
 fi
 
-set_exit_trap
+core_init 'plowdel'
 
 DCOOKIE=$(create_tempfile) || exit
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/src/download.sh 
new/plowshare-2.1.6/src/download.sh
--- old/plowshare-2.1.5/src/download.sh 2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/src/download.sh 2016-10-30 10:46:54.000000000 +0100
@@ -907,7 +907,7 @@
     exit $ERR_BAD_COMMAND_LINE
 fi
 
-set_exit_trap
+core_init 'plowdown'
 
 # Remember last host because hosters may require waiting between
 # successive downloads.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/src/list.sh 
new/plowshare-2.1.6/src/list.sh
--- old/plowshare-2.1.5/src/list.sh     2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/src/list.sh     2016-10-30 10:46:54.000000000 +0100
@@ -268,7 +268,7 @@
     exit $ERR_BAD_COMMAND_LINE
 fi
 
-set_exit_trap
+core_init 'plowlist'
 
 for URL in "${COMMAND_LINE_ARGS[@]}"; do
     LRETVAL=0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/src/mod.sh 
new/plowshare-2.1.6/src/mod.sh
--- old/plowshare-2.1.5/src/mod.sh      2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/src/mod.sh      2016-10-30 10:46:54.000000000 +0100
@@ -317,7 +317,7 @@
     log_report "[git ] $(git --version)"
 fi
 
-set_exit_trap
+core_init 'plowmod'
 
 declare -a RETVALS
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/src/probe.sh 
new/plowshare-2.1.6/src/probe.sh
--- old/plowshare-2.1.5/src/probe.sh    2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/src/probe.sh    2016-10-30 10:46:54.000000000 +0100
@@ -383,7 +383,7 @@
     exit $ERR_BAD_COMMAND_LINE
 fi
 
-set_exit_trap
+core_init 'plowprobe'
 
 for ITEM in "${COMMAND_LINE_ARGS[@]}"; do
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/plowshare-2.1.5/src/upload.sh 
new/plowshare-2.1.6/src/upload.sh
--- old/plowshare-2.1.5/src/upload.sh   2016-06-11 11:03:12.000000000 +0200
+++ new/plowshare-2.1.6/src/upload.sh   2016-10-30 10:46:54.000000000 +0100
@@ -427,7 +427,7 @@
 # Remove module name from argument list
 unset COMMAND_LINE_ARGS[0]
 
-set_exit_trap
+core_init 'plowup'
 
 UCOOKIE=$(create_tempfile) || exit
 URESULT=$(create_tempfile) || exit


Reply via email to