declare -a armhf_keys=(
...
)
sys_arch=$(uname -m)
if [ $(echo "$sys_arch" | grep -c "arm") ]; then
keylist=("${armhf_keys[@]}")
else
echo "your architecture is not supported yet"
exit
fi
Analysis:
The if test always succeeds because it is testing the
exit-code of grep rather than the value returned by the
-c option.
This explains why the old menu has been working when
uname -m returns "aarch64" on Pis with a 64-bit kernel (if
not necessarily a 64-bit user mode).
It also explains why old-menu works on macOS with Docker
Desktop when uname -m returns "x86_64" (or who-knows-what
on M1 Macs).
The logical conclusion is that the intended "architecture
check" was never necessary and should be removed. Removal
continues the current desirable multi-arch behaviour whereas
repairing the code would break any system that wasn't full
32-bit arm.
The only effect of the if-test always succeeding is to
copy armhf_keys to keylist. Aside from its declaration,
the if-test is the only place armhf_keys is referenced so
the copy operation can be avoided by renaming armhf_keys to
keylist, and removing the if-test entirely.
The only place keylist is referenced is the for-loop
immediately below the if-test. Also, keylist implies nothing
about platform architecture so it is a better descriptor than
armhf_keys. It's really an index-lookup mechanism.
Finally, aside from its declaration/assignment, the if-test
is the only place where sys_arch is referenced so that
declaration can be removed too.
Pattern-matching against ./services/selection.txt does not check
for exact whole-of-line match. This means "influx" will match
"influxdb2" (but not vice versa). This is actually a long-standing
problem for other new-release containers like Portainer vs Portainer-CE.
Adds InfluxDB 2 container. Documentation on Master branch.
menu.sh
changes:Adds InfluxDB 2 to menu.
Removes problematic if-test, renames
armhf_keys
array tokeylist
, removessys_arch
declaration. Rationale:Original code fragments:
Analysis:
The if test always succeeds because it is testing the exit-code of
grep
rather than the value returned by the-c
option.This explains why the old menu has been working when
uname -m
returns "aarch64" on Pis with a 64-bit kernel (if not necessarily a 64-bit user mode).It also explains why old-menu works on macOS with Docker Desktop when
uname -m
returns "x86_64" (or who-knows-what on M1 Macs).The logical conclusion is that the intended "architecture check" was never necessary and should be removed. Removal continues the current desirable multi-arch behaviour whereas repairing the code would break any system that wasn't full 32-bit arm.
The only effect of the if-test always succeeding is to copy
armhf_keys
tokeylist
. Aside from its declaration, the if-test is the only placearmhf_keys
is referenced so the copy operation can be avoided by renamingarmhf_keys
tokeylist
, and removing the if-test entirely.The only place
keylist
is referenced is the for-loop immediately below the if-test. Also,keylist
implies nothing about platform architecture so it is a better descriptor thanarmhf_keys
. It's really an index-lookup mechanism.Finally, aside from its declaration/assignment, the if-test is the only place where
sys_arch
is referenced so that declaration can be removed too.Pattern-matching against
./services/selection.txt
does not check for exact whole-of-line match. This means "influx" will match "influxdb2" (but not vice versa). This is actually a long-standing problem for other new-release containers like Portainer vs Portainer-CE.Signed-off-by: Phill Kelley 34226495+Paraphraser@users.noreply.github.com