Skip to content

Commit

Permalink
fix(dx): use distrobox-enter wrapper for non default images (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobslept committed Aug 26, 2023
1 parent 418c2e4 commit b4a5e28
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dx/etc/dconf/db/local.d/01-ublue-dx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2]
binding='<Control><Alt>f'
command='flatpak run com.raggesilver.BlackBox --command "distrobox enter fedora"'
command='flatpak run com.raggesilver.BlackBox --command "bluefinbox-enter fedora"'
name='blackbox fedora'

[org/gnome/settings-daemon/plugins/media-keys]
Expand Down
30 changes: 30 additions & 0 deletions dx/usr/bin/bluefinbox-enter
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

# Little helper script to launch other than default (ubuntu) distroboxes without manually
# having to assemble them.

container_name=$1
if [ "${container_name}" == "" ]; then
echo "Please specify the container name you want to enter."
echo "For example: ${0} fedora"
exit 1
fi

# Inspect if the container is already present
inspect_cmd="podman inspect --type container "${container_name}" --format {{.State.Status}} > /dev/null"
eval "${inspect_cmd}"
container_exists=$?

if [ "$container_exists" -eq 0 ]; then
# No need to assemble, enjoy your stay
exec distrobox enter "${container_name}"
else
# We don't have the container so we assemble it first. With distrobox version 1.5.0.2
# or below we need to assemble all the entries that occur in the `distrobox.ini` manifest.
# In future versions of distrobox we will be able to specify `--name $container_name` to
# only assemble the box we want to enter.
distrobox assemble create --replace --file /etc/distrobox/distrobox.ini

# All done, good to go
exec distrobox enter "${container_name}"
fi

0 comments on commit b4a5e28

Please sign in to comment.