diff --git a/objects.tar.gz b/objects.tar.gz index d1cfb5430..97eaa5a44 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 202179027..a84a73163 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 81a2f215f..9af86f1cf 100755 --- a/support/sherpa-manager.source +++ b/support/sherpa-manager.source @@ -26,7 +26,7 @@ # list "object" tests: 'Capitalised-CamelCase-With-Inline-Hyphens-And-Period-Before.Test' # "object" properties: '_lowercase_with_leading_and_inline_and_trailing_underscores_' (these should be managed ONLY by the object's methods) # constants: 'UPPERCASE_WITH_INLINE_UNDERSCORES' (and set as readonly) -# indents: 1 x tab char (=4 space chars) +# indents: 1 x tab char (= 4 space chars) # # Notes: # If on-screen line-spacing is required, this should only be done by the next function to print output. @@ -38,7 +38,7 @@ shopt -s extglob ln -fns /proc/self/fd /dev/fd # KLUDGE: `/dev/fd` isn't always created by QTS. trap CaughtSIGINT SIGINT -trap CaughtExit EXIT +trap CaughtEXIT EXIT readonly ARGS_RAW=$* readonly SCRIPT_STARTSECONDS=$(/bin/date +%s) @@ -610,13 +610,13 @@ LoadEnv() readonly IPK_CACHE_PATH=$CACHE_PATH/IPKs readonly IPK_DL_PATH=$IPK_CACHE_PATH/downloads readonly IPK_DOWNGRADE_PATH=$IPK_CACHE_PATH/downgrade + readonly PREV_IPK_LIST=$IPK_CACHE_PATH/ipk.list.save readonly PIP_CACHE_PATH=$CACHE_PATH/PIPs + readonly PREV_PIP_LIST=$PIP_CACHE_PATH/pip.list.save readonly OBJECTS_ARCHIVE_PATHFILE=$CACHE_PATH/objects.tar.gz readonly OBJECTS_PATHFILE=$CACHE_PATH/objects readonly PACKAGES_ARCHIVE_PATHFILE=$CACHE_PATH/packages.tar.gz readonly PACKAGES_PATHFILE=$CACHE_PATH/packages - readonly PREV_IPK_LIST=$CACHE_PATH/ipk.list.save - readonly PREV_PIP_LIST=$CACHE_PATH/pip.list.save readonly QPKG_CACHE_PATH=$CACHE_PATH/QPKGs readonly QPKG_DL_PATH=$QPKG_CACHE_PATH/downloads readonly LOGS_PATH=$THIS_PACKAGE_PATH/logs @@ -1075,7 +1075,7 @@ QPKGsAssignToActions() # Install independents are installed when processing these specific actions: - for qpkg_name in $(QPKGs-ACinstall-to:Array); do + for qpkg_name in $(QPKGs-ACinstall-to:Array) $(QPKGs-ACreinstall-to:Array); do QpkgSetIndex for prospect in $(QpkgGetDependencies); do @@ -1687,12 +1687,12 @@ AdjustMaxForks() reason='debug mode is active' else case ${1:-} in - clean) # Precautionary: don't make too-many calls to PyPI at the same time. - max_forks=$(((max_forks+1)/2)) + ?(re)install|upgrade) # Don't execute these actions async: installer for each package eventually aborts (QPKGs can only be managed one-at-a-time, else packages overwrite each other, and package source files end-up in the wrong install paths). + max_forks=1 reason="'$1'" ;; - @(in|re)stall|upgrade) # Don't execute these actions async: installer for each package eventually aborts (QPKGs can only be managed one-at-a-time, else packages overwrite each other, and package source files end-up in the wrong install paths). - max_forks=1 + clean) # Precautionary: don't make too-many calls to PyPI at the same time. + max_forks=$(((max_forks+1)/2)) reason="'$1'" ;; backup|deactivate|download|uninstall) # Low-resource actions, so allow multiple forks, even on ARMv5. @@ -3847,7 +3847,7 @@ _DirSizeMonitor_() [[ ! -e $DISPLAY_INHIBIT_PATHFILE ]] || return WriteMsgInPlace "$progress_msg" - sleep .5 + sleep 1 done [[ -n $progress_msg ]] && WriteMsgInPlace 'done!' @@ -13412,7 +13412,7 @@ CaughtSIGINT() } -CaughtExit() +CaughtEXIT() { trap - EXIT diff --git a/workshop/ideas.txt b/workshop/ideas.txt index f4e3be704..7ef813822 100644 --- a/workshop/ideas.txt +++ b/workshop/ideas.txt @@ -1,3 +1,8 @@ +* Make last action result a separate status report column? + - Should also include the attempted action. + +* Need service-script type templates instead of group variable sets. + * 'install'/'reinstall'/'upgrade' should check path QPKG is installed or is to-be installed to. - If it starts with /root - abort. @@ -12,8 +17,6 @@ * 'status' report: show new QPKG application version alongside current application version? - Not sure about this. Installed application version is not stored. Maybe just display new version? -* Service-scripts should shown current QPKG enabled state. - * Report column headings in bright white? * Include QPKG version numbers in progress messages? @@ -28,9 +31,6 @@ * 'show results' report should include completion and elapsed times. -* Make last action result a separate status report column? - - Should also include the attempted action. - * Test for bash version and interpreter location? * Try each user arg as an action (verb). diff --git a/workshop/issues.txt b/workshop/issues.txt index f53a050e0..441f0ee60 100644 --- a/workshop/issues.txt +++ b/workshop/issues.txt @@ -1,5 +1,13 @@ Observed issues: + * Takes 3.5 to 6 seconds to build QPKG states on Laura. + - Should be able to do this quicker. + - Calculate QPKG features separate to states and cache/load these from file next time? + + * Applications sourced online are not updating (e.g. Tautulli). + - Had to 'clean' it to get latest version pulled. + - Forgot to check: was auto-update disabled? + * Default dependency report should only show installed QPKGs. - ... but should allow 'sherpa d all' to see all QPKGs. - Do the same for repository report. @@ -14,49 +22,6 @@ Observed issues: * Results report wording should account for single QPKG actions. - Don't pluralise "package actions" when there was only one. - * x86 (Sarah) is writing files into /root/.cache - ------------------------------------------------------------------------------------------------------------------------- - [~] # du -h .cache/ - 36K .cache/pip/http-v2/a/1/9/5/3 - 37K .cache/pip/http-v2/a/1/9/5 - 38K .cache/pip/http-v2/a/1/9 - 39K .cache/pip/http-v2/a/1 - 40K .cache/pip/http-v2/a - 34K .cache/pip/http-v2/d/8/7/b/2 - 35K .cache/pip/http-v2/d/8/7/b - 36K .cache/pip/http-v2/d/8/7 - 37K .cache/pip/http-v2/d/8 - 38K .cache/pip/http-v2/d - 48K .cache/pip/http-v2/e/1/3/7/4 - 49K .cache/pip/http-v2/e/1/3/7 - 50K .cache/pip/http-v2/e/1/3 - 51K .cache/pip/http-v2/e/1 - 52K .cache/pip/http-v2/e - 26K .cache/pip/http-v2/0/1/a/4/0 - 27K .cache/pip/http-v2/0/1/a/4 - 28K .cache/pip/http-v2/0/1/a - 29K .cache/pip/http-v2/0/1 - 30K .cache/pip/http-v2/0 - 8.0K .cache/pip/http-v2/8/7/c/c/0 - 9.0K .cache/pip/http-v2/8/7/c/c - 10K .cache/pip/http-v2/8/7/c - 11K .cache/pip/http-v2/8/7 - 12K .cache/pip/http-v2/8 - 173K .cache/pip/http-v2 - 2.0K .cache/pip/selfcheck - 176K .cache/pip - 177K .cache/ - ------------------------------------------------------------------------------------------------------------------------- - - Narrowed this down to WebSSH. - - Doesn't happen on aarch64 (Laura). - - * Takes ~3.5 - 6 seconds to build QPKG states on Laura. - - Should be able to do this quicker. - - Calculate QPKG features separate to states and cache/load these from file next time? - - * Python module cleaner in service library functions is removing PyPI packages with a partial name match. - - Must be changed to an exact match. - * 'sherpa' and 'opkg' were not available after installing Entware. - Entware installation may be corrupt. - But this shouldn't affect the sherpa command `/usr/sbin/sherpa`. @@ -83,7 +48,7 @@ Observed issues: * Upgrading QPKGs via sherpa didn't update App Center icons 'live'. * Near the end of installing IPKs, monitored download path can remain at non-zero size while packages complete installation. - - Include a separate progress message when dir size shrinks? + - Include a separate progress message when dir size shrinks? Maybe force increase to "100%" and stop monitoring? * QPKG version sort is not correctly sorting version numbers followed by an alpha as later than non-alpha. diff --git a/workshop/type1.template.source b/workshop/type1.template.source new file mode 100644 index 000000000..a1a61d6c7 --- /dev/null +++ b/workshop/type1.template.source @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +#* +# +#* +# +#* +# +#* +# +#* +# +#* + +readonly USER_ARGS_RAW=$* +readonly QPKG_NAME=Headphones +readonly SERVICE_SCRIPT_VERSION='' +readonly SERVICE_SCRIPT_TYPE=1 + +InitService() + { + + # default values + allow_access_to_sys_packages=true + app_version_cmd=undefined + app_version_pathfile=undefined + daemon_pid_pathfile=/var/run/$QPKG_NAME.pid + daemon_port=0 + get_daemon_port_cmd=undefined + install_pip_deps=true + interpreter=/opt/bin/python3 + launcher_pathfile=undefined # On-demand executables only. + local_temp_path=undefined + nice_daemon_to=0 # If non-zero, daemon proc is niced to this value on-launch. + orig_daemon_service_script=undefined # Specific to Entware binaries only. + pidfile_is_managed_by_app=true + pip_cache_path=$QPKG_PATH/pip-cache + qpkg_backup_pathfile=$BACKUP_PATH/$QPKG_NAME.config.tar.gz + qpkg_ini_file=config.ini + qpkg_ini_pathfile=$QPKG_CONFIG_PATH/$qpkg_ini_file + qpkg_ini_default_pathfile=$qpkg_ini_pathfile.def + qpkg_repo_path=$QPKG_PATH/repo-cache + recheck_daemon_pid_after_launch=true # If true, application PID is reconfirmed shortly after initial launch. Some applications launch with one PID, then switch to another. + recheck_daemon_pid_after_kill=false # If true, application PID is reconfirmed shortly after kill confirmed. Some applications kill their main PID, then switch to another during shutdown. + remote_arch=undefined + remote_url=undefined + resolve_remote_url=false # If 'true', URL must be retrieved from remote first, then parsed to get final URL. + run_daemon_in_screen_session=false + service_operation=unspecified + service_result=undefined + silence_pypi_errors=true # If true, PyPI package processing errors won't be shown in system log. + source_arch=undefined + source_archive_pathfile=undefined + source_git_branch=master + source_git_branch_depth=shallow # 'shallow' (depth 1) or 'single-branch' ... 'shallow' implies 'single-branch'. + source_git_url=https://github.com/rembo10/headphones.git + ui_listening_address=undefined + ui_port=0 + ui_port_secure=0 + userlink_pathfile=undefined # On-demand executables only. + venv_path=$QPKG_PATH/venv + venv_pip_pathfile=$venv_path/bin/pip + venv_python_pathfile=$venv_path/bin/python3 + + daemon_launch_cmd="$venv_python_pathfile $daemon_pathfile --daemon --nolaunch --datadir $(/usr/bin/dirname "$qpkg_ini_pathfile") --config $qpkg_ini_pathfile --pidfile $daemon_pid_pathfile" daemon_pathfile=$qpkg_repo_path/Headphones.py + + get_ui_listening_address_cmd="/sbin/getcfg General web_host -d undefined -f $qpkg_ini_pathfile" + get_ui_port_cmd="/sbin/getcfg General web_port -d 0 -f $qpkg_ini_pathfile" + get_ui_port_secure_cmd="/sbin/getcfg General web_port -d 0 -f $qpkg_ini_pathfile" + get_ui_port_secure_enabled_test_cmd='[[ $(/sbin/getcfg General enable_https -d 0 -f '$qpkg_ini_pathfile') = 1 ]]' + + if [[ -e $qpkg_ini_default_pathfile ]]; then + /sbin/setcfg General log_dir "$QPKG_CONFIG_PATH"/logs -f "$qpkg_ini_default_pathfile" + /sbin/setcfg General cache_dir "$QPKG_CONFIG_PATH"/cache -f "$qpkg_ini_default_pathfile" + fi + + if [[ -e $qpkg_ini_pathfile ]]; then + /sbin/setcfg General log_dir "$QPKG_CONFIG_PATH"/logs -f "$qpkg_ini_pathfile" + /sbin/setcfg General cache_dir "$QPKG_CONFIG_PATH"/cache -f "$qpkg_ini_pathfile" + fi + + } + +library_path=$(/usr/bin/readlink "$0" 2>/dev/null) +[[ -z $library_path ]] && library_path=$0 +readonly SERVICE_LIBRARY_PATHFILE=$(/usr/bin/dirname "$library_path")/service.lib + +if [[ -e $SERVICE_LIBRARY_PATHFILE ]]; then + . $SERVICE_LIBRARY_PATHFILE +else + printf '\033[1;31m%s\033[0m: %s\n' 'derp' "QPKG service function library not found, can't continue." + exit 1 +fi + +ProcessArgs