|
15 | 15 | # <http://bin.entware.net/armv7sf-k3.2/installer/generic.sh>
|
16 | 16 | #
|
17 | 17 |
|
| 18 | +if [ -z "$BASH" ] || [[ "$(ps | awk '$1=='$$' { n=split($5,a,"/"); print a[n] }')" != "bash" ]]; then |
| 19 | + echo "bootstrap must be run with bash" |
| 20 | + exit 1 |
| 21 | +fi |
| 22 | + |
18 | 23 | set -eEuo pipefail
|
19 | 24 |
|
20 | 25 | # Path to the temporary local wget and Opkg binaries
|
@@ -61,26 +66,48 @@ exists-non-empty() {
|
61 | 66 | [[ -d $1 ]] && files="$(ls -A -- "$1")" && [[ -n $files ]]
|
62 | 67 | }
|
63 | 68 |
|
| 69 | +already-installed-message() { |
| 70 | + log "Toltec is already installed or partially installed" |
| 71 | + log "To re-enable Toltec after a system upgrade, run 'toltecctl reenable'" |
| 72 | + log "To reinstall Toltec, run 'toltecctl uninstall' first" |
| 73 | +} |
| 74 | + |
64 | 75 | # Check whether a Toltec install already exists or if conflicting files
|
65 | 76 | # remain from previous installs
|
66 | 77 | check-installed() {
|
67 |
| - if [[ ! -f $toltecctl_path ]]; then |
68 |
| - return |
| 78 | + local unit_path |
| 79 | + local unit |
| 80 | + # This should mimic get-bind-mount-path as close as possible to ensure it's always |
| 81 | + # the path that an install or reenable would generate. |
| 82 | + unit_path="/lib/systemd/system/$(systemd-escape --path /opt).mount" |
| 83 | + unit="$(basename "$unit_path")" |
| 84 | + if [[ -f $unit_path ]] && systemctl --quiet is-active "$unit" 2> /dev/null; then |
| 85 | + log ERROR "opt.mount is currently active" |
| 86 | + already-installed-message |
| 87 | + exit 1 |
69 | 88 | fi
|
70 |
| - |
71 |
| - if exists-non-empty /opt || exists-non-empty /home/root/.entware; then |
72 |
| - log "Toltec is already installed or partially installed" |
73 |
| - log "To re-enable Toltec after a system upgrade, run 'toltecctl reenable'" |
74 |
| - log "To reinstall Toltec, run 'toltecctl uninstall' first" |
| 89 | + if [[ "$(grep ' /opt ' /proc/mounts)" != "" ]]; then |
| 90 | + log ERROR "/opt is currently mounted" |
| 91 | + already-installed-message |
| 92 | + exit 1 |
| 93 | + fi |
| 94 | + if exists-non-empty /opt; then |
| 95 | + log ERROR "/opt exists and is not empty" |
| 96 | + already-installed-message |
| 97 | + exit 1 |
| 98 | + fi |
| 99 | + if exists-non-empty /home/root/.entware; then |
| 100 | + log ERROR "/home/root/.entware exists and is not empty" |
| 101 | + already-installed-message |
75 | 102 | exit 1
|
76 | 103 | fi
|
77 | 104 | }
|
78 | 105 |
|
79 | 106 | # Install a local wget binary which supports TLS (the original one
|
80 | 107 | # installed on the reMarkable does not) in the PATH
|
81 | 108 | wget-bootstrap() {
|
82 |
| - local wget_remote=http://toltec-dev.org/thirdparty/bin/wget-v1.21.1 |
83 |
| - local wget_checksum=8798fcdabbe560722a02f95b30385926e4452e2c98c15c2c217583eaa0db30fc |
| 109 | + local wget_remote=http://toltec-dev.org/thirdparty/bin/wget-v1.21.1-1 |
| 110 | + local wget_checksum=c258140f059d16d24503c62c1fdf747ca843fe4ba8fcd464a6e6bda8c3bbb6b5 |
84 | 111 |
|
85 | 112 | if [[ ! -x $wget_path ]]; then
|
86 | 113 | if [[ -e $wget_path ]]; then
|
|
0 commit comments