File: util.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 (15 lines) | stat: -rw-r--r-- 290 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

set -eu -o pipefail

function exec_netns() {
    if [ $EUID -eq 0 ]; then
        nsenter -t $PID -F -n -- "$@"
    else
        nsenter -t $PID -F -U --preserve-credentials -n -- "$@"
    fi
}

function exec_lxc() {
    sudo lxc exec $NAME -- sudo --login --user ubuntu "$@"
}