diff --git a/objects.tar.gz b/objects.tar.gz index 4e2522c73..2aa4b6425 100644 Binary files a/objects.tar.gz and b/objects.tar.gz differ diff --git a/sherpa-manager.tar.gz b/sherpa-manager.tar.gz index 9c32ed3b8..db8869e49 100644 Binary files a/sherpa-manager.tar.gz and b/sherpa-manager.tar.gz differ diff --git a/support/sherpa-manager.source b/support/sherpa-manager.source index 44f36fb51..34c9537b0 100755 --- a/support/sherpa-manager.source +++ b/support/sherpa-manager.source @@ -8761,6 +8761,13 @@ QpkgGetArch() { # Translate arch from local NAS (QTS/QuTS) to sherpa notation. + # sherpa arch for target NAS is a single 3 character-code. + # 'a' for ARM, 'i' for Intel. + + if [[ $(get_display_name) = 'TS-269H' ]]; then + printf i53 + return + fi case $NAS_ARCH in x86_64) @@ -8964,14 +8971,14 @@ OsIsAllowUnofficialPackages() OsIsStarting() { - $PS_CMD | $GREP_CMD -F '/bin/sh /etc/init.d/rcS' | $GREP_CMD -v grep + $PS_CMD | $GREP_CMD '/bin/sh /etc/init.d/rcS' | $GREP_CMD -v grep } &> /dev/null OsIsStopping() { - $PS_CMD | $GREP_CMD -F '/bin/sh /etc/init.d/rcK' | $GREP_CMD -v grep + $PS_CMD | $GREP_CMD '/bin/sh /etc/init.d/rcK' | $GREP_CMD -v grep } &> /dev/null @@ -9410,7 +9417,7 @@ _QPKG:install_() fi fi - SendParentChangeEnv "QPKGs-ACsign-to:Add $qpkg_name" + OsIsSupportSignedPackages && SendParentChangeEnv "QPKGs-ACsign-to:Add $qpkg_name" MarkThisAcForkAsOk z=0 # Remap to zero. else @@ -10498,7 +10505,7 @@ _QPKG:status_() a=$(QpkgGetActiveTest) if [[ $a = builtin ]]; then - # Run status query with GNU 'timeout' if-possible. + # Run status query with GNU `timeout` if-possible. if [[ -e $GNU_TIMEOUT_CMD ]]; then $GNU_TIMEOUT_CMD "$QPKG_STATUS_CHECK_TIMEOUT_SECONDS" /bin/bash -c "${b}$(QpkgGetServicePathFile) status" @@ -10514,7 +10521,7 @@ _QPKG:status_() DebugVar z - # returncodes 124 and-up are generated by GNU 'timeout'. + # returncodes 124 and-up are generated by GNU `timeout`. case $z in 0) SendPackageStateChange ISactive @@ -11776,12 +11783,15 @@ QpkgIsMissing() QpkgIsEnabled() { - # Inputs: + # Inputs: (local) # $1 (optional) = QPKG name. - # $qpkg_name (global, default) = target QPKG name. - # Outputs: - # $? = 0 (true), !0 (false). + # Inputs: (global) + # $qpkg_name (default) = target QPKG name. + + # Outputs: (local) + # $? = 0 : true + # $? = !0 : false [[ $(/sbin/getcfg "${1:-${qpkg_name:?${FUNCNAME[0]}'()': undefined package name}}" Enable -u -f /etc/config/qpkg.conf) = TRUE ]] @@ -11792,12 +11802,15 @@ QpkgIsArchOK() # Does an arch-compatible QPKG exist to suit this NAS? - # Inputs: + # Inputs: (local) # $1 (optional) = QPKG name. - # $qpkg_name (global, default) = target QPKG name. - # Outputs: - # $? = 0 (true), !0 (false). + # Inputs: (global) + # $qpkg_name (default) = target QPKG name. + + # Outputs: (local) + # $? = 0 : true + # $? = !0 : false local a=$(QpkgGetURL "${1:-${qpkg_name:?${FUNCNAME[0]}'()': undefined package name}}") @@ -11808,12 +11821,18 @@ QpkgIsArchOK() QpkgIsMinRAMOk() { - # Inputs: + # Does this NAS meets the minimum RAM requirements for QPKG name? + + # Inputs: (local) # $1 (optional) = QPKG name. - # $qpkg_name (global, default) = target QPKG name. - # Outputs: - # $? = 0 if this NAS meets the minium RAM requirements for QPKG name, 1 if not. + # Inputs: (global) + # $NAS_RAM_KB + # $qpkg_name (default) = target QPKG name. + + # Outputs: (local) + # $? = 0 : true + # $? = !0 : false local a=$(QpkgGetMinRAM "${1:-${qpkg_name:?${FUNCNAME[0]}'()': undefined package name}}") @@ -11824,12 +11843,18 @@ QpkgIsMinRAMOk() QpkgIsMinOSVerOk() { - # Inputs: + # Does this NAS meets the minimum OS firmware version requirements for QPKG name? + + # Inputs: (local) # $1 (optional) = QPKG name. - # $qpkg_name (global, default) = target QPKG name. - # Outputs: - # $? = 0 if this NAS meets the minium OS firmware version requirements for QPKG name, 1 if not. + # Inputs: (global) + # $NAS_FIRMWARE_VER + # $qpkg_name (default) = target QPKG name. + + # Outputs: (local) + # $? = 0 : true + # $? = !0 : false local a=$(QpkgGetMinOSVer "${1:-${qpkg_name:?${FUNCNAME[0]}'()': undefined package name}}") @@ -11840,12 +11865,18 @@ QpkgIsMinOSVerOk() QpkgIsMaxOSVerOk() { - # Inputs: + # Does this NAS meets the maximum OS firmware version requirements for QPKG name? + + # Inputs: (local) # $1 (optional) = QPKG name. - # $qpkg_name (global, default) = target QPKG name. - # Outputs: - # $? = 0 if this NAS meets the maximum OS firmware version requirements for QPKG name, 1 if not. + # Inputs: (global) + # $NAS_FIRMWARE_VER + # $qpkg_name (default) = target QPKG name. + + # Outputs: (local) + # $? = 0 : true + # $? = !0 : false local a=$(QpkgGetMaxOSVer "${1:-${qpkg_name:?${FUNCNAME[0]}'()': undefined package name}}") @@ -11858,12 +11889,15 @@ QpkgIsAutoUpdate() # Is the installed QPKG set to auto-update on restart? - # Inputs: + # Inputs: (local) # $1 (optional) = QPKG name. - # $qpkg_name (global, default) = target QPKG name. - # Outputs: - # $? = 0 (true), !0 (false). + # Inputs: (global) + # $qpkg_name (default) = target QPKG name. + + # Outputs: (local) + # $? = 0 : true + # $? = !0 : false [[ $(/sbin/getcfg "${1:-${qpkg_name:?${FUNCNAME[0]}'()': undefined package name}}" Auto_Update -u -f /etc/config/qpkg.conf) = TRUE ]] @@ -11872,6 +11906,10 @@ QpkgIsAutoUpdate() LoadQpkgSigning() { + # Outputs: (global) + # $QPKG_CERTIFICATE + # $QPKG_SIGNATURE + QPKG_CERTIFICATE='' QPKG_SIGNATURE='' @@ -11955,10 +11993,17 @@ EOB MakePath() { - # Inputs: + # Inputs: (local) # $1 = path to create. # $2 = reason for this path. + # Outputs: (local) + # $? : 0 = created OK. + # : 1 = creation failed. + + # Outputs: (global) + # $show_suggest_raise_issue + [[ -n ${1:?${FUNCNAME[0]}'()': undefined path} && -n ${2:?${FUNCNAME[0]}'()': undefined reason} ]] || return if [[ $1 != undefined ]] && ! mkdir -p "$1"; then @@ -11978,7 +12023,7 @@ ClearPath() # Clear (empty) an existing directory, but don't delete the directory. # Delete files in a relatively safe manner. Parent of directory MUST be specified to avoid an 'rm -rf /*' situation through empty args. - # Inputs: + # Inputs: (local) # $1 = full path to parent of directory name to clear. # $2 = directory name to clear. @@ -11996,14 +12041,14 @@ RunAndLog() # Run a commandstring, log the results, and show onscreen if required. - # Inputs: + # Inputs: (local) # $1 = commandstring to execute. # $2 = pathfile to record stdout and stderr for commandstring. - # $3 = `log:failure-only` (optional) - if specified, stdout & stderr are only recorded in the specified log if the command failed. default is to always record stdout & stderr. - # $4 = e.g. `10` (optional) - an additional acceptable result code. Any other non-zero result from command will be considered a failure. + # $3 = 'log:failure-only' (optional) - if specified, stdout & stderr are only recorded in the specified log if the command failed. Default is to always record stdout & stderr. + # $4 = e.g. '10' (optional) - an additional acceptable result code. Any other non-zero result from command will be considered a failure. - # Outputs: - # stdout = commandstring stdout and stderr if script is in `debug` mode. + # Outputs: (local) + # stdout = commandstring stdout and stderr if script is in 'debug' mode. # pathfile (specified as $2) = stdout and stderr from commandstring (specified as $1). # $? = result_code of commandstring. @@ -12061,7 +12106,7 @@ DeDupeWords() FileMatchesMD5() { - # Inputs: + # Inputs: (local) # $1 = pathfile to generate an MD5 checksum for. # $2 = MD5 checksum to compare against. @@ -12146,7 +12191,8 @@ FormatAsThous() # A string-based thousands-group formatter totally unreliant on locale. # Why? Because builtin `printf` in 32b ARM QTS versions doesn't follow locale. ¯\_(ツ)_/¯ - # $1 = integer value + # Inputs: (local) + # $1 = integer value local a=$($SED_CMD 's/[^0-9]*//g' <<< "${1:-}") # Strip everything not a numeral. local b='' @@ -12464,7 +12510,7 @@ DebugDetectTabld() if [[ -z ${3:-} ]]; then # If $3 is nothing, then assume only 2 fields are required. DebugAsDetect "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s\n" "${1:-}" "${2:-}")" - elif [[ ${3:-} = ' ' ]]; then # If $3 is only a whitespace then print $2 with trailing colon and `none` as third field. + elif [[ ${3:-} = ' ' ]]; then # If $3 is only a whitespace then print $2 with trailing colon and 'none' as third field. DebugAsDetect "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: none\n" "${1:-}" "${2:-}")" elif [[ ${3: -1} = ' ' ]]; then # If $3 has a trailing whitespace then print $3 without the trailing whitespace. DebugAsDetect "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: %-s\n" "${1:-}" "${2:-}" "$($SED_CMD 's| *$||' <<< "${3:-}")")" @@ -12481,7 +12527,7 @@ DebugInfoTabld() if [[ -z ${3:-} ]]; then # If $3 is nothing, then assume only 2 fields are required. DebugAsInfo "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s\n" "${1:-}" "${2:-}")" - elif [[ ${3:-} = ' ' ]]; then # If $3 is only a whitespace then print $2 with trailing colon and `none` as third field. + elif [[ ${3:-} = ' ' ]]; then # If $3 is only a whitespace then print $2 with trailing colon and 'none' as third field. DebugAsInfo "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: none\n" "${1:-}" "${2:-}")" elif [[ ${3: -1} = ' ' ]]; then # If $3 has a trailing whitespace then print $3 without the trailing whitespace. DebugAsInfo "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: %-s\n" "${1:-}" "${2:-}" "$($SED_CMD 's| *$||' <<< "${3:-}")")" @@ -12496,11 +12542,11 @@ DebugWarningTabld() # Debug warning tabulated. - if [[ -z ${3:-} ]]; then # if $3 is nothing, then assume only 2 fields are required + if [[ -z ${3:-} ]]; then # If $3 is nothing, then assume only 2 fields are required DebugAsWarn "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s\n" "${1:-}" "${2:-}")" - elif [[ ${3:-} = ' ' ]]; then # if $3 is only a whitespace then print $2 with trailing colon and `none` as third field + elif [[ ${3:-} = ' ' ]]; then # If $3 is only a whitespace then print $2 with trailing colon and 'none' as third field DebugAsWarn "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: none\n" "${1:-}" "${2:-}")" - elif [[ ${3: -1} = ' ' ]]; then # if $3 has a trailing whitespace then print $3 without the trailing whitespace + elif [[ ${3: -1} = ' ' ]]; then # If $3 has a trailing whitespace then print $3 without the trailing whitespace DebugAsWarn "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: %-s\n" "${1:-}" "${2:-}" "$($SED_CMD 's| *$||' <<< "${3:-}")")" else DebugAsWarn "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: %-s\n" "${1:-}" "${2:-}" "${3:-}")" @@ -12515,7 +12561,7 @@ DebugErrorTabld() if [[ -z ${3:-} ]]; then # If $3 is nothing, then assume only 2 fields are required. DebugAsError "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s\n" "${1:-}" "${2:-}")" - elif [[ ${3:-} = ' ' ]]; then # If $3 is only a whitespace then print $2 with trailing colon and `none` as third field. + elif [[ ${3:-} = ' ' ]]; then # If $3 is only a whitespace then print $2 with trailing colon and 'none' as third field. DebugAsError "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: none\n" "${1:-}" "${2:-}")" elif [[ ${3: -1} = ' ' ]]; then # If $3 has a trailing whitespace then print $3 without the trailing whitespace. DebugAsError "$(printf "%${DEBUG_LOG_FIRST_COL_WIDTH}s: %${DEBUG_LOG_SECOND_COL_WIDTH}s: %-s\n" "${1:-}" "${2:-}" "$($SED_CMD 's| *$||' <<< "${3:-}")")" @@ -12567,7 +12613,7 @@ DebugInfo() [[ -n ${1:-} ]] || return - if [[ ${2:-} = ' ' || ${2:-} = "'' " ]]; then # If $2 has no usable content then print $1 with trailing colon and `none` as second field. + if [[ ${2:-} = ' ' || ${2:-} = "'' " ]]; then # If $2 has no usable content then print $1 with trailing colon and 'none' as second field. DebugAsInfo "$1: none" elif [[ -n ${2:-} ]]; then DebugAsInfo "$1: ${2:-}" @@ -12690,7 +12736,7 @@ ConvertSecondsToFullDate() { # Inputs: - # $1 = epoch seconds. + # $1 = Epoch seconds. # Outputs: # stdout = real date. @@ -12703,7 +12749,7 @@ ConvertSecondsToTime() { # Inputs: - # $1 = epoch seconds. + # $1 = Epoch seconds. # Outputs: # stdout = time component only. @@ -12717,8 +12763,8 @@ ConvertSecondsToDuration() # http://stackoverflow.com/questions/12199631/convert-seconds-to-hours-minutes-seconds - # Inputs: - # $1 = a time in seconds to convert to `HHh:MMm:SSs` or, if less than 1 minute, to `S seconds`. + # Inputs: (local) + # $1 = a time in seconds to convert to 'HHh:MMm:SSs' or, if less than 1 minute, to 'S seconds'. ((h=${1:-0}/3600)) ((m=(${1:-0}%3600)/60)) @@ -12743,10 +12789,10 @@ ConvertSecondsToDuration() ConvertMillisecondsToSeconds() { - # Inputs: + # Inputs: (local) # $1 = milliseconds. - # Outputs: + # Outputs: (local) # stdout = seconds. printf '%s' "$(($1/(10**3)))" @@ -12756,8 +12802,8 @@ ConvertMillisecondsToSeconds() ConvertMillisecondsToDuration() { - # Inputs: - # $1 = milliseconds to convert to `HHh:MMm:SSs` or, if less than 1 minute, to `S seconds`. + # Inputs: (local) + # $1 = milliseconds to convert to 'HHh:MMm:SSs' or, if less than 1 minute, to 'S seconds'. ConvertSecondsToDuration "$(ConvertMillisecondsToSeconds "$1")" @@ -12768,7 +12814,7 @@ ConvertMillisecondsToFuncDuration() # NOTE: This formatter is only used by script function timers. - # Inputs: + # Inputs: (local) # $1 = duration in milliseconds. if [[ ${1:-0} -lt 30000 ]]; then @@ -12782,10 +12828,10 @@ ConvertMillisecondsToFuncDuration() ConvertNanosecondsToMilliseconds() { - # Inputs: + # Inputs: (local) # $1 = nanoseconds. - # Outputs: + # Outputs: (local) # stdout = milliseconds. printf '%s' "$(($1/(10**6)))" @@ -12795,7 +12841,7 @@ ConvertNanosecondsToMilliseconds() ConvertNowToFullDate() { - # Outputs: + # Outputs: (local) # stdout = real date. /bin/date +%c | tr -s ' ' @@ -12805,7 +12851,7 @@ ConvertNowToFullDate() ConvertNowToSeconds() { - # Outputs: + # Outputs: (local) # stdout = epoch seconds. /bin/date +%s @@ -12815,7 +12861,7 @@ ConvertNowToSeconds() ConvertNowToMilliseconds() { - # Outputs: + # Outputs: (local) # stdout = epoch milliseconds. ConvertNanosecondsToMilliseconds "$(ConvertNowToNanoseconds)" @@ -12825,7 +12871,7 @@ ConvertNowToMilliseconds() ConvertNowToNanoseconds() { - # Outputs: + # Outputs: (local) # stdout = epoch nanoseconds. /bin/date +%s%N @@ -12835,8 +12881,8 @@ ConvertNowToNanoseconds() FormatAsLongMinutesSecs() { - # Inputs: - # $1 = a time in long minutes and seconds to convert to `MMMm:SSs`. + # Inputs: (local) + # $1 = a time in long minutes and seconds to convert to 'MMMm:SSs'. # separate minutes from seconds local m=${1%%:*} @@ -13128,7 +13174,7 @@ ShowAsPercentProgress() # Inputs: (local) # $1 = verb (present) (optional) - # $2 = expected action duration: `long` (optional) + # $2 = expected action duration: 'long' (optional) # $3 = ok count # $4 = skip count # $5 = fail count @@ -13194,7 +13240,7 @@ ShowAsIterativeProgress() # $3 = suffix1 "iterations" # $4 = count2 560 # $5 = suffix2 "packages" - # $6 = expected action duration: `long` (optional) `short` (default) + # $6 = expected action duration: 'long' (optional) 'short' (default) local -r a=${1:?${FUNCNAME[0]}'()': undefined action} local -i b=${2:-0} @@ -13220,12 +13266,12 @@ ShowAsActionLogDetail() # Inputs: (local) # $1 = datetime in seconds (unused) - # $2 = package or group name `SABnzbd`, `essential` - # $3 = action `download`, 'downloaded' - # $4 = result `ok`, `skipped-ok`, `skipped`, `failed` + # $2 = package or group name 'SABnzbd', 'essential' + # $3 = action 'download', 'downloaded' + # $4 = result 'ok', 'skipped-ok', 'skipped', 'failed' # $5 = duration in milliseconds # $6 = reason (optional) "file already exists in local cache" - # $7 = package type `QPKG`, `IPK`, etc... + # $7 = package type 'QPKG', 'IPK', etc... # $8 = quantity number of packages affected. if [[ ${2:-undefined} = undefined ]]; then @@ -13250,7 +13296,7 @@ ShowAsActionLogDetail() quantity_msg='no ' ;; 1) - : # don't shown 1's. + : # Don't shown 1's. ;; *) quantity_msg="$8 " @@ -13303,7 +13349,7 @@ OpStepClearWait() # Displays script operation message from beginning of line, remain on this line, and leave cursor at end. # Inputs: (local) - # $1 = a 4 character string such as `info`, `proc`, `done`, `derp`. + # $1 = a 4 character string such as 'info', 'proc', 'done', 'derp'. # $2 = detailed message. # Inputs: (global) @@ -13325,7 +13371,7 @@ OpStepClear() # Displays script operation message from beginning of line, jump down a line, and leave cursor at start. # Inputs: (local) - # $1 = a 4 character string such as `info`, `proc`, `done`, `derp`. + # $1 = a 4 character string such as 'info', 'proc', 'done', 'derp'. # $2 = detailed message. # Inputs: (global) diff --git a/workshop/construct-dep-line.sh b/workshop/construct-dep-line.sh deleted file mode 100755 index 249aea6f6..000000000 --- a/workshop/construct-dep-line.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -for a in $(grep '^\[.*\]$' qpkg.conf | sed 's|\[||;s|\]||;/RunLast/d'); do - [[ -n $b ]] && b+=":$a" || b=$a -done - -echo "$b" diff --git a/workshop/ideas.txt b/workshop/ideas.txt index 0b3e1ad84..0cbeb7f15 100644 --- a/workshop/ideas.txt +++ b/workshop/ideas.txt @@ -1,5 +1,3 @@ -* Don't attempt to 'sign' QPKGs after install on unsupported firmware (<4.3.5) - * Check OOM killed pids against inactive daemons and report as-such on status report. * Takes 3.5 to 6 seconds to build QPKG states on Laura.