different groups host<>guest mapping

This commit is contained in:
mrrudy 2022-10-22 21:27:06 +02:00
parent db9e449b2b
commit 7279ac22c1

View file

@ -272,7 +272,7 @@ lxc.idmap: u 0 100000 65536
EOF
#TODO internalize code to generate mapping instad of using external python script
LXC_SUB_CONF=$(python3 -c "$(wget -qLO - https://raw.githubusercontent.com/ddimick/proxmox-lxc-idmapper/master/run.py)" \
${VIDEO_GID}=${VIDEO_GID} ${TTY_GID}=${TTY_GID} ${INPUT_GID}=${INPUT_GID} ${AUDIO_GID}=${AUDIO_GID})
${VIDEO_GID}=$(getent group video | cut -d: -f3) ${TTY_GID}=$(getent group tty | cut -d: -f3) ${INPUT_GID}=$(getent group input | cut -d: -f3) ${AUDIO_GID}=$(getent group audio | cut -d: -f3))
echo "$LXC_SUB_CONF" | grep 'lxc.idmap: g ' >> $LXC_CONFIG
# on host add rights to map gids but only if they are not already in the file
echo "$LXC_SUB_CONF" | sed -n '/subgid/,// { /subgid/! p }' | while read line; do cat /etc/subgid | sed 's/[[:blank:]]*//g' | grep -qxF "$line" || echo $line >> /etc/subgid; done