Skip to content

Commit

Permalink
fish: Adjust dev_img functions
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Chancellor <[email protected]>
  • Loading branch information
nathanchance committed Dec 22, 2024
1 parent b0294ce commit 52c335f
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion configs/tmux/start-distrobox.fish
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env fish

in_container_msg -h; or return
dbx list &| grep -q (get_dev_img); or dbxc --yes; or return
dbx list &| grep -q (dev_img); or dbxc --yes; or return
dbxe -- true
6 changes: 3 additions & 3 deletions fish/functions/dbxc.fish
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function dbxc -d "Shorthand for 'distrobox create'"

# If no image was specified, default to the one for the architecture
if not set -q img
set img $GHCR/(get_dev_img)
set name (get_dev_img_esc)
set img (dev_img_gh)
set name (dev_img)
end

set -a dbx_args -i $img
Expand All @@ -77,7 +77,7 @@ function dbxc -d "Shorthand for 'distrobox create'"
# If we are using a development image AND it is the default one for our
# architecture (to avoid weird dynamic linking failures), use the binaries
# in $CBL by default
if test "$img" = $GHCR/(get_dev_img); and not set -q skip_cbl
if test "$img" = (dev_img_gh); and not set -q skip_cbl
set -a add_args --env=USE_CBL=1
end

Expand Down
2 changes: 1 addition & 1 deletion fish/functions/dbxe.fish
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function dbxe -d "Shorthand for 'distrobox enter'"
end

if not set -q dbx_img
set dbx_img (get_dev_img_esc)
set dbx_img (dev_img)
end

if test (count $add_args) -gt 0
Expand Down
2 changes: 1 addition & 1 deletion fish/functions/dbxr.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

function dbxr -d "Remove a distrobox container"
if test (count $argv) -eq 0
set targets (get_dev_img_esc)
set targets (dev_img)
else
set targets $argv
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2022-2023 Nathan Chancellor

function get_dev_img -d "Print the default development container image for the host architecture"
function dev_img -d "Print the default development container image for the host architecture"
switch (uname -m)
case 'armv7*' i686
echo dev/suse
echo dev-suse
case aarch64
echo dev/fedora
echo dev-fedora
case x86_64
echo dev/arch
echo dev-arch
end
end
7 changes: 7 additions & 0 deletions fish/functions/dev_img_gh.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env fish
# SPDX-License-Identifier: MIT
# Copyright (C) 2024 Nathan Chancellor

function dev_img_gh -d "Get the default development image from the GitHub Container Registry"
echo $GHCR/(dev_img | string replace - /)
end
7 changes: 0 additions & 7 deletions fish/functions/get_dev_img_esc.fish

This file was deleted.

2 changes: 1 addition & 1 deletion fish/functions/oci_bld.fish
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function oci_bld -d "Build an OCI container image"
for image in $images
switch $image
case dev
set folder (get_dev_img)
set folder (dev_img | string replace - /)
set image $folder

case '*'
Expand Down
2 changes: 1 addition & 1 deletion fish/functions/upd.fish
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function upd -d "Runs the update command for the current distro or downloads/upd

case os os-no-container
$PYTHON_SCRIPTS_FOLDER/upd_distro.py $yes
if test "$target" != os-no-container; and has_container_manager; and dbx list &| grep -q (get_dev_img_esc)
if test "$target" != os-no-container; and has_container_manager; and dbx list &| grep -q (dev_img)
dbxe -- $PYTHON_SCRIPTS_FOLDER/upd_distro.py $yes
end
if command -q mac
Expand Down

0 comments on commit 52c335f

Please sign in to comment.