mirror of
https://github.com/femtofox/femtofox.git
synced 2026-11-20 06:56:29 -05:00
Merge pull request #370 from femtofox/noon2
Add retry to usb-config-tool software installation
This commit is contained in:
commit
dbaebb6b23
2 changed files with 16 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
[Unit]
|
||||
Description=Boot Complete
|
||||
DefaultDependencies=no
|
||||
After=multi-user.target
|
||||
After=multi-user.target femto-usb-config-tool.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/femto-boot-complete.sh
|
||||
|
|
|
|||
|
|
@ -310,18 +310,26 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
|
|||
|
||||
# install software packages from software_install=
|
||||
package_dir="/usr/local/bin/packages"
|
||||
export HOME=/root
|
||||
IFS=',' read -ra packages <<< "$software_install"
|
||||
for package in "${packages[@]}"; do
|
||||
if [[ -f "/usr/local/bin/packages/${package}.sh" ]]; then
|
||||
found_config=true
|
||||
log_message "Installing $($package_dir/${package}.sh -N) in non-interactive mode..." | tee -a /tmp/femtofox-config.log
|
||||
set -o pipefail
|
||||
$package_dir/${package}.sh -xi | tee -a /tmp/femtofox-config.log
|
||||
exit_status=$?
|
||||
set +o pipefail
|
||||
if [ $exit_status -eq 0 ]; then
|
||||
log_message "\033[0;32mInstallation of $($package_dir/${package}.sh -N) successful!\033[0m"
|
||||
else
|
||||
for i in {1..5}; do
|
||||
set -o pipefail
|
||||
$package_dir/${package}.sh -xi | tee -a /tmp/femtofox-config.log
|
||||
last_install_attempt_state=${PIPESTATUS[0]}
|
||||
set +o pipefail
|
||||
if [ $last_install_attempt_state -eq 0 ]; then
|
||||
log_message "\033[0;32mInstallation of $($package_dir/${package}.sh -N) successful!\033[0m"
|
||||
break
|
||||
fi
|
||||
[ $i = 5 ] && log_message "Installation failed... Is internet connected?" && break
|
||||
log_message "Installation failed ($((i+1))/5). Retrying..."
|
||||
sleep 4
|
||||
done
|
||||
if [ $last_install_attempt_state -ne 0 ]; then
|
||||
log_message "\033[0;31mInstallation of $($package_dir/${package}.sh -N) unsuccessful!\033[0m"
|
||||
partial_failure=true
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue