add ability to load custom images from file (also not hardcoded anymore)

This commit is contained in:
askiiart 2025-04-25 08:52:44 -05:00
parent 6a6680403f
commit 021d2f0aa5
Signed by untrusted user who does not match committer: askiiart
GPG key ID: 6A32977DAF31746A
3 changed files with 18 additions and 8 deletions

17
blend
View file

@ -27,6 +27,7 @@ import getpass
import pexpect
import argparse
import subprocess
import yaml
__version = '2.0.0'
@ -93,14 +94,14 @@ def podman_it_remover(cmd: list):
# END
distro_map = {
'arch-linux': 'quay.io/toolbx/arch-toolbox:latest',
'debian': 'quay.io/toolbx-images/debian-toolbox:testing',
'fedora-42': 'quay.io/fedora/fedora-toolbox:42',
'centos': 'quay.io/toolbx-images/centos-toolbox:latest',
'ubuntu-22.04': 'quay.io/toolbx/ubuntu-toolbox:22.04',
'ubuntu-24.04': 'quay.io/toolbx/ubuntu-toolbox:24.04',
}
distro_map = yaml.safe_load(open('/usr/share/blend/images.yaml'))
if os.path.exists(f'/etc/blend/images.yaml'):
distro_map += yaml.safe_load(
open(f'{os.getenv('XDG_CONFIG_HOME')}/blend/images.yaml'))
if os.path.exists(f'{os.getenv('XDG_CONFIG_HOME')}/blend/images.yaml'):
distro_map += yaml.safe_load(
open(f'{os.getenv('XDG_CONFIG_HOME')}/blend/images.yaml'))
default_distro = 'arch-linux'

3
images.example.yaml Normal file
View file

@ -0,0 +1,3 @@
# Here you can put custom images to be used for blend
# for example:
# opensuse: quay.io/exampleauthor/opensuse:15

6
images.yaml Normal file
View file

@ -0,0 +1,6 @@
arch-linux: quay.io/toolbx/arch-toolbox:latest
debian: quay.io/toolbx-images/debian-toolbox:testing
fedora-42: quay.io/fedora/fedora-toolbox:42
centos: quay.io/toolbx-images/centos-toolbox:latest
ubuntu-22.04: quay.io/toolbx/ubuntu-toolbox:22.04
ubuntu-24.04: quay.io/toolbx/ubuntu-toolbox:24.04