my #build #container framework:
sudo unshare \
--fork \
--mount \
--uts \
sh -c "
mkdir -p $ROOTFS/proc
mkdir -p $ROOTFS/sys
mkdir -p $ROOTFS/dev
mount -t sysfs /sys $ROOTFS/sys
mount -t proc /proc $ROOTFS/proc
mount --rbind /dev $ROOTFS/dev
hostname $MACHINE
su $USER
export PUAVO_CACHE_PROXY=$PUAVO_CACHE_PROXY
sudo unshare --root $ROOTFS $CMDLINE
"
container hack for build: unshare + chroot. unshare guarantees unmounts, given a ephemeral file system namespace :-)
#!/bin/sh
set -eu
rootfs_dir=$1
adm_user=$2
if [ "$#" -eq 3 ]; then
proxy_address=""
cmdline=$3
else
proxy_address=$3
cmdline=$4
fi
sudo unshare --mount --pid --fork sh -c "
mount --bind /sys '$rootfs_dir/sys'
mount --bind /dev '$rootfs_dir/dev'
mount -t proc proc '$rootfs_dir/proc'
mount -t devpts devpts '$rootfs_dir/dev/pts'
chroot '$rootfs_dir' su - '$adm_user' -c 'export PUAVO_CACHE_PROXY=\"$proxy_address\"; $cmdline'
"
My fourth Obnam 3 development session. Put into place the scaffolding to add chunk encryption, but didn't have the time to actually implement the encryption.
Small steps and tea is the way to reach goals while having fun.
(Obnam 3 is my Sunday project to experiment with implementing fundamental components for backup software.)