Improve AM install script error handling
Is there a way to add better error detection in _install_arg (install.am)?
For example, if xz is not installed in the system, we will not be able to untar some apps during installation. But AM will still consider the app was installed correctly.
7zip install test case with xz/xz-utils uninstalled: `am -i 7zip`
```
◆ "7ZIP": starting installation script
7z2601-linux-x64.tar.xz 100%[=====================================>]
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
chmod: cannot access './7zz': No such file or directory
chmod: cannot access './7zzs': No such file or directory
Oops! Something went wrong! Integrity check in progress...
✔ Checksum auto-verified.
"7ZIP" INSTALLED (2 MB OF DISK SPACE)
```
#### Suggested solution
Maybe we modify _install_arg() in install.am in this way:
```
# Install script
$SUDOCMD ./"$arg" 2> "$AMCACHEDIR"/install.log || _install_script_retry
# Check logfile for errors
grep -q "Error \|error \|cannot access\|No such file or directory" "$AMCACHEDIR"/install.log && _installation_cleanup
```
The code greps the log for errors and then calls installation_cleanup instead to fail the install.
But this has issues:
1. Progress bar disappears
2. Alternatively, using `script -c $SUDOCMD ./"$arg"` method causes the output to look weird, and some tests cant pipe inputs into AM correctly (eg. YYNNNNN for `am -ias` test).
关闭于 2026-05-09 82 条评论