diff --git a/docker.changes b/docker.changes index daa5157..ad6ee1c 100644 --- a/docker.changes +++ b/docker.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Dec 11 23:55:40 UTC 2019 - Aleksa Sarai + +- Support older SLE systems which don't have "usermod -w -v". + ------------------------------------------------------------------- Mon Nov 18 04:46:31 UTC 2019 - Aleksa Sarai diff --git a/docker.spec b/docker.spec index 246f6bb..11c8c8f 100644 --- a/docker.spec +++ b/docker.spec @@ -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