Ignore the user; change group of files inside docker

This commit is contained in:
uditaren 2020-03-27 09:56:28 +01:00
parent 7e5e2559b0
commit d76db82aaa

View File

@ -10,7 +10,9 @@ if [[ ! -e $1 || ! -e $2 ]]; then
echo "Use groupfile1 as the basis and merges missing entries from groupfile2"
fi
cat $1
cat $1 | grep -v ":1000:"
# yes, group assignments of the host user will remain, but it won't hurt
echo "# merged entries:"
cat $2 | while read grp; do
name=$(echo $grp | cut -d ':' -f 1)
@ -20,6 +22,10 @@ cat $2 | while read grp; do
line=$(cat $1 | grep -E "^$name:")
if [[ $line == "" ]]; then
echo $name:$pass:$(($dgid + 2000)):$rest
ngid=$(($dgid + 2000))
echo $name:$pass:$ngid:$rest
if [[ -e /.dockerenv ]]; then
find / -group $dgid -mount -exec chgrp ngid {} \;
fi
fi
done