SHA256
1
0
forked from pool/docker

Accepting request 755959 from home:cyphar:docker

- Support older SLE systems which don't have "usermod -w -v".

OBS-URL: https://build.opensuse.org/request/show/755959
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=331
This commit is contained in:
Aleksa Sarai 2019-12-12 00:16:15 +00:00 committed by Git OBS Bridge
parent 97db855981
commit 5ebf4bf2c7
2 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Dec 11 23:55:40 UTC 2019 - Aleksa Sarai <asarai@suse.com>
- Support older SLE systems which don't have "usermod -w -v".
-------------------------------------------------------------------
Mon Nov 18 04:46:31 UTC 2019 - Aleksa Sarai <asarai@suse.com>

View File

@ -419,12 +419,21 @@ getent group docker >/dev/null || groupadd -r docker
# used for --userns-remap=default.
getent passwd dockremap >/dev/null || \
useradd -Ur -p '!' -s /bin/false -c 'docker --userns-remap=default' dockremap
# /etc/sub[ug]id should exist already (it's part of shadow-utils), but older
# distros don't have it. Docker just parses it and doesn't need any special
# shadow-utils helpers.
touch /etc/subuid /etc/subgid ||:
# "useradd -r" doesn't add sub[ug]ids so we manually add some. Hopefully there
# aren't any conflicts here, because usermod doesn't provide the same "get
# unusued range" feature that dockremap does.
touch /etc/sub{uid,gid}
grep -q '^dockremap:' /etc/sub{uid,gid} || \
usermod -v 100000000-200000000 -w 100000000-200000000 dockremap
grep -q '^dockremap:' /etc/subuid || \
usermod -v 100000000-200000000 dockremap &>/dev/null || \
echo "dockremap:100000000:100000001" >>/etc/subuid ||:
grep -q '^dockremap:' /etc/subgid || \
usermod -w 100000000-200000000 dockremap &>/dev/null || \
echo "dockremap:100000000:100000001" >>/etc/subgid ||:
%service_add_pre %{realname}.service