From f0c8013a8d320ddcd8aea52b80c4684a1c8eff7e Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Wed, 10 May 2023 12:28:44 -0600 Subject: [PATCH 01/17] Provide better output on toltecctl uninstall Provide output right at the end if a removal fails due to a preremove script. That way, the user can double-check the output to see if there is something bad. For example, kernelctl failed to revert to the stock kernel. --- package/toltec-bootstrap/toltecctl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index 2480d6eee..b30056cbd 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -335,10 +335,15 @@ uninstall() { fi chmod u+x "$opkg_path" - + + clean=true # Remove installed packages in reverse dependency order list-installed-ordered | while read -r pkgname; do - "$opkg_path" remove --force-depends --force-remove "$pkgname" + if ! "$opkg_path" remove --force-depends "$pkgname"; then + echo "Failed to remove $pkgname, forcing removal..." + "$opkg_path" remove --force-depends --force-remove "$pkgname" + clean=false + fi done systemctl daemon-reload @@ -356,6 +361,13 @@ uninstall() { # Re-enable xochitl if needed systemctl enable xochitl + + if ! $clean; then + echo "Warning: There were errors removing some of the toltec packages." + echo " Your system may be in a broken state. Please review the logs" + echo " before rebooting your device. If you need assistance, you can" + echo " get help on the community discord channel." + fi } help() { From 71c546215360757c62d05f0be3c533086597cabc Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Wed, 10 May 2023 12:33:02 -0600 Subject: [PATCH 02/17] Update version --- package/toltec-bootstrap/package | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/toltec-bootstrap/package b/package/toltec-bootstrap/package index a07acf822..7311a9403 100644 --- a/package/toltec-bootstrap/package +++ b/package/toltec-bootstrap/package @@ -5,8 +5,8 @@ pkgnames=(toltec-bootstrap) pkgdesc="Manage your Toltec install" url=https://toltec-dev.org/ -pkgver=0.2.2-1 -timestamp=2022-02-28T00:12Z +pkgver=0.2.3-1 +timestamp=2023-05-10T18:31Z section="utils" maintainer="Eeems " license=MIT From 46ab86b3326172b13de2f7118847c932c9c1bf71 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Wed, 10 May 2023 12:35:26 -0600 Subject: [PATCH 03/17] Remove extra whitespace left by the github editor --- package/toltec-bootstrap/toltecctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index b30056cbd..80f861e72 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -335,7 +335,7 @@ uninstall() { fi chmod u+x "$opkg_path" - + clean=true # Remove installed packages in reverse dependency order list-installed-ordered | while read -r pkgname; do @@ -361,7 +361,7 @@ uninstall() { # Re-enable xochitl if needed systemctl enable xochitl - + if ! $clean; then echo "Warning: There were errors removing some of the toltec packages." echo " Your system may be in a broken state. Please review the logs" From 99fb2f64491c3aa7f234c1746bb5fb40d0ec152c Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Wed, 10 May 2023 12:37:03 -0600 Subject: [PATCH 04/17] Make variable local --- package/toltec-bootstrap/toltecctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index 80f861e72..7ca3f627c 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -336,7 +336,7 @@ uninstall() { chmod u+x "$opkg_path" - clean=true + local clean=true # Remove installed packages in reverse dependency order list-installed-ordered | while read -r pkgname; do if ! "$opkg_path" remove --force-depends "$pkgname"; then From c3dba5267b1c2e3cec785f2c0e64b2228c3e108a Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Wed, 10 May 2023 12:46:36 -0600 Subject: [PATCH 05/17] No longer use a subshell --- package/toltec-bootstrap/toltecctl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index 7ca3f627c..3335dd9b3 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -338,13 +338,15 @@ uninstall() { local clean=true # Remove installed packages in reverse dependency order - list-installed-ordered | while read -r pkgname; do + while read -r pkgname; do if ! "$opkg_path" remove --force-depends "$pkgname"; then echo "Failed to remove $pkgname, forcing removal..." "$opkg_path" remove --force-depends --force-remove "$pkgname" clean=false fi - done + done << EOF +$(list-installed-ordered) +EOF systemctl daemon-reload rm -f "$opkg_path" From 325cd4d8d77e07ac38931ea6375614890587b61f Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 26 Nov 2023 17:30:14 -0700 Subject: [PATCH 06/17] Fix toltec-bootstrap version --- package/toltec-bootstrap/package | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/toltec-bootstrap/package b/package/toltec-bootstrap/package index e5f188914..c6fa75477 100644 --- a/package/toltec-bootstrap/package +++ b/package/toltec-bootstrap/package @@ -5,7 +5,7 @@ pkgnames=(toltec-bootstrap) pkgdesc="Manage your Toltec install" url=https://toltec-dev.org/ -pkgver=0.2.3-2 +pkgver=0.2.4-1 timestamp=2023-09-17T17:35Z section="utils" maintainer="Eeems " From 94af3c30d9d54a8d31473b7cac6f8ef6a7d0b03e Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 12:52:49 -0600 Subject: [PATCH 07/17] Add missing dependency to launcherctl --- package/launcherctl/launcherctl | 2 +- package/launcherctl/package | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package/launcherctl/launcherctl b/package/launcherctl/launcherctl index ff87e6a0f..4a1850f47 100755 --- a/package/launcherctl/launcherctl +++ b/package/launcherctl/launcherctl @@ -22,7 +22,7 @@ help() { } data_dir="/opt/share/launcherctl" launchers() { - /opt/bin/find "$data_dir" -type f -perm '-u+x' | xargs -rn1 basename + /opt/libexec/find-gnu "$data_dir" -type f -perm '-u+x' | xargs -rn1 basename } active_launchers() { launchers | while read -r launcher; do diff --git a/package/launcherctl/package b/package/launcherctl/package index 7a7743845..a0e60536c 100644 --- a/package/launcherctl/package +++ b/package/launcherctl/package @@ -5,11 +5,12 @@ pkgnames=(launcherctl) pkgdesc="Manage your installed launcher" url=https://toltec-dev.org/ -pkgver=0.0.1-2 +pkgver=0.0.2-2 timestamp=2023-12-18T03:32Z section="launcher" maintainer="Eeems " license=MIT +installdepends=('findutils') source=( launcherctl From ea598525e8c6f1ac7c40525aa66437a6b5bdce58 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 12:55:03 -0600 Subject: [PATCH 08/17] Bump toltec-bootstrap version --- package/toltec-bootstrap/package | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/toltec-bootstrap/package b/package/toltec-bootstrap/package index cc1d68274..90d201f50 100644 --- a/package/toltec-bootstrap/package +++ b/package/toltec-bootstrap/package @@ -5,7 +5,7 @@ pkgnames=(toltec-bootstrap) pkgdesc="Manage your Toltec install" url=https://toltec-dev.org/ -pkgver=0.4.4-1 +pkgver=0.4.5-1 timestamp=2024-05-31T19:13Z section="utils" maintainer="Eeems " From fcedcd4141ea2cd8f9b006b52fcaece438a3783e Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 13:04:00 -0600 Subject: [PATCH 09/17] Force launcherctl to uninstall before xochitl --- package/launcherctl/package | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/launcherctl/package b/package/launcherctl/package index a0e60536c..c9f8d9c8c 100644 --- a/package/launcherctl/package +++ b/package/launcherctl/package @@ -10,7 +10,7 @@ timestamp=2023-12-18T03:32Z section="launcher" maintainer="Eeems " license=MIT -installdepends=('findutils') +installdepends=('findutils' 'xochitl') source=( launcherctl From 2645de98f9bb4c55f1a9c3dd1ac2199195a853dd Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 13:47:02 -0600 Subject: [PATCH 10/17] Make uninstall way more fault tolerant, and report better errors --- package/toltec-bootstrap/toltecctl | 121 ++++++++++++++++++++++------- 1 file changed, 94 insertions(+), 27 deletions(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index e2c267539..a24cac2e6 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -4,6 +4,9 @@ set -euo pipefail +# Path to this script +toltecctl_path=$(realpath "$0") + # Path where Toltec resides (will be mounted to $toltec_dest) toltec_src=/home/root/.entware @@ -15,7 +18,7 @@ toltec_share=/home/root/.local/share/toltec # Path to static opkg build opkg_path=/home/root/.local/bin/opkg # Path to opkg install status file -opkg_status="/opt/lib/opkg/status" +opkg_status="$toltec_dest/lib/opkg/status" # Path to Opkg configuration opkg_conf="$toltec_src"/etc/opkg.conf @@ -123,7 +126,7 @@ get-release-version() { # 3 - unable to install standalone wget check-version() { local wget - if [[ "$(install-state)" != "yes" ]] || [[ "$(command -v wget)" != "/opt/bin/wget" ]]; then + if [[ "$(install-state)" != "yes" ]] || [[ "$(command -v wget)" != "$toltec_dest/bin/wget" ]]; then if ! install-standalone-wget; then return 2 fi @@ -197,9 +200,9 @@ add-bind-mount() { unit_name="$(basename "$unit_path")" if [[ -e $unit_path ]]; then - echo "Bind mount configuration for '$2' already exists, updating" + log INFO "Bind mount configuration for '$2' already exists, updating" else - echo "Mounting '$1' over '$2'" + log INFO "Mounting '$1' over '$2'" fi cat > "$unit_path" << UNIT @@ -234,11 +237,11 @@ remove-bind-mount() { unit_name="$(basename "$unit_path")" if [[ ! -e $unit_path ]]; then - echo "No existing bind mount for '$1'" + log INFO "No existing bind mount for '$1'" return fi - echo "Removing mount over '$1'" + log INFO "Removing mount over '$1'" systemctl disable "$unit_name" systemctl stop "$unit_name" if mountpoint -q "$1"; then @@ -460,7 +463,7 @@ reinstall-root() { if [[ -v "on_root_packages[$pkgname]" ]]; then reinstall_packages[$pkgname]=1 fi - done < <(gunzip -c /opt/var/opkg-lists/* | grep "^Package:" | awk '{print $2}') + done < <(gunzip -c $toltec_dest/var/opkg-lists/* | grep "^Package:" | awk '{print $2}') # Workaround: Checking the size of an empty array when the nounset option # is active may throw an error on some Bash versions, so we disable it @@ -480,6 +483,7 @@ clean-path() { sed -i "/^$bashrc_start_marker\$/,/^$bashrc_end_marker\$/d" "$bashrc_path" sed -i "/^$bashrc_old_start_marker\$/!b;n;d" "$bashrc_path" sed -i "/^$bashrc_old_start_marker\$/d" "$bashrc_path" + # TODO - rewrite this to use $toltec_dest instead of /opt sed -i '/^\(export \)\?PATH="\?\.*\/opt\/bin:\/opt\/sbin.*"\?$/d' "$bashrc_path" fi } @@ -492,7 +496,7 @@ set-path() { clean-path cat >> "$bashrc_path" << SHELL $bashrc_start_marker -PATH="/opt/bin:/opt/sbin:/home/root/.local/bin:\$PATH" +PATH="$toltec_dest/bin:$toltec_dest/sbin:/home/root/.local/bin:\$PATH" $bashrc_end_marker SHELL @@ -541,9 +545,9 @@ generate-opkg-conf() { # then run \`toltecctl generate-opkg-conf\` to regenerate this file dest root / -dest ram /opt/tmp -lists_dir ext /opt/var/opkg-lists -option tmp_dir /opt/tmp +dest ram $toltec_dest/tmp +lists_dir ext $toltec_dest/var/opkg-lists +option tmp_dir $toltec_dest/tmp CONF @@ -672,10 +676,10 @@ CONF # Re-enable Toltec install after system update reenable() { - log INFO "Mounting /opt" + log INFO "Mounting $toltec_dest" add-bind-mount "$toltec_src" "$toltec_dest" switch-branch "$(get-branch)" - log INFO "Generating /opt/etc/opkg.conf" + log INFO "Generating $toltec_dest/etc/opkg.conf" generate-opkg-conf || true log INFO "Opkg update" opkg update @@ -683,12 +687,12 @@ reenable() { reinstall-base log INFO "Reinstalling packages with files on the root partition" reinstall-root - if [ -d /opt/share/toltec/reenable.d ]; then - find /opt/share/toltec/reenable.d -maxdepth 1 -mindepth 1 -print0 \ + if [ -d $toltec_dest/share/toltec/reenable.d ]; then + find $toltec_dest/share/toltec/reenable.d -maxdepth 1 -mindepth 1 -print0 \ | xargs -0rn1 basename \ | while read -r pkg; do local script - script="/opt/lib/opkg/info/${pkg}.postinst" + script="$toltec_dest/lib/opkg/info/${pkg}.postinst" if [ -f "$script" ]; then log INFO "Reconfiguring ${pkg}" "$script" configure || true @@ -720,7 +724,7 @@ list-installed-ordered() { # Install standalone opkg binary install-standalone-opkg() { local wget - if [[ "$(install-state)" != "yes" ]] || [[ "$(command -v wget)" != "/opt/bin/wget" ]]; then + if [[ "$(install-state)" != "yes" ]] || [[ "$(command -v wget)" != "$toltec_dest/bin/wget" ]]; then if ! install-standalone-wget; then return 2 fi @@ -775,12 +779,49 @@ install-standalone-wget() { # Remove Toltec completely uninstall() { + if ! [ -d "$toltec_src" ] && ! [ -d "$toltec_dest" ]; then + log INFO "Toltec does not appear to be installed" + exit 0 + fi + # Fetch standalone opkg used to uninstall packages if ! install-standalone-opkg; then return 1 fi - local clean=true + local success=true + + broken-state() { + echo " Your system may be in a broken state. Please review the logs" + echo " before rebooting your device. If you need assistance, you can" + echo " get help on the community discord channel." + } + + cleanup() { + local error_code=$? + log ERROR "$BASH_LINENO: $BASH_COMMAND" + log ERROR "Uninstall did not complete properly" + broken-state + exit $error_code + } + trap cleanup ERR + + if [[ "$toltecctl_path" != *_backup ]]; then + log INFO "Creating backup of toltecctl at ${toltecctl_path}_backup" + rm -f "${toltecctl_path}_backup" + cp "$toltecctl_path" "${toltecctl_path}_backup" + fi + + if ! [ -f "$toltec_dest"/etc/opkg.conf ]; then + if [ -f "$toltec_src"/etc/opkg.conf ] && ! mountpoint -q "$toltec_dest"; then + log INFO "Mounting $toltec_dest" + add-bind-mount "$toltec_src" "$toltec_dest" + fi + log ERROR "Current install seems to be partially removed, unable to automatically removed." + broken-state + exit 1 + fi + # Remove installed packages in reverse dependency order while read -r pkgname; do if ! "$opkg_path" remove --force-depends "$pkgname"; then @@ -792,28 +833,54 @@ uninstall() { $(list-installed-ordered) EOF - systemctl daemon-reload + if ! systemctl daemon-reload; then + log WARN "Failed to reload systemd state" + fi rm -f "$opkg_path" # Remove mount point remove-bind-mount "$toltec_dest" - rmdir "$toltec_dest" + + case "$(install-state)" in + no) ;; + *) + log ERROR "$toltec_dest bind mount still is active" + success=false + ;; + esac + + if ! rmdir "$toltec_dest"; then + log ERROR "Failed to remove mount point" + success=false + fi # Unset PATH clean-path # Remove Toltec data - rm -r "$toltec_src" + if ! rm -r "$toltec_src"; then + log ERROR "Failed to remove toltec data directory" + success=false + fi # Re-enable xochitl if needed - systemctl enable xochitl - + if ! systemctl enable xochitl; then + log ERROR "Failed to enable the user interface." + success=false + fi if ! $clean; then - echo "Warning: There were errors removing some of the toltec packages." - echo " Your system may be in a broken state. Please review the logs" - echo " before rebooting your device. If you need assistance, you can" - echo " get help on the community discord channel." + log ERROR "There were errors removing some of the toltec packages." + success=false + fi + if ! $success; then + log ERROR "Uninstall failed" + broken-state + exit 1 + fi + if [[ "$toltecctl_path" != *_backup ]]; then + rm -f "$toltecctl_path" fi + rm -f "${toltecctl_path}_backup" } # The current toltec install state From a11076dfd1d8c7a4d0d9a7ae753034eea9783aff Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 13:57:06 -0600 Subject: [PATCH 11/17] Fix error line output --- package/toltec-bootstrap/toltecctl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index a24cac2e6..008d92a58 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -797,14 +797,15 @@ uninstall() { echo " get help on the community discord channel." } - cleanup() { + handle-error() { local error_code=$? - log ERROR "$BASH_LINENO: $BASH_COMMAND" + log ERROR "line $1: $BASH_COMMAND" log ERROR "Uninstall did not complete properly" broken-state exit $error_code } - trap cleanup ERR + set -o functrace + trap 'handle-error ${LINENO}' ERR if [[ "$toltecctl_path" != *_backup ]]; then log INFO "Creating backup of toltecctl at ${toltecctl_path}_backup" From 9c24c0513887a94f5c7d762a9a379bb376a8ae31 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 14:16:14 -0600 Subject: [PATCH 12/17] Better handle failed uninstalls --- package/toltec-bootstrap/toltecctl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index 008d92a58..3f5c1fc7f 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -243,7 +243,8 @@ remove-bind-mount() { log INFO "Removing mount over '$1'" systemctl disable "$unit_name" - systemctl stop "$unit_name" + # Don't error, as umount -l will handle the failure + systemctl stop "$unit_name" || true if mountpoint -q "$1"; then umount -l "$1" fi @@ -790,6 +791,7 @@ uninstall() { fi local clean=true local success=true + local complete=false broken-state() { echo " Your system may be in a broken state. Please review the logs" @@ -806,6 +808,14 @@ uninstall() { } set -o functrace trap 'handle-error ${LINENO}' ERR + handle-exit() { + if ! $completed && $success && $clean; then + log ERROR "Uninstall did not complete properly" + broken-state + exit 1 + fi + } + trap 'handle-exit' EXIT if [[ "$toltecctl_path" != *_backup ]]; then log INFO "Creating backup of toltecctl at ${toltecctl_path}_backup" @@ -820,6 +830,7 @@ uninstall() { fi log ERROR "Current install seems to be partially removed, unable to automatically removed." broken-state + complete=true exit 1 fi @@ -839,8 +850,9 @@ EOF fi rm -f "$opkg_path" - # Remove mount point + set +e # Don't exit on error, next check will validate if it worked remove-bind-mount "$toltec_dest" + set -e case "$(install-state)" in no) ;; @@ -876,12 +888,14 @@ EOF if ! $success; then log ERROR "Uninstall failed" broken-state + complete=true exit 1 fi if [[ "$toltecctl_path" != *_backup ]]; then rm -f "$toltecctl_path" fi rm -f "${toltecctl_path}_backup" + complete=true } # The current toltec install state From c96df00dc295333f8e459347604ca7bed49bfea8 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 14:21:31 -0600 Subject: [PATCH 13/17] Add extra log line --- package/toltec-bootstrap/toltecctl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index 3f5c1fc7f..426ed63d8 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -246,6 +246,7 @@ remove-bind-mount() { # Don't error, as umount -l will handle the failure systemctl stop "$unit_name" || true if mountpoint -q "$1"; then + log WARN "Failed to unmount '$1', lazy unmount instead" umount -l "$1" fi rm "$unit_path" @@ -789,9 +790,9 @@ uninstall() { if ! install-standalone-opkg; then return 1 fi - local clean=true - local success=true - local complete=false + local clean=true # did package uninstall complete without issue? + local success=true # did uninstall complete without issue? + local complete=false # did we actually complete the uninstall, or exit early? broken-state() { echo " Your system may be in a broken state. Please review the logs" From 30663b7ada7dc41410743144751c2e628d9d16a4 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 14:24:48 -0600 Subject: [PATCH 14/17] Fix entware-rc depends --- package/entware-rc/package | 4 ++-- package/entware-rc/rcctl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/entware-rc/package b/package/entware-rc/package index 40b8432f4..4713c788c 100644 --- a/package/entware-rc/package +++ b/package/entware-rc/package @@ -6,12 +6,12 @@ archs=(rmall) pkgnames=(entware-rc) pkgdesc="Manage entware installed services" url=https://toltec-dev.org/ -pkgver=0.1-1 +pkgver=0.1.1-1 timestamp=2024-05-22T22:59:03Z section="utils" maintainer="Eeems " license=MIT -installdepends=() +installdepends=('findutils') source=( entware-rc@.service diff --git a/package/entware-rc/rcctl b/package/entware-rc/rcctl index 899ae7862..cae5b089c 100755 --- a/package/entware-rc/rcctl +++ b/package/entware-rc/rcctl @@ -55,7 +55,7 @@ elif [[ $1 == "logs" ]]; then journalctl --no-pager -all --unit "entware-rc@${2}.service" fi elif [[ $1 == "list" ]]; then - /opt/bin/find /opt/etc/init.d/ -perm '-u+x' -name 'S*' | xargs -rn1 basename + /opt/libexec/find-gnu /opt/etc/init.d/ -perm '-u+x' -name 'S*' | xargs -rn1 basename else help exit 1 From dcf6d734cc8903ba11d72de884babc644031ba35 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 2 Jun 2024 14:52:56 -0600 Subject: [PATCH 15/17] fix final exit --- package/toltec-bootstrap/toltecctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index 426ed63d8..488a04525 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -810,7 +810,7 @@ uninstall() { set -o functrace trap 'handle-error ${LINENO}' ERR handle-exit() { - if ! $completed && $success && $clean; then + if ! $complete && $success && $clean; then log ERROR "Uninstall did not complete properly" broken-state exit 1 From 8deff1c68a04a209908726d20741ef23abb5bb74 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Fri, 6 Sep 2024 18:32:51 -0600 Subject: [PATCH 16/17] Update toltecctl --- package/toltec-bootstrap/toltecctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index 488a04525..fe73ab53b 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -465,7 +465,7 @@ reinstall-root() { if [[ -v "on_root_packages[$pkgname]" ]]; then reinstall_packages[$pkgname]=1 fi - done < <(gunzip -c $toltec_dest/var/opkg-lists/* | grep "^Package:" | awk '{print $2}') + done < <(gunzip -c "$toltec_dest"/var/opkg-lists/* | grep "^Package:" | awk '{print $2}') # Workaround: Checking the size of an empty array when the nounset option # is active may throw an error on some Bash versions, so we disable it From 54d5dcb1755278b602ee6534d5883922d37a1129 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Fri, 6 Sep 2024 18:40:55 -0600 Subject: [PATCH 17/17] Update toltecctl --- package/toltec-bootstrap/toltecctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/toltec-bootstrap/toltecctl b/package/toltec-bootstrap/toltecctl index 11454c356..f1b2e64b9 100644 --- a/package/toltec-bootstrap/toltecctl +++ b/package/toltec-bootstrap/toltecctl @@ -689,8 +689,8 @@ reenable() { reinstall-base log INFO "Reinstalling packages with files on the root partition" reinstall-root - if [ -d $toltec_dest/share/toltec/reenable.d ]; then - find $toltec_dest/share/toltec/reenable.d -maxdepth 1 -mindepth 1 -print0 \ + if [ -d "$toltec_dest"/share/toltec/reenable.d ]; then + find "$toltec_dest"/share/toltec/reenable.d -maxdepth 1 -mindepth 1 -print0 \ | xargs -0rn1 basename \ | while read -r pkg; do local script