diff --git a/.github/workflows/dev-alpine.yml b/.github/workflows/dev-alpine.yml deleted file mode 100644 index 41f9d9d51..000000000 --- a/.github/workflows/dev-alpine.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Alpine Linux development container image - -on: - push: - paths: - - .github/workflows/dev-alpine.yml - - podman/dev/alpine/* - schedule: - - cron: 0 0 * * 0 - workflow_dispatch: - inputs: - push_image: - description: 'Push image to ghcr.io' - required: false - type: boolean - -jobs: - build_and_push: - name: Build and push Alpine Linux container image - uses: ./.github/workflows/docker.yml - secrets: inherit - with: - context: ./podman/dev/alpine - image: dev/alpine - platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64 - push: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true') }} diff --git a/.github/workflows/dev-arch.yml b/.github/workflows/dev-arch.yml deleted file mode 100644 index a135842bb..000000000 --- a/.github/workflows/dev-arch.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Arch Linux development container image - -on: - push: - paths: - - .github/workflows/dev-arch.yml - - podman/dev/arch/* - schedule: - - cron: 0 0 * * 0 - workflow_dispatch: - inputs: - push_image: - description: 'Push image to ghcr.io' - required: false - type: boolean - -jobs: - build_and_push: - name: Build and push Arch Linux container image - uses: ./.github/workflows/docker.yml - secrets: inherit - with: - context: ./podman/dev/arch - image: dev/arch - platforms: linux/amd64 - push: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true') }} diff --git a/.github/workflows/dev-debian.yml b/.github/workflows/dev-debian.yml deleted file mode 100644 index d5e63be47..000000000 --- a/.github/workflows/dev-debian.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Debian development container image - -on: - push: - paths: - - .github/workflows/dev-debian.yml - - podman/dev/debian/* - schedule: - - cron: 0 0 * * 0 - workflow_dispatch: - inputs: - push_image: - description: 'Push image to ghcr.io' - required: false - type: boolean - -jobs: - build_and_push: - name: Build and push Debian container image - uses: ./.github/workflows/docker.yml - secrets: inherit - with: - context: ./podman/dev/debian - image: dev/debian - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true') }} diff --git a/.github/workflows/dev-fedora.yml b/.github/workflows/dev-fedora.yml deleted file mode 100644 index 4700609b4..000000000 --- a/.github/workflows/dev-fedora.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Fedora development container image - -on: - push: - paths: - - .github/workflows/dev-fedora.yml - - podman/dev/fedora/* - schedule: - - cron: 0 0 * * 0 - workflow_dispatch: - inputs: - push_image: - description: 'Push image to ghcr.io' - required: false - type: boolean - -jobs: - build_and_push: - name: Build and push Fedora container image - uses: ./.github/workflows/docker.yml - secrets: inherit - with: - context: ./podman/dev/fedora - image: dev/fedora - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true') }} diff --git a/.github/workflows/dev-suse.yml b/.github/workflows/dev-suse.yml deleted file mode 100644 index 41aaf2477..000000000 --- a/.github/workflows/dev-suse.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: OpenSUSE development container image - -on: - push: - paths: - - .github/workflows/dev-suse.yml - - podman/dev/suse/* - schedule: - - cron: 0 0 * * 0 - workflow_dispatch: - inputs: - push_image: - description: 'Push image to ghcr.io' - required: false - type: boolean - -jobs: - build_and_push: - name: Build and push OpenSUSE container image - uses: ./.github/workflows/docker.yml - secrets: inherit - with: - context: ./podman/dev/suse - image: dev/suse - platforms: linux/amd64,linux/arm/v7,linux/arm64 - push: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true') }} diff --git a/.github/workflows/dev-ubuntu.yml b/.github/workflows/dev-ubuntu.yml deleted file mode 100644 index 9a2608957..000000000 --- a/.github/workflows/dev-ubuntu.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Ubuntu development container image - -on: - push: - paths: - - .github/workflows/dev-ubuntu.yml - - podman/dev/ubuntu/* - schedule: - - cron: 0 0 * * 0 - workflow_dispatch: - inputs: - push_image: - description: 'Push image to ghcr.io' - required: false - type: boolean - -jobs: - build_and_push: - name: Build and push Ubuntu container image - uses: ./.github/workflows/docker.yml - secrets: inherit - with: - context: ./podman/dev/ubuntu - image: dev/ubuntu - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true') }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index f75cdcbf2..000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Build and push a container image to ghcr.io - -on: - workflow_call: - inputs: - context: - required: true - type: string - image: - required: true - type: string - platforms: - required: true - type: string - push: - default: false - required: false - type: boolean - -jobs: - build_and_push_image: - name: Build and push container image - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GitHub Container Registry - if: ${{ inputs.push }} - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set variables - id: variables - run: | - echo "date=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_OUTPUT - - - name: Build - uses: docker/build-push-action@v5 - with: - build-args: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - context: ${{ inputs.context }} - file: ${{ inputs.context }}/Dockerfile - platforms: ${{ inputs.platforms }} - push: ${{ inputs.push }} - tags: | - ghcr.io/${{ github.actor }}/${{ inputs.image }}:${{ steps.variables.outputs.date }} - ghcr.io/${{ github.actor }}/${{ inputs.image }}:latest diff --git a/README.md b/README.md index be8df83b3..4120e1f0f 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ This repository contains my shell environment scripts and configurations. The la * `bash/`: Files written for `bash`, mostly aimed at bootstrapping environments from the `root` user. * `configs/`: Configuration files, such as for terminal programs, editors, and `tmux`. * `fish/`: Files written for `fish`, my primary shell program. +* `mkosi/`: Files for use with `mkosi` to generate chroots for development, intended to be run with `systemd-nspawn`. * `pkgbuilds/`: My collection of PKGBUILD files for Arch Linux. -* `podman/`: My collection of container build files, mainly for use with `podman`. * `python/`: My collection of Python scripts and projects. ## Support diff --git a/configs/tmux/.tmux.conf.container b/configs/tmux/.tmux.conf.container new file mode 100644 index 000000000..d7daa22c6 --- /dev/null +++ b/configs/tmux/.tmux.conf.container @@ -0,0 +1,17 @@ +# new window using c +unbind c +bind-key c new-window mchsh + +# open ephemeral container using E +bind-key E new-window 'sd_nspawn -e' + +# run commands in systemd-nspawn using r +bind-key r { + command-prompt -p "run command (systemd-nspawn):" { + new-window "sd_nspawn -r '%1'; or exec fish -l" + } +} + +# split panes into systemd-nspawn container using | and - +bind-key | split-window -h mchsh +bind-key - split-window -v mchsh diff --git a/configs/tmux/.tmux.conf.dbx b/configs/tmux/.tmux.conf.dbx deleted file mode 100644 index ab055dfeb..000000000 --- a/configs/tmux/.tmux.conf.dbx +++ /dev/null @@ -1,26 +0,0 @@ -# new window using c -unbind c -bind-key c new-window dbxe - -# run commands in distrobox using r -bind-key r { - command-prompt -p "run command (distrobox):" { - new-window 'dbxe -- fish -c "begin; %1; end; or exec fish -l"' - } -} - -# open specific distrobox container using N -bind-key N { - command-prompt -p "distrobox container:" { - new-window 'dbxe %1; or exec fish -l' - } -} -bind-key E { - command-prompt -p "new ephemeral distrobox container:" { - new-window 'dbxeph %1' - } -} - -# split panes into distrobox container using | and - -bind-key | split-window -h dbxe -bind-key - split-window -v dbxe diff --git a/configs/tmux/.tmux.conf.nspawn b/configs/tmux/.tmux.conf.nspawn deleted file mode 100644 index d7daa22c6..000000000 --- a/configs/tmux/.tmux.conf.nspawn +++ /dev/null @@ -1,17 +0,0 @@ -# new window using c -unbind c -bind-key c new-window mchsh - -# open ephemeral container using E -bind-key E new-window 'sd_nspawn -e' - -# run commands in systemd-nspawn using r -bind-key r { - command-prompt -p "run command (systemd-nspawn):" { - new-window "sd_nspawn -r '%1'; or exec fish -l" - } -} - -# split panes into systemd-nspawn container using | and - -bind-key | split-window -h mchsh -bind-key - split-window -v mchsh diff --git a/configs/tmux/.tmux.conf.nspawn b/configs/tmux/.tmux.conf.nspawn new file mode 120000 index 000000000..e9e148411 --- /dev/null +++ b/configs/tmux/.tmux.conf.nspawn @@ -0,0 +1 @@ +.tmux.conf.container \ No newline at end of file diff --git a/configs/tmux/start-distrobox.fish b/configs/tmux/start-distrobox.fish deleted file mode 100755 index 48dab27c3..000000000 --- a/configs/tmux/start-distrobox.fish +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env fish - -in_container_msg -h; or return -dbx list &| grep -q (dev_img); or dbxc --yes; or return -dbxe -- true diff --git a/configs/tmux/test-dbx.yml b/configs/tmux/test-dbx.yml deleted file mode 100644 index 3bc6ffe2f..000000000 --- a/configs/tmux/test-dbx.yml +++ /dev/null @@ -1,22 +0,0 @@ -session_name: main -before_script: ./start-distrobox.fish -windows: -- window_name: btop and distrobox - panes: - - btop --utf-force - - shell: dbxe - shell_command: - - cmd: cbl_bld_all - enter: false -- window_name: host and distrobox - layout: 775f,269x53,0,0[269x41,0,0,3,269x11,0,42,4] - focus: true - panes: - - shell_command: - - cmd: cbl_qualify_next - enter: false - focus: true - - shell: have_dev_kvm_access; and dbxe - shell_command: - - cmd: cbl_test_kvm vmm - enter: false diff --git a/configs/tmux/test-qemu.yml b/configs/tmux/test-qemu.yml deleted file mode 100644 index 0b53faada..000000000 --- a/configs/tmux/test-qemu.yml +++ /dev/null @@ -1,16 +0,0 @@ -session_name: test-qemu -windows: -- window_name: distrobox and cbl_vmm - focus: true - layout: 26fc,271x54,0,0[271x42,0,0,8,271x11,0,43,9] - start_directory: '~' - panes: - - shell: dbxe - shell_command: - - cmd: ssh_vm - enter: false - - shell: dbxe - shell_command: - - cmd: cbl_test_kvm vmm - enter: false - focus: true diff --git a/configs/tmux/test-nspawn.yml b/configs/tmux/test.yml similarity index 100% rename from configs/tmux/test-nspawn.yml rename to configs/tmux/test.yml diff --git a/fish/config.fish b/fish/config.fish index 2519645c8..695e6437f 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -36,28 +36,13 @@ else end if in_container - # distrobox may add duplicates to PATH, clean it up :/ - # https://github.com/89luca89/distrobox/issues/1145 - if in_dbx - set --local --path deduplicated_path - set --local item - - for item in $PATH - if not contains $item $deduplicated_path - set -a deduplicated_path $item - end - end - set --export --global --path PATH $deduplicated_path - end - - # distrobox uses $USE_CBL, systemd-nspawn uses /etc/use-cbl - if test (cat /etc/use-cbl 2>/dev/null; or echo 0) -eq 1; or test "$USE_CBL" = 1 + if test (cat /etc/use-cbl 2>/dev/null; or echo 0) -eq 1 for item in $CBL_QEMU_BIN $CBL_TC_BNTL $CBL_TC_LLVM fish_add_path -gm $item end end - if in_nspawn; and not test -e /etc/ephemeral; and not set -q GPG_TTY + if not test -e /etc/ephemeral; and not set -q GPG_TTY set -gx GPG_TTY $tty gpg_key_cache end diff --git a/fish/functions/_hydro_addon_nathan.fish b/fish/functions/_hydro_addon_nathan.fish index 4656f8199..12ee30c21 100644 --- a/fish/functions/_hydro_addon_nathan.fish +++ b/fish/functions/_hydro_addon_nathan.fish @@ -16,16 +16,6 @@ function _hydro_addon_nathan -d "Hydro prompt customizations" end # Print symbol if we are in a container (like default toolbox prompt) - if in_dbx - # If CONTAINER_ID is a part of the hostname (i.e., distrobox prior to - # https://github.com/89luca89/distrobox/commit/d626559baaa4e6ccb35b3bb0befc9d46b7aa837e), - # just show a symbol to know we are in a distrobox. - if string match -qr ^$CONTAINER_ID $hostname - set container_str ยง - else - set container_str "($CONTAINER_ID)" - end - end if in_nspawn if set incoming (findmnt -n -o FSROOT /run/host/incoming | sort -u) set container_str '('(string split -f 2 -m 1 -r / $incoming)')' diff --git a/fish/functions/cbl_bld_llvm_korg.fish b/fish/functions/cbl_bld_llvm_korg.fish index 580442938..c0b418d1e 100644 --- a/fish/functions/cbl_bld_llvm_korg.fish +++ b/fish/functions/cbl_bld_llvm_korg.fish @@ -65,13 +65,7 @@ function cbl_bld_llvm_korg -d "Build (and optionally test) LLVM for kernel.org" if test "$test_linux" = y for tc in (fd -a -d 1 -t d . $tmp_llvm_install) for src in $CBL_SRC_C/linux $CBL_SRC_C/linux-stable-$CBL_STABLE_VERSIONS - if using_nspawn - sd_nspawn -r 'cbl_lkt --linux-folder '(nspawn_path -c $src)' --llvm-prefix '(nspawn_path -c $tc) - else if dbx_has_82a69f0 - dbxe -- fish -c "cbl_lkt --linux-folder $src --llvm-prefix $tc" - else - dbxe -- "fish -c 'cbl_lkt --linux-folder $src --llvm-prefix $tc'" - end + sd_nspawn -r 'cbl_lkt --linux-folder '(nspawn_path -c $src)' --llvm-prefix '(nspawn_path -c $tc) or break end or break diff --git a/fish/functions/cbl_gen_vm_boot_files.fish b/fish/functions/cbl_gen_vm_boot_files.fish index fc960cf69..003c74cfb 100644 --- a/fish/functions/cbl_gen_vm_boot_files.fish +++ b/fish/functions/cbl_gen_vm_boot_files.fish @@ -9,12 +9,8 @@ function cbl_gen_vm_boot_files -d "Generate files needed to boot local compiled return 1 end - # Make sure all modules the virtual machine might need are loaded (virtiofs, tun, overlayfs, etc) + # Make sure all modules the virtual machine might need are loaded (virtiofs, etc) ls $HOST_FOLDER 1>/dev/null; or return - if not using_nspawn - # For some reason, container sometimes fails to enter on first try on Alpine. - dbxe -- true; or dbxe -- true; or return - end # Create kernel_files folder set kernel_folder $HOST_FOLDER/kernel_files diff --git a/fish/functions/cbl_test_kvm.fish b/fish/functions/cbl_test_kvm.fish index b96bf59ac..8feb787cd 100644 --- a/fish/functions/cbl_test_kvm.fish +++ b/fish/functions/cbl_test_kvm.fish @@ -42,26 +42,12 @@ function cbl_test_kvm -d "Test KVM against a Clang built kernel with QEMU" case nested in_container_msg -h; or return - # Start container before updating, as podman requires some kernel modules, - # which need to be loaded before updating, as an update to linux will - # remove the modules on disk for the current running kernel version. - if not using_nspawn - dbxe -- true - or return - end - switch $LOCATION case vm updfull mkdir -p $TMP_FOLDER cp -v /boot/vmlinuz-linux $TMP_FOLDER/bzImage - if using_nspawn - sd_nspawn -r 'kboot -a x86_64 -k '(nspawn_path -c $TMP_FOLDER)'/bzImage -t 30s' - else if dbx_has_82a69f0 - dbxe -- fish -c "kboot -a x86_64 -k $TMP_FOLDER/bzImage -t 30s" - else - dbxe -- "fish -c 'kboot -a x86_64 -k $TMP_FOLDER/bzImage -t 30s'" - end + sd_nspawn -r 'kboot -a x86_64 -k '(nspawn_path -c $TMP_FOLDER)'/bzImage -t 30s' end case vmm diff --git a/fish/functions/cbl_upd_krnl.fish b/fish/functions/cbl_upd_krnl.fish index fd5963dd2..542996ec7 100644 --- a/fish/functions/cbl_upd_krnl.fish +++ b/fish/functions/cbl_upd_krnl.fish @@ -85,11 +85,8 @@ function cbl_upd_krnl -d "Update machine's kernel" if in_container cbl_bld_krnl_pkg $bld_krnl_pkg_args return - else if using_nspawn - sd_nspawn -r "cbl_bld_krnl_pkg $bld_krnl_pkg_args" - or return else - dbxe dev-arch -- $PYTHON_SCRIPTS_FOLDER/cbl_bld_krnl_pkg.py $bld_krnl_pkg_args + sd_nspawn -r "cbl_bld_krnl_pkg $bld_krnl_pkg_args" or return end diff --git a/fish/functions/dbx.fish b/fish/functions/dbx.fish deleted file mode 100644 index 29ce30004..000000000 --- a/fish/functions/dbx.fish +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function dbx -d "Calls distrobox based on where it is installed" - run_cmd distrobox $argv -end diff --git a/fish/functions/dbx_has_82a69f0.fish b/fish/functions/dbx_has_82a69f0.fish deleted file mode 100644 index e0537a216..000000000 --- a/fish/functions/dbx_has_82a69f0.fish +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2024 Nathan Chancellor - -function dbx_has_82a69f0 -d "Checks that distrobox is 1.7.0.1 or newer (i.e., contains 82a69f0)" - # https://github.com/89luca89/distrobox/commit/82a69f0a234e73e447d0ea8c8b3443b84fd31944 - distrobox --version | python3 -c "import re, sys - -if not (match := re.search(r'distrobox: ([0-9|.]+)', sys.stdin.read())): - raise RuntimeError('distrobox version changed?') - -distrobox_version = tuple(map(int, match.groups()[0].split('.'))) -sys.exit(0 if distrobox_version >= (1, 7, 0, 1) else 1)" -end diff --git a/fish/functions/dbxc.fish b/fish/functions/dbxc.fish deleted file mode 100644 index bf23a6743..000000000 --- a/fish/functions/dbxc.fish +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function dbxc -d "Shorthand for 'distrobox create'" - in_container_msg -h; or return - - set add_args --pids-limit=-1 - - set i 1 - while test $i -le (count $argv) - set arg $argv[$i] - switch $arg - case -e --env -v - set next (math $i + 1) - set -a add_args $arg $argv[$next] - set i $next - - case -s --skip-cbl - set skip_cbl true - - case --ephemeral - set mode ephemeral - - case --env='*' --volume='*' - set -a add_args $arg - - case --root -Y --yes - set -a dbx_args $arg - - case --volume - set next (math $i + 1) - set -a dbx_args $arg $argv[$next] - set i $next - - case dev/'*' - set img $GHCR/$arg - set name (string replace / - $arg) - - case dev-'*' - set img $GHCR/(string replace - / $arg) - set name $arg - - case '*' - set -a dbx_cmds $arg - end - set i (math $i + 1) - end - - # If not in ephemeral mode, use 'distrobox create' - if not set -q mode - set mode create - end - - # If no image was specified, default to the one for the architecture - if not set -q img - set img (dev_img_gh) - set name (dev_img) - end - - set -a dbx_args -i $img - if test "$mode" = create - set -a dbx_args -n $name - if dbx create --help &| grep -q -- --no-entry - set -a dbx_args --no-entry - end - end - if in_orb - set -a dbx_args --volume $MAC_FOLDER:$MAC_FOLDER - # OrbStack has passwordless sudo, we don't need to bother with a password in distrobox - set -a dbx_args --absolutely-disable-root-password-i-am-really-positively-sure - end - if test -d $OPT_ORB_GUEST - set -a dbx_args --volume $OPT_ORB_GUEST:$OPT_ORB_GUEST - end - - # 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" = (dev_img_gh); and not set -q skip_cbl - set -a add_args --env=USE_CBL=1 - end - - # If we are going to use an Arch Linux container and the host is using - # Reflector to update the mirrorlist, mount the mirrorlist into the - # container so it can enjoy quick updates - if test "$img" = $GHCR/dev/arch; and test -f /etc/xdg/reflector/reflector.conf - set -a add_args --volume=/etc/pacman.d/mirrorlist:/etc/pacman.d/mirrorlist:ro - end - - set dbx_init_hooks $HOME/.local/share/distrobox/init-hooks - mkdir -p $dbx_init_hooks - - if test "$mode" = create - set init_hook_sh $dbx_init_hooks/$name.sh - # to ensure chmod succeeds - touch $init_hook_sh - else - set init_hook_sh (mktemp -p $dbx_init_hooks --suffix=.sh) - end - - chmod +x $init_hook_sh - echo '#!/bin/sh - -user="'"$USER"'" - -if ! grep -q "$user" /etc/doas.conf 2>/dev/null; then - echo "permit nopass $user as root" >>/etc/doas.conf -fi - -# Unconditionally calling host-spawn is not acceptable in my environment -# Should a use for a graphical distrobox container be discovered later, -# a different compatible passthrough scheme can be created at that point. -if grep -q host-spawn /etc/fish/conf.d/distrobox_config.fish; then - sed -i /host-spawn/d /etc/fish/conf.d/distrobox_config.fish -fi' >$init_hook_sh - - if is_hetzner - add_hetzner_mirror_to_repos -p >>$init_hook_sh - end - - # If we are using docker, we need to explicitly set the container's - # kvm group to the same group ID as the host's kvm group if it exists - # so that accelerated VMs work within a container. Do this with an init hook. - if command -q docker; and group_exists kvm - set -l host_kvm_gid (getent group kvm | string split -f 3 :) - - echo ' -target_gid="'"$host_kvm_gid"'" - -group() { - getent group "$@" -} - -group_quiet() { - group "$@" >/dev/null 2>&1 -} - -group_get_field() { - group "${@:2}" | cut -d : -f "$1" -} - -kvm_group_exists() { - group_quiet kvm -} - -kvm_gid() { - kvm_group_exists || return - group_to_gid kvm -} - -target_gid_exists() { - group_quiet "$target_gid" -} - -gid_to_group() { - group_get_field 1 "$@" -} - -group_to_gid() { - group_get_field 3 "$@" -} - -user_in_target_gid() { - target_gid_exists || return - group "$target_gid" | grep -qw "$user" -} - -kvm_gid_mismatch() { - [ "$(kvm_gid)" != "$target_gid" ] -} - -if ! user_in_target_gid; then - if target_gid_exists; then - group=$(gid_to_group "$target_gid") - else - group=kvm - if kvm_gid_mismatch; then - kvm_group_exists && groupdel -f "$group" - groupadd -g "$target_gid" "$group" || exit - fi - fi - usermod -aG "$group" "$user" || exit -fi' >>$init_hook_sh - end - - if test "$mode" = ephemeral - printf '\nrm "%s"\n' $init_hook_sh >>$init_hook_sh - end - - if set -q init_hook_sh - set -p dbx_args --init-hooks $init_hook_sh - end - - if test "$mode" = create - set -p dbx_args -a "$add_args" - else - set -p dbx_args '-a "'$add_args'"' - end - - set final_dbx_cmd dbx $mode $dbx_args $dbx_img $dbx_cmds - print_cmd $final_dbx_cmd - $final_dbx_cmd -end diff --git a/fish/functions/dbxe.fish b/fish/functions/dbxe.fish deleted file mode 100644 index 409f17253..000000000 --- a/fish/functions/dbxe.fish +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function dbxe -d "Shorthand for 'distrobox enter'" - in_container_msg -h; or return - - set i 1 - while test $i -le (count $argv) - set arg $argv[$i] - switch $arg - case -e --env - set next (math $i + 1) - set -a add_args $arg $argv[$next] - set i $next - case --env='*' - set -a add_args $arg - case -- - set end_of_args true - set -a dbx_cmd_args $arg - case '*' - if set -q end_of_args - set -a dbx_cmd_args $arg - else - set dbx_img $arg - end - end - set i (math $i + 1) - end - - if not set -q dbx_img - set dbx_img (dev_img) - end - - if test (count $add_args) -gt 0 - set dbx_args -a "$add_args" - end - - dbx enter $dbx_args $dbx_img $dbx_cmd_args -end diff --git a/fish/functions/dbxeph.fish b/fish/functions/dbxeph.fish deleted file mode 100644 index 5ecc71e65..000000000 --- a/fish/functions/dbxeph.fish +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function dbxeph -d "Shorthand for 'distrobox ephemeral'" - dbxc --ephemeral $argv -end diff --git a/fish/functions/dbxr.fish b/fish/functions/dbxr.fish deleted file mode 100644 index 4ca046a78..000000000 --- a/fish/functions/dbxr.fish +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function dbxr -d "Remove a distrobox container" - if test (count $argv) -eq 0 - set targets (dev_img) - else - set targets $argv - end - - dbx rm -f $targets - rm -fr $ENV_FOLDER/.distrobox/$targets -end diff --git a/fish/functions/dbxrc.fish b/fish/functions/dbxrc.fish deleted file mode 100644 index b08029ebc..000000000 --- a/fish/functions/dbxrc.fish +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2023 Nathan Chancellor - -function dbxrc -d "Recreate a distrobox container" - dbxr $argv - and dbxc $argv - and dbxe $argv -- $PYTHON_SCRIPTS_FOLDER/upd_distro.py -y -end diff --git a/fish/functions/in_dbx.fish b/fish/functions/in_dbx.fish deleted file mode 100644 index 68eed989f..000000000 --- a/fish/functions/in_dbx.fish +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2024 Nathan Chancellor - -function in_dbx -d "Test if currently in a distrobox" - # https://github.com/89luca89/distrobox/blob/3bac964bf0952674848dce170af8b41d743abe57/docs/useful_tips.md?plain=1#L40 - set -q CONTAINER_ID -end diff --git a/fish/functions/oci_bld.fish b/fish/functions/oci_bld.fish deleted file mode 100644 index 3a6018e72..000000000 --- a/fish/functions/oci_bld.fish +++ /dev/null @@ -1,61 +0,0 @@ -# -#/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2021-2023 Nathan Chancellor - -function oci_bld -d "Build an OCI container image" - in_container_msg -h; or return - - for mgr in podman docker none - if command -q $mgr - break - end - end - - switch $mgr - case docker - set mgr_args \ - --no-cache - case podman - set mgr_args \ - --layers=false - case none - print_warning "oci_bld requires podman or docker, skipping..." - return 0 - end - - if set -q GITHUB_TOKEN - set mgr_args \ - --build-arg=GITHUB_TOKEN=$GITHUB_TOKEN - end - - for arg in $argv - switch $arg - case dev dev/{alpine,arch,debian,fedora,suse,ubuntu} - set -a images $arg - end - end - - for image in $images - switch $image - case dev - set folder (dev_img | string replace - /) - set image $folder - - case '*' - set folder $image - end - - pushd $ENV_FOLDER/podman/$folder; or return - - set mgr_build_cmd \ - $mgr build \ - $mgr_args \ - --pull \ - --tag $GHCR/$image . - print_cmd $mgr_build_cmd - $mgr_build_cmd; or return - - popd; or return - end -end diff --git a/fish/functions/oci_cl.fish b/fish/functions/oci_cl.fish deleted file mode 100644 index c11e7eec9..000000000 --- a/fish/functions/oci_cl.fish +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function oci_cl -d "Clean untagged OCI images" - in_container_msg -h; or return - - set images (podman image list &| rg "" &| awk '{print $3}') - - if test -n "$images" - podman image rm $images - end -end diff --git a/fish/functions/oci_ls.fish b/fish/functions/oci_ls.fish deleted file mode 100644 index 68da8530c..000000000 --- a/fish/functions/oci_ls.fish +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function oci_ls -d "Shows OCI containers and images" - in_container_msg -h; or return - - header Containers - podman container ls --all - - header Images - podman image ls --all -end diff --git a/fish/functions/oci_rm.fish b/fish/functions/oci_rm.fish deleted file mode 100644 index 4aff8ea82..000000000 --- a/fish/functions/oci_rm.fish +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function oci_rm -d "Wrapper for oci_rm.py" - in_container_msg -h; or return - - $PYTHON_SCRIPTS_FOLDER/oci_rm.py $argv -end diff --git a/fish/functions/oci_rst_upd.fish b/fish/functions/oci_rst_upd.fish deleted file mode 100644 index b88230053..000000000 --- a/fish/functions/oci_rst_upd.fish +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function oci_rst_upd -d "Reset container storage, download new images, and start new containers" - if command -q docker - docker stop (docker ps -aq) - docker rm (docker ps -aq) - docker rmi (docker images -aq) - end - - if command -q podman - podman system reset --force; or return - - if test "$LOCATION" = pi; and test "$MAIN_FOLDER" != "$HOME" - upd_strg_cfg; or return - end - end - - dbxc --yes; or return - dbxe -- $PYTHON_SCRIPTS_FOLDER/upd_distro.py -y - - if is_location_primary - podman pull $GHCR/dev/{debian,fedora} - end -end diff --git a/fish/functions/run_cmd.fish b/fish/functions/run_cmd.fish index 66d10687a..9267e1ee7 100644 --- a/fish/functions/run_cmd.fish +++ b/fish/functions/run_cmd.fish @@ -46,13 +46,11 @@ function run_cmd -d "Run specified command depending on where it is available" env $nested_cmd $cmd_args else switch $cmd - case b4 distrobox tuxmake + case b4 tuxmake set git_repo $BIN_SRC_FOLDER/$cmd switch $cmd case b4 set cmd_path $git_repo/$cmd.sh - case distrobox - set cmd_path $git_repo/$cmd case tuxmake if string match -qr podman -- $cmd_argv in_container_msg -h; or return diff --git a/fish/functions/tmxa.fish b/fish/functions/tmxa.fish index f7c23e9e6..910b96b3f 100644 --- a/fish/functions/tmxa.fish +++ b/fish/functions/tmxa.fish @@ -6,11 +6,7 @@ function tmxa -d "Attach to a tmux session if it exists, start a new one if not" if test -z "$TMUX" switch $LOCATION case aadp honeycomb pi test-{desktop-intel-{11700,n100},desktop-amd,laptop-intel} - if using_nspawn - set tmuxp_cfg test-nspawn - else - set tmuxp_cfg test-dbx - end + set tmuxp_cfg test case generic if in_orb set tmuxp_cfg primary diff --git a/fish/functions/upd.fish b/fish/functions/upd.fish index a8ab3feda..46aaad35d 100644 --- a/fish/functions/upd.fish +++ b/fish/functions/upd.fish @@ -81,11 +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 - if using_nspawn - sd_nspawn -r "$PYTHON_SCRIPTS_FOLDER/upd_distro.py $yes" - else if has_container_manager; and dbx list &| grep -q (dev_img) - dbxe -- $PYTHON_SCRIPTS_FOLDER/upd_distro.py $yes - end + sd_nspawn -r "$PYTHON_SCRIPTS_FOLDER/upd_distro.py $yes" end if command -q mac mac orb update @@ -134,7 +130,7 @@ function upd -d "Runs the update command for the current distro or downloads/upd set -l submodules switch $target - case b4 bat btop diskus distrobox duf exa fd fzf hyperfine repo rg shellcheck shfmt tuxmake yapf + case b4 bat btop diskus duf exa fd fzf hyperfine repo rg shellcheck shfmt tuxmake yapf if command -q $target; and test "$force" != true print_warning "$target is installed through package manager, skipping install..." continue @@ -149,8 +145,6 @@ function upd -d "Runs the update command for the current distro or downloads/upd set git_clone_args --recursive set git_urls https://git.kernel.org/pub/scm/utils/b4/b4.git set submodules true - case distrobox - set git_urls https://github.com/89luca89/distrobox case tuxmake set git_urls https://gitlab.com/Linaro/tuxmake.git case yapf diff --git a/fish/functions/updfull.fish b/fish/functions/updfull.fish index c79b932c3..1fdb40e75 100644 --- a/fish/functions/updfull.fish +++ b/fish/functions/updfull.fish @@ -2,13 +2,13 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2022-2023 Nathan Chancellor -function updfull -d "Update host machine, shell environment, and main distrobox container" +function updfull -d "Update host machine, shell environment, and main development container" in_container_msg -h or return for arg in $argv switch $arg - case -s --skip-dbx + case -s --skip-container set os_target os-no-container end end diff --git a/fish/functions/user_setup.fish b/fish/functions/user_setup.fish index ed81877c1..968347752 100644 --- a/fish/functions/user_setup.fish +++ b/fish/functions/user_setup.fish @@ -263,6 +263,7 @@ rpmbuild/' >>$gitignore # Configuration files (vim, tmux, etc) set configs $ENV_FOLDER/configs ln -fnrsv $configs/tmux/.tmux.conf.common $HOME/.tmux.conf.common + ln -fnrsv $configs/tmux/.tmux.conf.container $HOME/.tmux.conf.container if test "$LOCATION" = vm ln -fnrsv $configs/tmux/.tmux.conf.vm $HOME/.tmux.conf else @@ -341,46 +342,32 @@ rpmbuild/' >>$gitignore end end - switch (uname -m) - case aarch64 x86_64 - ln -fnrsv $configs/tmux/.tmux.conf.nspawn $HOME/.tmux.conf.container - - # These platforms will more than likely use tmux so ensure the tmux - # directory exists with the expected permissions so that sd_nspawn - # will find it and mount it into the container properly. Even if they - # do not use tmux, creating the directory and passing it through to - # the container is not the end of the world, as no socket will exist. - set tmux_tmp /var/tmp/tmux-(id -u) - mkdir -p $tmux_tmp - # tmux checks that the permissions are restrictive - chmod 700 $tmux_tmp - - sudo true - or return - - # Set up files first because that process is quicker than the build - # process and doas/sudo authorization lasts at least five minutes - sd_nspawn -i - or return - - mkosi_bld - or return - - # '--now' is only supported with systemd 253 or newer but AlmaLinux 9 ships 252 - if test (machinectl --version | string match -gr '^systemd (\d+) ') -ge 253 - sudo machinectl enable --now (dev_img) - else - sudo machinectl enable (dev_img) - and sudo machinectl start (dev_img) - end - - case '*' - ln -fnrsv $configs/tmux/.tmux.conf.dbx $HOME/.tmux.conf.container - - if has_container_manager - upd distrobox - - dbxc --yes - end + # These platforms will more than likely use tmux so ensure the tmux + # directory exists with the expected permissions so that sd_nspawn + # will find it and mount it into the container properly. Even if they + # do not use tmux, creating the directory and passing it through to + # the container is not the end of the world, as no socket will exist. + set tmux_tmp /var/tmp/tmux-(id -u) + mkdir -p $tmux_tmp + # tmux checks that the permissions are restrictive + chmod 700 $tmux_tmp + + sudo true + or return + + # Set up files first because that process is quicker than the build + # process and doas/sudo authorization lasts at least five minutes + sd_nspawn -i + or return + + mkosi_bld + or return + + # '--now' is only supported with systemd 253 or newer but AlmaLinux 9 ships 252 + if test (machinectl --version | string match -gr '^systemd (\d+) ') -ge 253 + sudo machinectl enable --now (dev_img) + else + sudo machinectl enable (dev_img) + and sudo machinectl start (dev_img) end end diff --git a/fish/functions/using_nspawn.fish b/fish/functions/using_nspawn.fish deleted file mode 100644 index 6b0277ee2..000000000 --- a/fish/functions/using_nspawn.fish +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env fish -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -function using_nspawn -d "Checks if host is using systemd-nspawn for development container" - run_py_util_func (status function) -end diff --git a/podman/dev/alpine/Dockerfile b/podman/dev/alpine/Dockerfile deleted file mode 100644 index 376195038..000000000 --- a/podman/dev/alpine/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM docker.io/alpine:edge - -COPY distrobox-check.fish / -COPY dwarves-1.27.tar.xz /tmp -COPY packages/ /tmp/packages/ -COPY setup-env.sh / -RUN sh /setup-env.sh && fish /distrobox-check.fish && rm /distrobox-check.fish /setup-env.sh - -CMD ["/usr/bin/fish", "-l"] diff --git a/podman/dev/alpine/distrobox-check.fish b/podman/dev/alpine/distrobox-check.fish deleted file mode 100644 index ebdcd7739..000000000 --- a/podman/dev/alpine/distrobox-check.fish +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env fish -# Check distrobox dependencies -# https://github.com/89luca89/distrobox/blob/main/docs/distrobox_custom.md - -# Keep this in sync with distrobox-init -set distrobox_dependencies \ - bc \ - bzip2 \ - chpasswd \ - curl \ - diff \ - find \ - findmnt \ - fish \ - gpg \ - hostname \ - less \ - lsof \ - man \ - mount \ - passwd \ - pigz \ - pinentry \ - ping \ - ps \ - rsync \ - script \ - ssh \ - sudo \ - time \ - tree \ - umount \ - unzip \ - useradd \ - wc \ - wget \ - xauth \ - zip - -set ret 0 -for distrobox_dependency in $distrobox_dependencies - if not command -q $distrobox_dependency - echo "distrobox-check.fish: $distrobox_dependency could not be found!" - set ret 1 - end -end -if not test -e /usr/share/zoneinfo/UTC - echo "distrobox-check.fish: UTC zoneinfo file not found, install tzdata?" - set ret 1 -end - -return $ret diff --git a/podman/dev/alpine/dwarves-1.27.tar.xz b/podman/dev/alpine/dwarves-1.27.tar.xz deleted file mode 100644 index b1f1e09a8..000000000 Binary files a/podman/dev/alpine/dwarves-1.27.tar.xz and /dev/null differ diff --git a/podman/dev/alpine/packages/distrobox b/podman/dev/alpine/packages/distrobox deleted file mode 100644 index 2a0cfef9b..000000000 --- a/podman/dev/alpine/packages/distrobox +++ /dev/null @@ -1,23 +0,0 @@ -bc -curl -diffutils -findutils -gnupg -less -lsof -mandoc -man-pages -ncurses -openssh-client -pigz -pinentry -procps -rsync -shadow -sudo -tzdata -util-linux -wget -vte3 -xauth -zip diff --git a/podman/dev/alpine/packages/env b/podman/dev/alpine/packages/env deleted file mode 100644 index 3a6fd5456..000000000 --- a/podman/dev/alpine/packages/env +++ /dev/null @@ -1,15 +0,0 @@ -bat -delta -exa -fd -fish -fzf -git -jq -mutt -python3 -ripgrep -stow -tmux -vim -zoxide diff --git a/podman/dev/alpine/packages/kernel b/podman/dev/alpine/packages/kernel deleted file mode 100644 index e7f17dc43..000000000 --- a/podman/dev/alpine/packages/kernel +++ /dev/null @@ -1,16 +0,0 @@ -bash -bc -bison -build-base -coreutils -elfutils-dev -flex -gawk -openssl -openssl-dev -perl -sed -tar -u-boot-tools -xz -zstd diff --git a/podman/dev/alpine/packages/qemu b/podman/dev/alpine/packages/qemu deleted file mode 100644 index acea93b15..000000000 --- a/podman/dev/alpine/packages/qemu +++ /dev/null @@ -1,14 +0,0 @@ -glib-dev -glib-static -libslirp-dev -pixman-dev -qemu-system-aarch64 -qemu-system-arm -qemu-system-i386 -qemu-system-mips -qemu-system-mipsel -qemu-system-ppc -qemu-system-ppc64 -qemu-system-riscv64 -qemu-system-s390x -qemu-system-x86_64 diff --git a/podman/dev/alpine/packages/toolchains b/podman/dev/alpine/packages/toolchains deleted file mode 100644 index 76f2c7122..000000000 --- a/podman/dev/alpine/packages/toolchains +++ /dev/null @@ -1,9 +0,0 @@ -binutils-dev -clang -cmake -linux-headers -lld -llvm -musl-dev -ninja -texinfo diff --git a/podman/dev/alpine/setup-env.sh b/podman/dev/alpine/setup-env.sh deleted file mode 100644 index f806185e4..000000000 --- a/podman/dev/alpine/setup-env.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -set -eux - -# Update and install packages -install_packages() { - apk update - apk upgrade - - cat /tmp/packages/* | xargs apk add -} - -build_pahole() { - pahole_src=/tmp/dwarves-1.27 - pahole_build=$pahole_src/build - - tar -C "${pahole_src%/*}" -xJf "$pahole_src".tar.xz - - mkdir "$pahole_build" - cd "$pahole_build" - - apk add \ - argp-standalone \ - musl-obstack \ - musl-obstack-dev - cmake \ - -DBUILD_SHARED_LIBS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -D__LIB=lib \ - "$pahole_src" - - make -j"$(nproc)" install - apk del \ - argp-standalone \ - musl-obstack-dev - - command -v pahole - pahole --version - - cd -} - -cleanup() { - rm -r \ - "$pahole_src" \ - "$pahole_src".tar.xz \ - /tmp/packages - rm -fr /tmp/*.patch -} - -install_packages -build_pahole -cleanup diff --git a/podman/dev/arch/Dockerfile b/podman/dev/arch/Dockerfile deleted file mode 100644 index 0703ed226..000000000 --- a/podman/dev/arch/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM ghcr.io/archlinux/archlinux:base-devel - -COPY distrobox-check.fish / -COPY setup-env.sh / -RUN bash /setup-env.sh && fish /distrobox-check.fish && rm /distrobox-check.fish /setup-env.sh - -CMD ["/usr/bin/fish", "-l"] diff --git a/podman/dev/arch/distrobox-check.fish b/podman/dev/arch/distrobox-check.fish deleted file mode 100644 index ebdcd7739..000000000 --- a/podman/dev/arch/distrobox-check.fish +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env fish -# Check distrobox dependencies -# https://github.com/89luca89/distrobox/blob/main/docs/distrobox_custom.md - -# Keep this in sync with distrobox-init -set distrobox_dependencies \ - bc \ - bzip2 \ - chpasswd \ - curl \ - diff \ - find \ - findmnt \ - fish \ - gpg \ - hostname \ - less \ - lsof \ - man \ - mount \ - passwd \ - pigz \ - pinentry \ - ping \ - ps \ - rsync \ - script \ - ssh \ - sudo \ - time \ - tree \ - umount \ - unzip \ - useradd \ - wc \ - wget \ - xauth \ - zip - -set ret 0 -for distrobox_dependency in $distrobox_dependencies - if not command -q $distrobox_dependency - echo "distrobox-check.fish: $distrobox_dependency could not be found!" - set ret 1 - end -end -if not test -e /usr/share/zoneinfo/UTC - echo "distrobox-check.fish: UTC zoneinfo file not found, install tzdata?" - set ret 1 -end - -return $ret diff --git a/podman/dev/arch/setup-env.sh b/podman/dev/arch/setup-env.sh deleted file mode 100644 index 06acdc0b7..000000000 --- a/podman/dev/arch/setup-env.sh +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env bash - -set -eux - -function downgrade_pkg() { - local pkg="$1" - local ver="$2" - - local tarball=/tmp/"$pkg"-"$ver"-x86_64.pkg.tar.zst - local url - url=https://archive.archlinux.org/packages/"$(printf '%.1s' "$pkg")"/"$pkg"/"$(basename "$tarball")" - - curl -LSso "$tarball" "$url" - pacman -U --noconfirm "$tarball" - rm -fr "$tarball" - -} - -# Edit /etc/pacman.conf -function pacman_conf() { - sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf - sed -i 's/^#VerbosePkgLists/VerbosePkgLists/g' /etc/pacman.conf - sed -i 's/^#Color/Color/g' /etc/pacman.conf - sed -i 's/^NoProgressBar/#NoProgressBar/g' /etc/pacman.conf - sed -i 's/^#ParallelDownloads = 5/ParallelDownloads = 7/g' /etc/pacman.conf - sed -i "/\[core-testing\]/,/Include/"'s/^#//' /etc/pacman.conf - sed -i "/\[extra-testing\]/,/Include/"'s/^#//' /etc/pacman.conf - - # Get rid of slimming Docker image changes - sed -i -e "/home\/custompkgs/,/\[options\]/"'s;\[options\];#\[options\];' -e 's;^NoExtract;#NoExtract;g' /etc/pacman.conf - - cat <<'EOF' >>/etc/pacman.conf - -[nathan] -SigLevel = Optional TrustAll -Server = https://raw.githubusercontent.com/nathanchance/arch-repo/main/$arch -EOF - - cat /etc/pacman.conf -} - -# Edit /etc/makepkg.conf to gain some speed up -function makepkg_conf() { - # shellcheck disable=SC2016 - sed -i 's/^#MAKEFLAGS="-j2"/MAKEFLAGS="-j$(nproc)"/g' /etc/makepkg.conf - sed -i 's/^!ccache/ccache/g' /etc/makepkg.conf - - cat /etc/makepkg.conf -} - -function gen_locale() { - sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen - locale-gen -} - -function add_grep_wrappers() { - cat <<'EOF' >/usr/local/bin/egrep -#!/bin/sh - -exec grep -E "$@" -EOF - cat <<'EOF' >/usr/local/bin/fgrep -#!/bin/sh - -exec grep -F "$@" -EOF - chmod 755 /usr/local/bin/{e,f}grep -} - -# Update and install packages -function install_packages() { - # Update archlinux-keyring via partial upgrade and regenerate the keyring - # based on it, in case any new packages are signed with those new keys - pacman -Sy --noconfirm archlinux-keyring - rm -fr /etc/pacman.d/gnupg - pacman-key --init - pacman-key --populate - - pacman -Syyuu --noconfirm - - # Switch to doas over sudo for simplicity - pacman -S --ask 4 --noconfirm opendoas-sudo - - packages=( - # Nicer versions of certain GNU utilities - bat{,-extras} - diskus - eza - fd - ripgrep - - # arc - php - - # b4 - b4 - git-filter-repo - python-dkim - patatt - - # compression/decompression/extraction - bzip2 - gzip - lzop - lz4 - pbzip2 - pigz - unzip - zstd - - # development - ccache - hyperfine - lib32-glibc - python - python-setuptools - python-yaml - ruff - shellcheck-bin - shfmt - yapf - - # distrobox - bc - curl - diffutils - less - lsof - pinentry - time - tree - tzdata - vte-common - wget - xorg-xauth - zip - - # email - lei - mutt - - # env - fastfetch - fish - fzf - jq - less - moreutils - openssh - stow - tmuxp - vim{,-spell-en} - zoxide - - # frame-larger-than.py - python-pyelftools - - # git - git{,-delta} - github-cli - perl-authen-sasl - perl-mime-tools - perl-net-smtp-ssl - repo - - # kernel / tuxmake - {{aarch,powerpc,riscv}64,mips,s390x}-linux-gnu-binutils - arm-linux-gnueabi-binutils - bison - cpio - flex - libelf - inetutils - mkinitcpio - ncurses - openssl - pahole - rsync - socat - sparse - tio - tuxmake - uboot-tools - - # kup - perl-config-simple - - # LLVM/clang + build-llvm.py - clang - cmake - cvise - lld - llvm - ninja - perf - - # man pages - man-db - - # package building - debhelper - devtools - dpkg - pacman-contrib - rpm-tools - - # spdxcheck.py - python-gitpython - python-ply - - # system administration - ipmitool - - # QEMU - edk2-aarch64 - edk2-ovmf - libevent - libutempter - qemu-{emulators-full,guest-agent,img} - virtiofsd - - # website management - hugo - iproute2 - ) - pacman -S --noconfirm "${packages[@]}" -} - -pacman_conf -makepkg_conf -gen_locale -add_grep_wrappers -install_packages diff --git a/podman/dev/debian/Dockerfile b/podman/dev/debian/Dockerfile deleted file mode 100644 index 50954951f..000000000 --- a/podman/dev/debian/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM docker.io/debian:12 - -COPY distrobox-check.fish / -COPY setup-env.sh / -ARG GITHUB_TOKEN -RUN bash /setup-env.sh && fish /distrobox-check.fish && rm /distrobox-check.fish /setup-env.sh - -CMD ["/usr/bin/fish", "-l"] diff --git a/podman/dev/debian/distrobox-check.fish b/podman/dev/debian/distrobox-check.fish deleted file mode 100644 index ebdcd7739..000000000 --- a/podman/dev/debian/distrobox-check.fish +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env fish -# Check distrobox dependencies -# https://github.com/89luca89/distrobox/blob/main/docs/distrobox_custom.md - -# Keep this in sync with distrobox-init -set distrobox_dependencies \ - bc \ - bzip2 \ - chpasswd \ - curl \ - diff \ - find \ - findmnt \ - fish \ - gpg \ - hostname \ - less \ - lsof \ - man \ - mount \ - passwd \ - pigz \ - pinentry \ - ping \ - ps \ - rsync \ - script \ - ssh \ - sudo \ - time \ - tree \ - umount \ - unzip \ - useradd \ - wc \ - wget \ - xauth \ - zip - -set ret 0 -for distrobox_dependency in $distrobox_dependencies - if not command -q $distrobox_dependency - echo "distrobox-check.fish: $distrobox_dependency could not be found!" - set ret 1 - end -end -if not test -e /usr/share/zoneinfo/UTC - echo "distrobox-check.fish: UTC zoneinfo file not found, install tzdata?" - set ret 1 -end - -return $ret diff --git a/podman/dev/debian/setup-env.sh b/podman/dev/debian/setup-env.sh deleted file mode 100644 index e719a6856..000000000 --- a/podman/dev/debian/setup-env.sh +++ /dev/null @@ -1,262 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -function setup_fish_repo() { - export DEBIAN_FRONTEND=noninteractive - - apt-config dump | grep -we Recommends -e Suggests | sed 's/1/0/g' | tee /etc/apt/apt.conf.d/999norecommend - - apt-get update -qq - - apt-get install -y \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg - - # shellcheck disable=SC1091 - source /usr/lib/os-release - # Until OBS supports Debian 12, dependencies should be fine - ( - VERSION_ID=11 - curl -fLSs https://download.opensuse.org/repositories/shells:fish:release:3/Debian_"$VERSION_ID"/Release.key | gpg --dearmor | dd of=/etc/apt/trusted.gpg.d/shells_fish_release_3.gpg - echo "deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_$VERSION_ID/ /" | tee /etc/apt/sources.list.d/shells:fish:release:3.list - ) -} - -function setup_gh_repo() { - curl -fLSs https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/etc/apt/trusted.gpg.d/githubcli-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list -} - -function setup_llvm_repo() { - curl -fLSs https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | dd of=/etc/apt/trusted.gpg.d/apt_llvm_org.gpg - - llvm_main=20 - llvm_stable=19 - llvm_versions=( - "$llvm_main" - "$llvm_stable" - 18 - 17 - 16 - 15 - ) - - for llvm_version in "${llvm_versions[@]}"; do - case $llvm_version in - "$llvm_main") ;; - *) deb_suffix=-$llvm_version ;; - esac - echo "deb http://apt.llvm.org/$VERSION_CODENAME/ llvm-toolchain-$VERSION_CODENAME${deb_suffix:-} main" | tee /etc/apt/sources.list.d/llvm-"$llvm_version".list - done - - # These are not in Bookworm, they should be safe through dependency checks - # though. 11 and 12 cannot be satisfied by the packages in Bookworm unfortunately. - old_llvm_versions=( - 14 - 13 - ) - for old_llvm_version in "${old_llvm_versions[@]}"; do - echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-$old_llvm_version main" | tee /etc/apt/sources.list.d/llvm-"$old_llvm_version".list - done - llvm_versions+=("${old_llvm_versions[@]}") -} - -function install_packages() { - packages=( - # arc - php - - # b4 - python3{,-dkim,-requests} - - # build-binutils.py - file - texinfo - - # cvise - cvise - - # compression / decompression / extraction - bzip2 - gzip - lzop - lz4 - pbzip2 - pigz - tar - unzip - xz-utils - zstd - - # development - build-essential - ccache - - # distrobox - bc - curl - diffutils - iputils-ping - less - libvte-*-common - lsof - pinentry-curses - sudo - time - tree - tzdata - wget - xauth - zip - - # env - ca-certificates - fish - fzf - jq - locales - moreutils - openssh-client - stow - vim - zoxide - - # git - gh - git - git-email - libauthen-sasl-perl - libio-socket-ssl-perl - - # kernel / tuxmake - {binutils,gcc}-{aarch64,mips{,el},riscv64,s390x}-linux-gnu - {binutils,gcc}-arm-linux-gnueabi{,hf} - bison - cpio - flex - kmod - lib{c,dw,elf,ncurses5,ssl}-dev - openssl - qemu-system-{arm,mips,misc,ppc,x86} - rsync - socat - sparse - u-boot-tools - - # LLVM - binutils-dev - cmake - ninja-build - python3-distutils - zlib1g-dev - - # llvm.sh - lsb-release - software-properties-common - - # package building - dpkg - rpm - - # spdxcheck.py - python3-git - python3-ply - ) - for llvm_version in "${llvm_versions[@]}"; do - packages+=( - clang-"$llvm_version" - lld-"$llvm_version" - llvm-"$llvm_version" - ) - done - - apt-get update -qq - - apt-get dist-upgrade -y - - apt-get install -y "${packages[@]}" - - rm -fr /var/lib/apt/lists/* - - ln -fsv /usr/lib/llvm-"$llvm_stable"/bin/* /usr/local/bin - - # Install delta from GitHub - case "$(uname -m)" in - aarch64) delta_arch=arm64 ;; - x86_64) delta_arch=amd64 ;; - esac - api_args=() - if [[ -n ${GITHUB_TOKEN:-} ]]; then - api_args=( - -H "Authorization: Bearer $GITHUB_TOKEN" - -H "Content-Type: application/json" - ) - fi - delta_repo=dandavison/delta - delta_version=$(curl "${api_args[@]}" -LSs https://api.github.com/repos/"$delta_repo"/releases/latest | jq -r .tag_name) - delta_deb=/tmp/git-delta_"$delta_version"_"$delta_arch".deb - curl -LSso "$delta_deb" https://github.com/"$delta_repo"/releases/download/"$delta_version"/"${delta_deb##*/}" - apt install -y "$delta_deb" - rm -fr "$delta_deb" -} - -function check_fish() { - # shellcheck disable=SC2016 - fish_version=$(fish -c 'echo $version' | sed 's;\.;;g') - if [[ $fish_version -lt 340 ]]; then - printf "\n%s is too old!\n" "$(fish --version)" - exit 1 - fi -} - -function setup_locales() { - echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections - echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections - rm -f /etc/locale.gen - dpkg-reconfigure --frontend noninteractive locales -} - -function build_pahole() { - pahole_ver=1.27 - pahole_src=/tmp/dwarves-$pahole_ver - pahole_build=$pahole_src/build - - curl -LSs https://fedorapeople.org/~acme/dwarves/"${pahole_src##*/}".tar.xz | tar -C "${pahole_src%/*}" -xJf - - - mkdir "$pahole_build" - cd "$pahole_build" - - cmake \ - -DBUILD_SHARED_LIBS=OFF \ - -D__LIB=lib \ - "$pahole_src" - - make -j"$(nproc)" install - - command -v pahole - pahole --version - - cd - rm -r "$pahole_src" -} - -function check_tools() { - for binary in clang ld.lld llvm-objcopy; do - "$binary" --version | head -n1 - for llvm_version in "${llvm_versions[@]}"; do - "$binary-$llvm_version" --version | head -n1 - done - done -} - -setup_fish_repo -setup_gh_repo -setup_llvm_repo -install_packages -check_fish -setup_locales -build_pahole -check_tools diff --git a/podman/dev/fedora/Dockerfile b/podman/dev/fedora/Dockerfile deleted file mode 100644 index 4fc132c85..000000000 --- a/podman/dev/fedora/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM registry.fedoraproject.org/fedora:rawhide - -COPY distrobox-check.fish / -COPY setup-env.sh / -RUN bash /setup-env.sh && fish /distrobox-check.fish && rm /distrobox-check.fish /setup-env.sh - -CMD ["/usr/bin/fish", "-l"] diff --git a/podman/dev/fedora/distrobox-check.fish b/podman/dev/fedora/distrobox-check.fish deleted file mode 100644 index ebdcd7739..000000000 --- a/podman/dev/fedora/distrobox-check.fish +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env fish -# Check distrobox dependencies -# https://github.com/89luca89/distrobox/blob/main/docs/distrobox_custom.md - -# Keep this in sync with distrobox-init -set distrobox_dependencies \ - bc \ - bzip2 \ - chpasswd \ - curl \ - diff \ - find \ - findmnt \ - fish \ - gpg \ - hostname \ - less \ - lsof \ - man \ - mount \ - passwd \ - pigz \ - pinentry \ - ping \ - ps \ - rsync \ - script \ - ssh \ - sudo \ - time \ - tree \ - umount \ - unzip \ - useradd \ - wc \ - wget \ - xauth \ - zip - -set ret 0 -for distrobox_dependency in $distrobox_dependencies - if not command -q $distrobox_dependency - echo "distrobox-check.fish: $distrobox_dependency could not be found!" - set ret 1 - end -end -if not test -e /usr/share/zoneinfo/UTC - echo "distrobox-check.fish: UTC zoneinfo file not found, install tzdata?" - set ret 1 -end - -return $ret diff --git a/podman/dev/fedora/setup-env.sh b/podman/dev/fedora/setup-env.sh deleted file mode 100644 index afc729650..000000000 --- a/podman/dev/fedora/setup-env.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/env bash - -set -eux - -function add_grep_wrappers() { - cat <<'EOF' >/usr/local/bin/egrep -#!/bin/sh - -exec grep -E "$@" -EOF - cat <<'EOF' >/usr/local/bin/fgrep -#!/bin/sh - -exec grep -F "$@" -EOF - chmod 755 /usr/local/bin/{e,f}grep -} - -function install_packages() { - dnf update -y - - # https://lwn.net/ml/fedora-devel/CAPtvTsZMBi98PbpwR5NydijsfLAhoQ0GO890jzN4FPd66f0gBw@mail.gmail.com/ - if ! command dnf &>/dev/null; then - dnf5 install -y dnf - fi - - dnf install -y \ - curl \ - dnf-plugins-core - - # https://github.com/rpm-software-management/dnf5/issues/405 - # dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo - curl -LSso /etc/yum.repos.d/gh-cli.repo https://cli.github.com/packages/rpm/gh-cli.repo - - cat </etc/yum.repos.d/tuxmake.repo -[tuxmake] -name=tuxmake -type=rpm-md -baseurl=https://tuxmake.org/packages/ -gpgcheck=1 -gpgkey=https://tuxmake.org/packages/repodata/repomd.xml.key -enabled=1 -EOF - - packages=( - # arc - php - - # b4 - b4 - - # compression/decompression/extraction - bzip2 - gzip - lzop - lz4 - pbzip2 - pigz - tar - unzip - xz - zstd - - # cvise - cvise - python3-chardet - - # development - ccache - glibc-devel - glibc-static - libfl-devel - make - patch - python3 - python3-yapf - texinfo-tex - - # distrobox - bc - cracklib-dicts - diffutils - doas - hostname - iputils - less - lsof - passwd - pinentry - procps-ng - time - tree - tzdata - util-linux-script - vte-profile - wget - xorg-x11-xauth - - # env - bat - fastfetch - fd-find - fish - fzf - jq - moreutils - openssh - python-unversioned-command - stow - tmux - vim - zoxide - - # email - cyrus-sasl-plain - lei - mutt - - # git - gh - git{,-delta,-email} - - # kernel / tuxmake - bison - cpio - {binutils,gcc}-{arm,mips64,powerpc64{,le},riscv64,s390x}-linux-gnu - dwarves - elfutils-libelf-devel - flex - gcc - gcc-c++ - gmp-devel - libmpc-devel - ncurses-devel - openssl{,-devel{,-engine}} - perl - qemu-{guest-agent,img} - qemu-system-{aarch64,arm,loongarch64,mips,ppc,riscv,s390x,x86} - rsync - socat - sparse - uboot-tools - - # LLVM/clang + build-llvm.py - binutils-devel - clang - cmake - lld - llvm - ninja-build - perf - zlib-devel - - # locale - glibc-langpack-en - - # nicer GNU utilities - # retired, leaving around in case it comes back: - # https://bugzilla.redhat.com/show_bug.cgi?id=2262203 - # eza - ripgrep - - # package building - dpkg-dev - rpm-build - - # pahole - elfutils-devel - - # spdxcheck.py - python3-GitPython - python3-ply - - # website management - hugo - iproute - ) - - case "$(uname -m)" in - aarch64) packages+=({binutils,gcc}-x86_64-linux-gnu) ;; - x86_64) packages+=({binutils,gcc}-aarch64-linux-gnu) ;; - esac - - dnf install -y "${packages[@]}" - - # Remove sudo in favor of doas but leave a symlink for compatibility - rm -f /etc/dnf/protected.d/sudo.conf - if dnf list --installed sudo &>/dev/null; then - dnf remove -y sudo - fi - ln -frsv /usr/{bin/doas,local/bin/sudo} -} - -function check_fish() { - # shellcheck disable=SC2016 - fish_version=$(fish -c 'echo $version' | sed -e 's;-.*$;;g' -e 's;\.;;g') - if [[ $fish_version -lt 340 ]]; then - printf "\n%s is too old!\n" "$(fish --version)" - exit 1 - fi -} - -add_grep_wrappers -install_packages -check_fish diff --git a/podman/dev/suse/Dockerfile b/podman/dev/suse/Dockerfile deleted file mode 100644 index b9fa7d563..000000000 --- a/podman/dev/suse/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM docker.io/opensuse/tumbleweed - -COPY distrobox-check.fish / -COPY setup-env.sh / -RUN bash /setup-env.sh && fish /distrobox-check.fish && rm /distrobox-check.fish /setup-env.sh - -CMD ["/usr/bin/fish", "-l"] diff --git a/podman/dev/suse/distrobox-check.fish b/podman/dev/suse/distrobox-check.fish deleted file mode 100644 index ebdcd7739..000000000 --- a/podman/dev/suse/distrobox-check.fish +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env fish -# Check distrobox dependencies -# https://github.com/89luca89/distrobox/blob/main/docs/distrobox_custom.md - -# Keep this in sync with distrobox-init -set distrobox_dependencies \ - bc \ - bzip2 \ - chpasswd \ - curl \ - diff \ - find \ - findmnt \ - fish \ - gpg \ - hostname \ - less \ - lsof \ - man \ - mount \ - passwd \ - pigz \ - pinentry \ - ping \ - ps \ - rsync \ - script \ - ssh \ - sudo \ - time \ - tree \ - umount \ - unzip \ - useradd \ - wc \ - wget \ - xauth \ - zip - -set ret 0 -for distrobox_dependency in $distrobox_dependencies - if not command -q $distrobox_dependency - echo "distrobox-check.fish: $distrobox_dependency could not be found!" - set ret 1 - end -end -if not test -e /usr/share/zoneinfo/UTC - echo "distrobox-check.fish: UTC zoneinfo file not found, install tzdata?" - set ret 1 -end - -return $ret diff --git a/podman/dev/suse/setup-env.sh b/podman/dev/suse/setup-env.sh deleted file mode 100644 index 6ddd55c58..000000000 --- a/podman/dev/suse/setup-env.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env bash - -set -eux - -function install_packages() { - zypper -n ar https://cli.github.com/packages/rpm/gh-cli.repo - - # Manually import GPG key, as it seems this no longer happens automatically? - gh_gpg_url=$(sed -n 's/^gpgkey=\(.*\)$/\1/p' /etc/zypp/repos.d/gh-cli.repo) - gh_gpg_dest=/tmp/gh-cli.asc - curl -LSso $gh_gpg_dest "$gh_gpg_url" - rpm --import $gh_gpg_dest - rm -f $gh_gpg_dest - - zypper -n dup - - # Uninstall busybox-diffutils if it was installed during the distribution - # upgrade, as it will conflict with diffutils below - if zypper search -i busybox-diffutils; then - zypper -n remove busybox-diffutils - fi - - packages=( - # arc - php - - # b4 - python3-{dkimpy,requests} - - # compression/decompression/extraction - bzip2 - gzip - lzop - lz4 - pbzip2 - pigz - tar - unzip - xz - zstd - - # cvise - cvise - python3-chardet - - # development - ccache - make - patch - python2 - python3 - texinfo - - # distrobox - bc - curl - diffutils - findutils - hostname - iputils - less - libvte-2* - lsof - pinentry - shadow - sudo - time - timezone - tree - util-linux{,-systemd} - wget - xauth - zip - - # email - cyrus-sasl-plain - mutt - - # env - bat - fd - fish - fzf - jq - moreutils - openssh - stow - vim - zoxide - - # git - gh - git{,-delta,-email} - - # kernel / tuxmake - bison - cpio - dwarves - flex - gcc - gcc-c++ - libelf-devel - libopenssl-devel - ncurses-devel - perl - qemu-{arm,extra,ppc,s390x,x86} - rsync - socat - sparse - u-boot-tools - - # LLVM/clang - clang - cmake - lld - ninja - zlib-devel - - # package building - dpkg-dev - rpmbuild - - # spdxcheck.py - python3-GitPython - python3-ply - ) - - host_arch=$(uname -m) - # No GCC for you! - if [[ ! $host_arch =~ arm ]]; then - packages+=(cross-{arm,mips,ppc64,s390x}-gcc13) - case "$host_arch" in - aarch64) packages+=(cross-x86_64-gcc13) ;; - x86_64) packages+=(cross-aarch64-gcc13) ;; - esac - fi - - zypper -n in "${packages[@]}" - # Force reinstall ca-certificates and ca-certificates-mozilla, otherwise - # curl barfs - zypper -n in -f ca-certificates{,-mozilla} -} - -function check_fish() { - # shellcheck disable=SC2016 - fish_version=$(fish -c 'echo $version' | sed 's;\.;;g') - if [[ $fish_version -lt 340 ]]; then - printf "\n%s is too old!\n" "$(fish --version)" - exit 1 - fi -} - -install_packages -check_fish diff --git a/podman/dev/ubuntu/Dockerfile b/podman/dev/ubuntu/Dockerfile deleted file mode 100644 index c6b9171d3..000000000 --- a/podman/dev/ubuntu/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -# Switch back to rolling when https://github.com/llvm/llvm-project/issues/90536 is fixed -FROM docker.io/ubuntu:22.04 - -COPY distrobox-check.fish / -COPY setup-env.sh / -ARG GITHUB_TOKEN -RUN bash /setup-env.sh && fish /distrobox-check.fish && rm /distrobox-check.fish /setup-env.sh - -CMD ["/usr/bin/fish", "-l"] diff --git a/podman/dev/ubuntu/distrobox-check.fish b/podman/dev/ubuntu/distrobox-check.fish deleted file mode 100644 index ebdcd7739..000000000 --- a/podman/dev/ubuntu/distrobox-check.fish +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env fish -# Check distrobox dependencies -# https://github.com/89luca89/distrobox/blob/main/docs/distrobox_custom.md - -# Keep this in sync with distrobox-init -set distrobox_dependencies \ - bc \ - bzip2 \ - chpasswd \ - curl \ - diff \ - find \ - findmnt \ - fish \ - gpg \ - hostname \ - less \ - lsof \ - man \ - mount \ - passwd \ - pigz \ - pinentry \ - ping \ - ps \ - rsync \ - script \ - ssh \ - sudo \ - time \ - tree \ - umount \ - unzip \ - useradd \ - wc \ - wget \ - xauth \ - zip - -set ret 0 -for distrobox_dependency in $distrobox_dependencies - if not command -q $distrobox_dependency - echo "distrobox-check.fish: $distrobox_dependency could not be found!" - set ret 1 - end -end -if not test -e /usr/share/zoneinfo/UTC - echo "distrobox-check.fish: UTC zoneinfo file not found, install tzdata?" - set ret 1 -end - -return $ret diff --git a/podman/dev/ubuntu/setup-env.sh b/podman/dev/ubuntu/setup-env.sh deleted file mode 100644 index ae199d7c6..000000000 --- a/podman/dev/ubuntu/setup-env.sh +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -function setup_fish_repo() { - export DEBIAN_FRONTEND=noninteractive - - apt-config dump | grep -we Recommends -e Suggests | sed 's/1/0/g' | tee /etc/apt/apt.conf.d/999norecommend - - apt-get update -qq - - apt-get install -qq \ - curl \ - gnupg \ - software-properties-common - - apt-add-repository -y ppa:fish-shell/release-3 -} - -function setup_gh_repo() { - curl -fLSs https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/etc/apt/trusted.gpg.d/githubcli-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list >/dev/null -} - -function install_packages() { - packages=( - # arc - php - - # build-binutils.py - file - texinfo - - # b4 - python3{,-dkim,-requests} - - # cvise - cvise - - # compression / decompression / extraction - bzip2 - gzip - lzop - lz4 - pbzip2 - pigz - tar - unzip - xz-utils - zstd - - # development - build-essential - ccache - - # distrobox - bc - curl - diffutils - iputils-ping - less - libvte-*-common - lsof - pinentry-curses - sudo - time - tree - tzdata - wget - xauth - zip - - # env - ca-certificates - fish - fzf - jq - locales - moreutils - openssh-client - stow - vim - zoxide - - # git - gh - git - git-email - libauthen-sasl-perl - libio-socket-ssl-perl - - # kernel / tuxmake - {binutils,gcc}-{aarch64,mips{,el},riscv64,s390x}-linux-gnu - {binutils,gcc}-arm-linux-gnueabi{,hf} - bison - cpio - flex - kmod - lib{c,dw,elf,ncurses5,ssl}-dev - openssl - qemu-system-{arm,mips,misc,ppc,x86} - rsync - socat - sparse - u-boot-tools - - # LLVM - binutils-dev - clang - cmake - lld - llvm - ninja-build - python3-distutils - zlib1g-dev - - # llvm.sh - lsb-release - - # package building - dpkg - rpm - - # spdxcheck.py - python3-git - python3-ply - ) - - apt-get update -qq - - apt-get dist-upgrade -qq - - apt-get install -qq "${packages[@]}" - - rm -fr /var/lib/apt/lists/* - - ln -fsv /usr/lib/llvm-*/bin/* /usr/local/bin - - # Install delta from GitHub - case "$(uname -m)" in - aarch64) delta_arch=arm64 ;; - x86_64) delta_arch=amd64 ;; - esac - delta_repo=dandavison/delta - api_args=() - if [[ -n ${GITHUB_TOKEN:-} ]]; then - api_args=( - -H "Authorization: Bearer $GITHUB_TOKEN" - -H "Content-Type: application/json" - ) - fi - delta_version=$(curl "${api_args[@]}" -LSs https://api.github.com/repos/"$delta_repo"/releases/latest | jq -r .tag_name) - delta_deb=/tmp/git-delta_"$delta_version"_"$delta_arch".deb - curl -LSso "$delta_deb" https://github.com/"$delta_repo"/releases/download/"$delta_version"/"${delta_deb##*/}" - apt install -y "$delta_deb" - rm -fr "$delta_deb" -} - -function check_fish() { - # shellcheck disable=SC2016 - fish_version=$(fish -c 'echo $version' | sed 's;\.;;g') - if [[ $fish_version -lt 340 ]]; then - printf "\n%s is too old!\n" "$(fish --version)" - exit 1 - fi -} - -function setup_locales() { - echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections - echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections - rm -f /etc/locale.gen - dpkg-reconfigure --frontend noninteractive locales -} - -function build_pahole() { - pahole_ver=1.27 - pahole_src=/tmp/dwarves-$pahole_ver - pahole_build=$pahole_src/build - - curl -LSs https://fedorapeople.org/~acme/dwarves/"${pahole_src##*/}".tar.xz | tar -C "${pahole_src%/*}" -xJf - - - mkdir "$pahole_build" - cd "$pahole_build" - - cmake \ - -DBUILD_SHARED_LIBS=OFF \ - -D__LIB=lib \ - "$pahole_src" - - make -j"$(nproc)" install - - command -v pahole - pahole --version - - cd - rm -r "$pahole_src" -} - -function check_tools() { - for binary in clang ld.lld llvm-objcopy; do - "$binary" --version | head -n1 - done -} - -setup_fish_repo -setup_gh_repo -install_packages -check_fish -setup_locales -build_pahole -check_tools diff --git a/python/lib/utils.py b/python/lib/utils.py index d303e36dc..a256d1b52 100755 --- a/python/lib/utils.py +++ b/python/lib/utils.py @@ -199,11 +199,6 @@ def run_check_rc_zero(*args, **kwargs): return chronic(*args, **kwargs, check=False).returncode == 0 -def using_nspawn(): - etc_nspawn = Path('/etc/systemd/nspawn') - return etc_nspawn.exists() and list(etc_nspawn.iterdir()) - - def print_or_run_cmd(cmd, dryrun, end='\n\n'): if dryrun: print_cmd(cmd, end=end) diff --git a/python/scripts/oci_rm.py b/python/scripts/oci_rm.py deleted file mode 100755 index 7b9f6bc86..000000000 --- a/python/scripts/oci_rm.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python3 -# SPDX-License-Identifier: MIT -# Copyright (C) 2022-2023 Nathan Chancellor - -from argparse import ArgumentParser -import json -from pathlib import Path -import shutil -import sys - -sys.path.append(str(Path(__file__).resolve().parents[1])) -# pylint: disable=wrong-import-position -import lib.utils -# pylint: enable=wrong-import-position - - -def oci_json(target): - podman_out = lib.utils.chronic(['podman', target, 'ls', '--all', '--format', 'json']).stdout - return json.loads(podman_out) - - -def parse_arguments(): - parser = ArgumentParser() - - target_choices = ['containers', 'images'] - parser.add_argument('-t', - '--targets', - choices=target_choices, - default=target_choices, - metavar='TARGETS', - nargs='+', - help='Items to potentially remove (default: %(default)s).') - - return parser.parse_args() - - -def podman_rm(target, items): - lib.utils.run(['podman', target, 'rm', '--force', *items], show_cmd=True) - print() - - -def remove(target): - target_cmd = target.rstrip('s') - fzf_choices = [] - json_data = oci_json(target_cmd) - - for json_item in json_data: - item_id = json_item['Id'] - if 'Image' in json_item: # Container item - container_name = json_item['Names'][0] - image_name = json_item['Image'] - fzf_choices += [f"{item_id} | {image_name} | {container_name}"] - elif 'Containers' in json_item: # Image item - if 'Names' in json_item: - image_name = json_item['Names'][0] - else: - image_name = f" (was: {json_item['History'][0]})" - fzf_choices += [f"{item_id} | {image_name}"] - - items_to_remove = [ - item.split(' ')[0] for item in lib.utils.fzf(target.capitalize(), '\n'.join(fzf_choices)) - ] - if items_to_remove: - podman_rm(target_cmd, items_to_remove) - - -if __name__ == '__main__': - if not shutil.which('podman'): - raise RuntimeError('podman could not be found?') - - args = parse_arguments() - - for podman_target in args.targets: - remove(podman_target) diff --git a/python/scripts/tmxrun.py b/python/scripts/tmxrun.py index f1914b5e5..485d27226 100755 --- a/python/scripts/tmxrun.py +++ b/python/scripts/tmxrun.py @@ -53,10 +53,7 @@ tmx_cmd.append('-d') if mode == 'container': - if lib.utils.using_nspawn() or lib.utils.in_nspawn(): - CMD_STR = f"sd_nspawn -r '{args.cmd}'; or exec fish -l" - else: - CMD_STR = f"dbxe -- fish -c '{args.cmd}'; or exec fish -l" + CMD_STR = f"sd_nspawn -r '{args.cmd}'; or exec fish -l" else: CMD_STR = f"begin; {args.cmd}; end; or exec fish -l" tmx_cmd.append(CMD_STR) diff --git a/python/setup/alpine.py b/python/setup/alpine.py index a6f978476..bb3577713 100755 --- a/python/setup/alpine.py +++ b/python/setup/alpine.py @@ -49,7 +49,6 @@ def update_and_install_packages(): # Development 'autoconf', 'automake', - 'distrobox', 'gcc', 'hyperfine', 'linux-headers', diff --git a/python/setup/arch.py b/python/setup/arch.py index e374b5b82..ee58253c0 100755 --- a/python/setup/arch.py +++ b/python/setup/arch.py @@ -445,7 +445,6 @@ def pacman_install_packages(): 'aardvark-dns', 'buildah', 'catatonit', - 'distrobox', 'netavark', 'podman',