chore(default-flatpaks): Increase connection attempts to 5 & print successful connection log

This commit is contained in:
fiftydinar 2024-10-23 18:26:06 +02:00 committed by GitHub
parent 2f2036db0b
commit 95c17dcc23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 12 deletions

View file

@ -4,7 +4,7 @@
# Check it 3 times in 3 second interval, to avoid until loop
# Used when adding remotes & when installing flatpaks
check_internet_connection() {
local max_attempts=3
local max_attempts=5
local sleep_time=3
local attempt=1
@ -125,10 +125,11 @@ done
# Set up system-wide Flatpak repository
if [[ $REPO_URL != "null" && $REPO_NAME != "null" ]]; then
echo "Adding system-wide remote $REPO_NAME from $REPO_URL"
echo "Adding system-wide remote $REPO_NAME from $REPO_URL (requires internet)"
echo "Note that --if-not-exists flag doesn't prevent the repo from modifying repo URL"
check_internet_connection
if "${internet_connection}"; then
echo "Internet connection is successful, applying the operation above"
flatpak remote-add --if-not-exists --system "$REPO_NAME" "$REPO_URL"
fi
fi
@ -143,10 +144,10 @@ fi
# Change repository title to configured title, if not null & if not already changed
if [[ $REPO_TITLE != "null" ]] && ! ${no_title_modify}; then
echo "Setting title $REPO_TITLE for remote $REPO_NAME"
echo "Setting title $REPO_TITLE for system remote $REPO_NAME"
flatpak remote-modify --system "$REPO_NAME" --title="$REPO_TITLE"
elif [[ $REPO_TITLE != "null" ]] && ${no_title_modify}; then
echo "Custom flatpak remote title is already set"
echo "Custom flatpak system remote title is already set"
fi
# Notifications config
@ -215,15 +216,17 @@ if [[ -f $INSTALL_LIST_FILE ]] || [[ -f $USER_INSTALL_LIST_FILE ]]; then
INSTALL_LIST="$COMBINED_INSTALL_LIST"
fi
if [[ -n $INSTALL_LIST ]] && [[ ! $NOTIFICATIONS == "true" ]]; then
echo "Installing system flatpaks from config list"
echo "Installing system flatpaks from config list (requires internet)"
check_internet_connection
if "${internet_connection}"; then
echo "Internet connection is successful, applying the operation above"
flatpak install --system --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
fi
elif [[ -n $INSTALL_LIST ]] && [[ $NOTIFICATIONS == "true" ]]; then
echo "Installing system flatpaks from config list"
echo "Installing system flatpaks from config list (requires internet)"
check_internet_connection
if "${internet_connection}"; then
echo "Internet connection is successful, applying the operation above"
notify-send-pre-install
flatpak install --system --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
notify-send-install

View file

@ -4,7 +4,7 @@
# Check it 3 times in 3 second interval, to avoid until loop
# Used when adding remotes & when installing flatpaks
check_internet_connection() {
local max_attempts=3
local max_attempts=5
local sleep_time=3
local attempt=1
@ -112,20 +112,21 @@ done
# Set up per-user Flatpak repository
if [[ $REPO_URL != "null" && $REPO_NAME != "null" ]]; then
echo "Adding remote $REPO_NAME from $REPO_URL"
echo "Adding user-wide remote $REPO_NAME from $REPO_URL (requires internet)"
echo "Note that --if-not-exists flag doesn't prevent the repo from modifying repo URL"
check_internet_connection
if "${internet_connection}"; then
echo "Internet connection is successful, applying the operation above"
flatpak remote-add --if-not-exists --user "$REPO_NAME" "$REPO_URL"
fi
fi
# Change repository title to configured title, if not null & if not already changed
if [[ $REPO_TITLE != "null" ]] && ! ${no_title_modify}; then
echo "Setting title $REPO_TITLE for remote $REPO_NAME"
echo "Setting title $REPO_TITLE for user remote $REPO_NAME"
flatpak remote-modify --user "$REPO_NAME" --title="$REPO_TITLE"
elif [[ $REPO_TITLE != "null" ]] && ${no_title_modify}; then
echo "Custom flatpak remote title is already set"
echo "Custom flatpak user remote title is already set"
fi
# Notifications config
@ -166,15 +167,17 @@ if [[ -f $INSTALL_LIST_FILE ]] || [[ -f $USER_INSTALL_LIST_FILE ]]; then
INSTALL_LIST="$COMBINED_INSTALL_LIST"
fi
if [[ -n $INSTALL_LIST ]] && [[ ! $NOTIFICATIONS == "true" ]]; then
echo "Installing user flatpaks from config list"
echo "Installing user flatpaks from config list (requires internet)"
check_internet_connection
if "${internet_connection}"; then
echo "Internet connection is successful, applying the operation above"
flatpak install --user --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
fi
elif [[ -n $INSTALL_LIST ]] && [[ $NOTIFICATIONS == "true" ]]; then
echo "Installing user flatpaks from config list"
echo "Installing user flatpaks from config list (requires internet)"
check_internet_connection
if "${internet_connection}"; then
echo "Internet connection is successful, applying the operation above"
notify-send "Flatpak Installer" "Started install of user flatpaks" --app-name="Flatpak Installer" -u NORMAL
flatpak install --user --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
notify-send "Flatpak Installer" "Finished install of user flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL