Skip to content

Commit

Permalink
[merge] from unstable into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
OneCDOnly committed Oct 3, 2024
2 parents 844d994 + de469f7 commit 5b07cfa
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 44 deletions.
Binary file modified objects.tar.gz
Binary file not shown.
Binary file modified sherpa-manager.tar.gz
Binary file not shown.
86 changes: 42 additions & 44 deletions support/sherpa-manager.source
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ DebugLogInit()
DebugInfoMinSepr
DebugVar r_this_package_ver
DebugVar r_this_script_ver
DebugVar LOADER_SCRIPT_VERSION

}

Expand Down Expand Up @@ -812,9 +811,9 @@ DebugLogEnv()
fi

if OsIsCompatibleWithSigned; then
DebugFirmware ok 'build date' "$r_nas_firmware_date"
DebugFirmware ok 'build date' "$(ConvertDateTimeAutoExpand "$r_nas_firmware_date")"
else
DebugFirmware warning 'build date' "$r_nas_firmware_date"
DebugFirmware warning 'build date' "$(ConvertDateTimeAutoExpand "$r_nas_firmware_date")"
fi

DebugFirmware ok platform "$r_nas_platform"
Expand Down Expand Up @@ -869,9 +868,8 @@ DebugLogEnv()
# fi

DebugScript 'QPKG version' "$(ConvertDateTimeAutoExpand "$r_this_package_ver")"
DebugScript 'manager epoch' "$(ConvertDateTimeAutoExpand "$r_this_script_epoch")"
DebugScript 'manager version' "$r_this_script_ver"
DebugScript 'loader version' "$(ConvertDateTimeAutoExpand "${LOADER_SCRIPT_VERSION:=undefined}")"
DebugScript 'manager epoch' "$(ConvertDateTimeAutoExpand "$r_this_script_epoch")"
DebugScript 'objects epoch' "$(ConvertDateTimeAutoExpand "${r_objects_epoch:-not loaded}")"
DebugScript 'packages epoch' "$(ConvertDateTimeAutoExpand "${r_packages_epoch:-not loaded}")"
DebugScript 'logs path' "$r_logs_path"
Expand Down Expand Up @@ -899,7 +897,7 @@ DebugLogEnv()

DebugQpkg detect architecture "$r_nas_qpkg_arch"
DebugQpkg detect "$(ShowAsPackageName Entware) type" "$r_entware_type"
DebugQpkg detect "$(ShowAsPackageName Entware) install date" "$(QpkgGetInstalledDate Entware)"
DebugQpkg detect "$(ShowAsPackageName Entware) install date" "$(ConvertDateTimeAutoExpand "$(QpkgGetInstalledDate Entware)")"

if QpkgIsReallyInstalled SortMyQPKGs; then
DebugQpkg detect "$(ShowAsPackageName SortMyQPKGs)" installed
Expand Down Expand Up @@ -5786,7 +5784,7 @@ GenerateFeaturesReportTitleLine()
printf "%-$((r_report_qpkg_active_test_builtin_column_width+2+$(LenANSIDiff "$a")))s" "$a"

# column 7: package is independent?
a='Indep?'
a='Independent?'
printf "%-$((r_report_qpkg_tier_column_width+2+$(LenANSIDiff "$a")))s" "$a"

# column 8: NAS arch is compatible?
Expand Down Expand Up @@ -5816,14 +5814,16 @@ GenerateFeaturesReportDataLine()

local active_test=false
local active_test_msg=$r_chars_blank
local arch_compatible=false
local arch_compatible_msg=$r_chars_blank
local autoupdate=false # Tri-state: true, false, N/A
local autoupdate_msg=$r_chars_blank
local backup=false
local backup_msg=$r_chars_blank
local clean=false
local clean_msg=$r_chars_blank
local arch_compatible=false
local arch_compatible_msg=$r_chars_blank
local independent=false
local independent_msg=$r_chars_blank
local mode=''
local name_msg=$r_chars_blank
local req_alert=false
Expand All @@ -5832,8 +5832,6 @@ GenerateFeaturesReportDataLine()
local restart_to_update_msg=$r_chars_blank
local sherpa_compatible=false
local sherpa_compatible_msg=$r_chars_blank
local tier=false
local tier_msg=$r_chars_blank
local uniqueunpack=false
local uniqueunpack_msg=$r_chars_blank

Expand Down Expand Up @@ -5872,35 +5870,35 @@ GenerateFeaturesReportDataLine()
mute)
# Set field values.
active_test=N/A
arch_compatible=N/A
autoupdate=N/A
backup=N/A
clean=N/A
arch_compatible=N/A
independent=N/A
restart_to_update=N/A
sherpa_compatible=N/A
tier=N/A
uniqueunpack=N/A

# Assign field messages.
active_test_msg+=$active_test
arch_compatible_msg+=$arch_compatible
autoupdate_msg+=$autoupdate
backup_msg+=$backup
clean_msg+=$clean
arch_compatible_msg+=$arch_compatible
independent_msg+=$independent
restart_to_update_msg+=$restart_to_update
sherpa_compatible_msg+=$sherpa_compatible
tier_msg+=$tier
uniqueunpack_msg+=$uniqueunpack

# Highlight field messages.
active_test_msg=$(TextDarkGrey "$active_test_msg")
arch_compatible_msg=$(TextDarkGrey "$arch_compatible_msg")
autoupdate_msg=$(TextDarkGrey "$autoupdate_msg")
backup_msg=$(TextDarkGrey "$backup_msg")
clean_msg=$(TextDarkGrey "$clean_msg")
arch_compatible_msg=$(TextDarkGrey "$arch_compatible_msg")
independent_msg=$(TextDarkGrey "$independent_msg")
restart_to_update_msg=$(TextDarkGrey "$restart_to_update_msg")
sherpa_compatible_msg=$(TextDarkGrey "$sherpa_compatible_msg")
tier_msg=$(TextDarkGrey "$tier_msg")
uniqueunpack_msg=$(TextDarkGrey "$uniqueunpack_msg")
;;
normal)
Expand Down Expand Up @@ -5929,18 +5927,18 @@ GenerateFeaturesReportDataLine()
fi

QpkgIsDatabaseSherpaCompatible && sherpa_compatible=true
QpkgIsDatabaseIndependent && tier=true
QpkgIsDatabaseIndependent && independent=true
QpkgIsDatabaseUniqueUnpack && uniqueunpack=true

# Assign field messages.
active_test_msg+=$active_test
arch_compatible_msg+=$arch_compatible
autoupdate_msg+=$autoupdate
backup_msg+=$backup
clean_msg+=$clean
arch_compatible_msg+=$arch_compatible
independent_msg+=$independent
restart_to_update_msg+=$restart_to_update
sherpa_compatible_msg+=$sherpa_compatible
tier_msg+=$tier
uniqueunpack_msg+=$uniqueunpack

# Highlight field messages.
Expand Down Expand Up @@ -5992,6 +5990,12 @@ GenerateFeaturesReportDataLine()
else
uniqueunpack_msg=$(TextBrightOrange "$uniqueunpack_msg")
fi

if [[ $independent = true ]]; then
: # independent_msg=$(TextBrightGreen "$independent_msg")
else
independent_msg=$(TextBrightOrange "$independent_msg")
fi
esac

if [[ $req_alert = true ]]; then
Expand All @@ -6007,7 +6011,7 @@ GenerateFeaturesReportDataLine()
fi

if OsIsSupportAutowidthTableColumns; then
echo "$name_msg|$backup_msg|$clean_msg|$restart_to_update_msg|$autoupdate_msg|$active_test_msg|$tier_msg|$arch_compatible_msg|$sherpa_compatible_msg|$uniqueunpack_msg"
echo "$name_msg|$backup_msg|$clean_msg|$restart_to_update_msg|$autoupdate_msg|$active_test_msg|$independent_msg|$arch_compatible_msg|$sherpa_compatible_msg|$uniqueunpack_msg"
else
# column 1: package name.
printf "%-$((r_report_qpkg_name_column_width+$(LenANSIDiff "$name_msg")))s" "$name_msg"
Expand All @@ -6034,7 +6038,7 @@ GenerateFeaturesReportDataLine()

# column 7: package is independent?
printf "%$((r_report_column_spacing))s"
printf "%-$((r_report_qpkg_tier_column_width+$(LenANSIDiff "$tier_msg")))s" "$tier_msg"
printf "%-$((r_report_qpkg_tier_column_width+$(LenANSIDiff "$independent_msg")))s" "$independent_msg"

# column 8: NAS arch is compatible?
printf "%$((r_report_column_spacing))s"
Expand Down Expand Up @@ -7895,7 +7899,7 @@ ShowReportFeatures()
ResetReportsPath &> /dev/null

if OsIsSupportAutowidthTableColumns; then
printf -v a '\n%s\n' 'QPKG name:|CanBack?|CanClean?|StartUpd?|AutoUpd?|LiveTest?|Indep?|ArchCompat?|Enhanced?|UniqueUnpack?'
printf -v a '\n%s\n' 'QPKG name:|CanBack?|CanClean?|StartUpd?|AutoUpd?|LiveTest?|Independent?|ArchCompat?|Enhanced?|UniqueUnpack?'
else
printf -v a '\n%s\n' "$(GenerateFeaturesReportTitleLine)"
fi
Expand Down Expand Up @@ -8413,7 +8417,7 @@ GenerateReportHeadingsFooter()
DisplayAsIndentQuotedInfoItem 'StartUpd?' 'application restart-to-update is supported'
DisplayAsIndentQuotedInfoItem 'AutoUpd?' 'application restart-to-update is enabled'
DisplayAsIndentQuotedInfoItem 'LiveTest?' "has a built-in 'status' check, and can test for daemon live status"
DisplayAsIndentQuotedInfoItem 'Indep?' 'is independent of other QPKGs'
DisplayAsIndentQuotedInfoItem 'Independent?' 'is independent of other QPKGs'
DisplayAsIndentQuotedInfoItem 'ArchCompat?' 'has a release compatible with this NAS architecture'
DisplayAsIndentQuotedInfoItem 'Enhanced?' "$(ShowAsTitleName) enhanced service actions are supported"
DisplayAsIndentQuotedInfoItem 'UniqueUnpack?' 'QPKG unpacks itself to a unique path'
Expand Down Expand Up @@ -8452,7 +8456,6 @@ ShowVersionsList()

Display "QPKG: $(ConvertDateTimeAutoExpand "$r_this_package_ver")"
Display "manager: $(ConvertDateTimeAutoExpand "$r_this_script_epoch")"
Display "loader: $(ConvertDateTimeAutoExpand "${LOADER_SCRIPT_VERSION:=undefined}")"
Display "objects: $(ConvertDateTimeAutoExpand "${r_objects_epoch:-not loaded}")"
Display "packages: $(ConvertDateTimeAutoExpand "${r_packages_epoch:-not loaded}")"

Expand Down Expand Up @@ -12783,7 +12786,7 @@ FormatAsThous()
# Inputs: (local)
# $1 = integer value

local a=$($SED_CMD 's/[^0-9]*//g' <<< "${1:-}") # Strip non-numerals.
local a=$($SED_CMD 's/[^0-9]*//g' <<< "${1:-}") # Strip non-digits.
local b=''
local c=''

Expand Down Expand Up @@ -13425,7 +13428,7 @@ ConvertSecondsToDatecode()

[[ -n ${1:-} ]] || return

local a=$($SED_CMD 's/[^0-9]*//g' <<< "${1:-}") # Strip non-numerals.
local a=$($SED_CMD 's/[^0-9]*//g' <<< "${1:-}") # Strip non-digits.

if [[ ${#a} -ne 10 ]]; then
printf 000000
Expand Down Expand Up @@ -13535,36 +13538,31 @@ ConvertDateTimeAutoExpand()
# Convert a datecode or epoch time to an extended date format, or a full date format for epoch time.

# Inputs: (local)
# $1 = datecode in the format 'YYMMDD'. Example: '240928'
# $1 = epoch time. Example: '1234567890'. Since 9th September 2001, epoch time has-been 10 numerals and will remain-so until 21st November 2286.
# $1 = datecode in the format 'YYMMDD'. Example: '240928' with 6 digits.
# $1 = longdatecode in the format 'YYYYMMDD'. Example: '20240928' with 8 digits.
# $1 = epoch time. Example: '1234567890'. Since 9th September 2001, epoch time has-been 10 digits and will remain-so until 21st November 2286.

# Outputs: (local)
# stdout = formatted datetime string.

[[ -n ${1:-} ]] || return

local a=$($SED_CMD 's/[^0-9]*//g' <<< "$1") # Strip non-numerals.
local a=$($SED_CMD 's/[^0-9]*//g' <<< "$1") # Strip non-digits.
local b=''
local c=''

case ${#a} in
6) # Assume input is a datecode, so convert to extended date format.
b=extended
6) # Assume input is datecode, so convert to extended date format.
b=$(/bin/date -d ${a::2}-${a:2:2}-${a:4:2} '+%a %d %b %Y') # (shortdayname, daynum, monthname, shortyearnum)
;;
10) # Assume input is epoch time, so convert to full date format.
b=full
esac

case $b in
extended)
c=$(/bin/date -d ${a::2}-${a:2:2}-${a:4:2} '+%a %d %b %Y') # (shortdayname, daynum, monthname, shortyearnum)
8) # Assume input is longdatecode, so convert to extended date format.
b=$(/bin/date -d ${a::4}-${a:4:2}-${a:6:2} '+%a %d %b %Y') # (shortdayname, daynum, monthname, shortyearnum)
;;
full)
c=$(/bin/date -d @"$a" +%c | tr -s ' ') # (shortdayname, daynum, monthname, yearnum, time, TZname) TODO: hardcode this format instead of relying on the locale default '%c'.
10) # Assume input is epoch time, so convert to full date format.
b=$(/bin/date -d @"$a" +%c | tr -s ' ') # (shortdayname, daynum, monthname, yearnum, time, TZname) TODO: hardcode this format instead of relying on the locale default '%c'.
esac

if [[ -n $c ]]; then
printf '%s (%s)' "$a" "$c"
if [[ -n $b ]]; then
printf '%s (%s)' "$1" "$b"
else
printf '%s' "$1"
fi
Expand Down
2 changes: 2 additions & 0 deletions workshop/ideas.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Add translated datetimes to service script versions.

* Put 'sherpa about' display into a report window.

* Check OOM killed pids against inactive daemons and report as-such on status report.
Expand Down

0 comments on commit 5b07cfa

Please sign in to comment.