diff --git a/build_files/base/fetch-quadlets.sh b/build_files/base/fetch-quadlets.sh index eafc704e6e3..0e63af1c3fd 100755 --- a/build_files/base/fetch-quadlets.sh +++ b/build_files/base/fetch-quadlets.sh @@ -7,49 +7,30 @@ mkdir -p /usr/etc/containers/systemd/users # bluefin-cli wget --output-document="/usr/etc/containers/systemd/users/bluefin-cli.container" --quiet https://raw.githubusercontent.com/ublue-os/toolboxes/main/quadlets/bluefin-cli/bluefin-cli.container -cat /usr/share/ublue-os/bluefin-cli/ptyxis-integration >> /usr/etc/containers/systemd/users/bluefin-cli.container -printf "\n\n[Install]\nWantedBy=bluefin-cli.target" >> /usr/etc/containers/systemd/users/bluefin-cli.container -sed -i '/AutoUpdate.*/ s/^#*/#/' /usr/etc/containers/systemd/users/bluefin-cli.container sed -i 's/ContainerName=bluefin/ContainerName=bluefin-cli/' /usr/etc/containers/systemd/users/bluefin-cli.container # bluefin-dx-cli wget --output-document="/usr/etc/containers/systemd/users/bluefin-dx-cli.container" --quiet https://raw.githubusercontent.com/ublue-os/toolboxes/main/quadlets/bluefin-cli/bluefin-dx-cli.container -cat /usr/share/ublue-os/bluefin-cli/ptyxis-integration >> /usr/etc/containers/systemd/users/bluefin-dx-cli.container -printf "\n\n[Install]\nWantedBy=bluefin-dx-cli.target" >> /usr/etc/containers/systemd/users/bluefin-dx-cli.container -sed -i '/AutoUpdate.*/ s/^#*/#/' /usr/etc/containers/systemd/users/bluefin-dx-cli.container sed -i 's/ContainerName=bluefin/ContainerName=bluefin-dx-cli/' /usr/etc/containers/systemd/users/bluefin-dx-cli.container # fedora-toolbox wget --output-document="/usr/etc/containers/systemd/users/fedora-toolbox.container" --quiet https://raw.githubusercontent.com/ublue-os/toolboxes/main/quadlets/fedora-toolbox/fedora-distrobox-quadlet.container -cat /usr/share/ublue-os/bluefin-cli/ptyxis-integration >> /usr/etc/containers/systemd/users/fedora-toolbox.container -printf "\n\n[Install]\nWantedBy=fedora-toolbox.target" >> /usr/etc/containers/systemd/users/fedora-toolbox.container -sed -i '/AutoUpdate.*/ s/^#*/#/' /usr/etc/containers/systemd/users/fedora-toolbox.container sed -i 's/ContainerName=fedora-distrobox-quadlet/ContainerName=fedora-toolbox/' /usr/etc/containers/systemd/users/fedora-toolbox.container # ubuntu-toolbox wget --output-document="/usr/etc/containers/systemd/users/ubuntu-toolbox.container" --quiet https://raw.githubusercontent.com/ublue-os/toolboxes/main/quadlets/ubuntu-toolbox/ubuntu-distrobox-quadlet.container -cat /usr/share/ublue-os/bluefin-cli/ptyxis-integration >> /usr/etc/containers/systemd/users/ubuntu-toolbox.container -printf "\n\n[Install]\nWantedBy=ubuntu-toolbox.target" >> /usr/etc/containers/systemd/users/ubuntu-toolbox.container -sed -i '/AutoUpdate.*/ s/^#*/#/' /usr/etc/containers/systemd/users/ubuntu-toolbox.container sed -i 's/ContainerName=ubuntu-distrobox-quadlet/ContainerName=ubuntu-toolbox/' /usr/etc/containers/systemd/users/ubuntu-toolbox.container # wolfi-toolbox wget --output-document="/usr/etc/containers/systemd/users/wolfi-toolbox.container" --quiet https://raw.githubusercontent.com/ublue-os/toolboxes/main/quadlets/wolfi-toolbox/wolfi-distrobox-quadlet.container -cat /usr/share/ublue-os/bluefin-cli/ptyxis-integration >> /usr/etc/containers/systemd/users/wolfi-toolbox.container -printf "\n\n[Install]\nWantedBy=wolfi-toolbox.target" >> /usr/etc/containers/systemd/users/wolfi-toolbox.container -sed -i '/AutoUpdate.*/ s/^#*/#/' /usr/etc/containers/systemd/users/wolfi-toolbox.container sed -i 's/ContainerName=wolfi-quadlet/ContainerName=wolfi-toolbox/' /usr/etc/containers/systemd/users/wolfi-toolbox.container # wolfi-dx-toolbox wget --output-document="/usr/etc/containers/systemd/users/wolfi-dx-toolbox.container" --quiet https://raw.githubusercontent.com/ublue-os/toolboxes/main/quadlets/wolfi-toolbox/wolfi-dx-distrobox-quadlet.container -cat /usr/share/ublue-os/bluefin-cli/ptyxis-integration >> /usr/etc/containers/systemd/users/wolfi-dx-toolbox.container -printf "\n\n[Install]\nWantedBy=wolfi-dx-toolbox.target" >> /usr/etc/containers/systemd/users/wolfi-dx-toolbox.container -sed -i '/AutoUpdate.*/ s/^#*/#/' /usr/etc/containers/systemd/users/wolfi-dx-toolbox.container sed -i 's/ContainerName=wolfi-quadlet/ContainerName=wolfi-dx-toolbox/' /usr/etc/containers/systemd/users/wolfi-dx-toolbox.container -# Make systemd targets and restart services for topgrade +# Make systemd targets mkdir -p /usr/lib/systemd/user -mkdir -p /usr/share/ublue-os/bluefin-cli QUADLET_TARGETS=( "bluefin-cli" "bluefin-dx-cli" @@ -67,22 +48,8 @@ Description=${i}"target for ${i} quadlet [Install] WantedBy=default.target EOF -cat > "/usr/lib/systemd/user/${i}-update.service" < "/usr/share/ublue-os/bluefin-cli/${i}.sh" <> /usr/etc/containers/systemd/users/"$i".container +printf "\n\n[Install]\nWantedBy=%s.target" "$i" >> /usr/etc/containers/systemd/users/"$i".container done diff --git a/build_files/base/systemd.sh b/build_files/base/systemd.sh index ea13e22895b..b1e6186a5d0 100644 --- a/build_files/base/systemd.sh +++ b/build_files/base/systemd.sh @@ -8,4 +8,5 @@ systemctl enable dconf-update.service systemctl --global enable ublue-flatpak-manager.service systemctl enable ublue-update.timer systemctl enable ublue-system-setup.service -systemctl --global enable ublue-user-setup.service \ No newline at end of file +systemctl --global enable ublue-user-setup.service +systemctl --global enable podman-auto-update.timer \ No newline at end of file diff --git a/system_files/shared/usr/libexec/distrobox-quadlet-ptyxis.sh b/system_files/shared/usr/libexec/distrobox-quadlet-ptyxis.sh new file mode 100755 index 00000000000..206a9bd2b6d --- /dev/null +++ b/system_files/shared/usr/libexec/distrobox-quadlet-ptyxis.sh @@ -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 + diff --git a/system_files/silverblue/usr/etc/dconf/db/local.d/01-ublue b/system_files/silverblue/usr/etc/dconf/db/local.d/01-ublue index 957cb9e6837..71628b065cf 100644 --- a/system_files/silverblue/usr/etc/dconf/db/local.d/01-ublue +++ b/system_files/silverblue/usr/etc/dconf/db/local.d/01-ublue @@ -59,12 +59,12 @@ min-alpha=0.5 [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0] binding='t' -command='ptyxis --tab-with-profile=2871e8027773ae74d6c87a5f659bbc74 --new-window' +command='/usr/libexec/distrobox-quadlet-ptyxis.sh Host' name='Host Ptyxis' [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1] binding='u' -command='ptyxis --tab-with-profile=4741cb2eb3614750b79edc5c4b8c08b3 --new-window' +command='/usr/libexec/distrobox-quadlet-ptyxis.sh ubuntu-toolbox' name='Ubuntu Ptyxis' [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2] @@ -74,12 +74,12 @@ name='mission-center' [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3] binding='Return' -command="ptyxis --new-window" +command='/usr/libexec/distrobox-quadlet-ptyxis.sh bluefin-cli' name='Bluefin Ptyxis' [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4] binding='f' -command="ptyxis --tab-with-profile=d6fe45489ed74fada5d95d715449ce7e --new-window" +command='/usr/libexec/distrobox-quadlet-ptyxis.sh fedora-toolbox' name='Fedora Ptyxis' [org/gnome/settings-daemon/plugins/media-keys]