ajustements

This commit is contained in:
neox 2024-07-10 17:39:23 +02:00
parent 5002c62bee
commit b0f63a8ff3
No known key found for this signature in database
GPG Key ID: 57BC26A3687116F6
1 changed files with 25 additions and 2 deletions

View File

@ -105,6 +105,29 @@ echo -e "${BLUE}Installing GNU Guix...${NC}"
herd start cow-store /mnt
guix system init config.scm /mnt && reboot
install_guix() {
tmpfile=$(mktemp)
guix system init config.scm /mnt >(tee "$tmpfile") 2>&1
exit_code=$?
output=$(tail -n 3 "$tmpfile")
rm -f "$tmpfile"
if [[ $exit_code -ne 0 && $output == *"died unexpectedly"* ]]; then
return 1
else
return 0
fi
}
max_retries=5
attempt=0
until install_guix; do
attempt=$((attempt + 1))
if [[ $attempt -ge $max_retries ]]; then
echo -e "${RED}Installation has failed${NC}"
exit 1
fi
echo -e "${BLUE}Trying installing GNU Guix again...${NC}"
done