Move basic devel container setup into separate script for easier use

This commit is contained in:
Martchus 2024-02-24 21:14:20 +01:00
parent d8d4e8ca94
commit c8813289e6
2 changed files with 21 additions and 13 deletions

View File

@ -121,19 +121,8 @@ for this purpose.
Here are some example commands how one might do that:
```
# create a directory to store builds and new container and start it
mkdir -p /hdd/build/container
podman container create -it \
--name archlinux-devel-container \ # give container a meaningful name
-v /hdd/cache/pacman/pkg:/var/cache/pacman/pkg \ # share pacman cache accross different containers
-v /hdd/build/container:/build \ # expose build directory to host
-v /hdd/projects:/src \ # access source files from host
-v /hdd/chroot/remote-config-x86_64:/cfg \ # mount directory containing pacman.conf/makepkg.conf
archlinux-base-devel
podman container start archlinux-devel-container
# configure pacman to use config from mounted directory
podman container exec archlinux-devel-container bash -c "$(cat devel/container/containersync)"
# do basic container setup
containers/create-devel-container-example
# start interactive shell in container
podman container exec -it archlinux-devel-container bash

View File

@ -0,0 +1,19 @@
#!/bin/bash
dev_dir=/hdd
bindir=$(dirname "$0")
# create a directory to store builds and new container and start it
mkdir -p "$dev_dir/build/container"
# create container sharing pacman cache, chroot directory and build and source directory with host
podman container create -it \
--name archlinux-devel-container \
-v "$dev_dir/cache/pacman/pkg:/var/cache/pacman/pkg" \
-v "$dev_dir/build/container:/build" \
-v "$dev_dir/projects:/src" \
-v "$dev_dir/chroot/remote-config-x86_64:/cfg" \
archlinux-base-devel
# configure pacman to use config from mounted directory
podman container start archlinux-devel-container
podman container exec archlinux-devel-container bash -c "$(cat "$bindir/containersync")"