Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dx): use distrobox-enter wrapper for non default images #439

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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