File: launch_test_lxc.sh

package info (click to toggle)
golang-github-rootless-containers-bypass4netns 0.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 596 kB
  • sloc: sh: 1,936; python: 542; makefile: 33
file content (20 lines) | stat: -rwxr-xr-x 598 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

set -ux -o pipefail
IMAGE=${1:-"ubuntu:22.04"}

cd $(dirname $0)

# lxd init --auto --storage-backend=btrfs
sudo lxc launch -c security.privileged=true -c security.nesting=true $IMAGE test
sudo lxc config device add test share disk source=$(cd ../; pwd) path=/host
sudo lxc exec test -- /bin/bash -c "echo 'ubuntu ALL=NOPASSWD: ALL' | EDITOR='tee -a' visudo"
# let user services running
# this sometimes fails, retry until success
RES=1
while [ $RES -ne 0 ]
do
    sleep 1
    sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sudo loginctl enable-linger"
    RES=$?
done