-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add snap refresh postpone, add snap interfaces connect before validation
Signed-off-by: keliramu <[email protected]>
- Loading branch information
Showing
3 changed files
with
77 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
snap_connect_interfaces() { | ||
local SNAP_NAME=nordvpn | ||
|
||
# List all connections for the Snap | ||
echo "Checking connections for Snap package: ${SNAP_NAME}" | ||
connections=$(snap connections "${SNAP_NAME}") | ||
|
||
# Display and process unconnected interfaces | ||
echo | ||
echo "Unconnected connections for ${SNAP_NAME}:" | ||
unconnected=$(echo "${connections}" | awk ' | ||
NR > 1 && $3 == "-" { | ||
print $1 | ||
}') | ||
|
||
if [ -z "${unconnected}" ]; then | ||
echo "All connections are already connected." | ||
return | ||
fi | ||
|
||
echo "${unconnected}" | ||
|
||
# Attempt to connect each unconnected interface | ||
echo | ||
for interface in ${unconnected}; do | ||
echo "Connecting interface: ${interface}" | ||
if sudo snap connect "${SNAP_NAME}:${interface}"; then | ||
echo "Successfully connected: ${interface}" | ||
else | ||
echo "Failed to connect: ${interface}" | ||
fi | ||
done | ||
|
||
echo | ||
echo "Connection process completed for ${SNAP_NAME}." | ||
# Show current connections state | ||
snap connections "${SNAP_NAME}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters