forked from ublue-os/bluefin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make sure quadlet is running before launching via shortcut (ublu…
- Loading branch information
Showing
4 changed files
with
57 additions
and
42 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
47 changes: 47 additions & 0 deletions
47
system_files/shared/usr/libexec/distrobox-quadlet-ptyxis.sh
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,47 @@ | ||
#!/usr/bin/bash | ||
# shellcheck disable=SC1091,SC2154 | ||
# Shellcheck SC1091 => sourcing /usr/share/ublue-os/bluefin-cli/known-containers | ||
# Shellcheck SC2154 => known containers Associative Array declared in above source | ||
|
||
# Container Name and Target Name for Quadlet | ||
name=$1 | ||
|
||
# Source Known Containers used with ptyxis profiles | ||
. /usr/share/ublue-os/bluefin-cli/known-containers | ||
if test -z "${known_container[$name]}"; then | ||
notify-send "Unknown Container $name... Bailing Out..." | ||
exit 1 | ||
fi | ||
|
||
# Host isn't a container. | ||
if test "${name}" == "Host"; then | ||
|
||
# Start Ptyxis | ||
ptyxis --tab-with-profile="${known_container[$name]}" --new-window | ||
|
||
else | ||
|
||
# Check if quadlet target is enabled | ||
if ! eval systemctl --user --quiet is-enabled "${name}".target; then | ||
notify-send "${name} quadlet not enabled... enabling" | ||
systemctl --user enable --now "${name}".target | ||
fi | ||
|
||
# Check if quadlet is running | ||
if ! eval systemctl --user --quiet is-active "${name}".service; then | ||
notify-send "${name} quadlet not running... this may take awhile to start" | ||
systemctl --user restart "${name}".service | ||
# Give the Quadlet a second to startup | ||
sleep 1 | ||
fi | ||
|
||
# Final Check... If the container doesn't exist bail out. | ||
if ! grep -q "${name}" <<< "$(podman ps -a --no-trunc --format "{{.Names}}")"; then | ||
notify-send "${name} not created properly... Bailing Out..." | ||
exit 1 | ||
fi | ||
|
||
# Start Ptyxis | ||
ptyxis --tab-with-profile="${known_container[$name]}" --new-window | ||
fi | ||
|
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