Skip to content

Commit e2f65ec

Browse files
authored
Merge pull request #6 from ai-traders/faster-fix-uid-gid
Do not run chown dojo home dir when uid/gid matches
2 parents 6f76549 + 1136255 commit e2f65ec

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 0.4.1 (2019-Apr-29)
2+
* do not run chown dojo home dir when uid/gid matches
3+
14
### 0.4.0 (2019-Apr-27)
25

36
* added e2e tests on alpine and ubuntu18, executed in `inception-dojo` image

image_scripts/src/50-fix-uid-gid.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,16 @@ fi
4343
# but on Alpine, there is no --numeric-uid-gid option
4444
newuid=$(ls -n -d "${dojo_work}" | awk '{ print $3 }')
4545
newgid=$(ls -n -d "${dojo_work}" | awk '{ print $4 }')
46+
olduid=$(ls -n -d ${dojo_home} | awk '{ print $3 }')
47+
oldgid=$(ls -n -d ${dojo_home} | awk '{ print $4 }')
4648

4749
( set -x; usermod -u "${newuid}" "${owner_username}"; groupmod -g "${newgid}" "${owner_groupname}"; )
48-
( set -x; chown ${newuid}:${newgid} -R "${dojo_home}"; )
50+
51+
if [[ "${olduid}" == "${newuid}" ]] && [[ "${oldgid}" == "${newgid}" ]]; then
52+
echo "No need to chown ${dojo_home}"
53+
else
54+
( set -x; chown ${newuid}:${newgid} -R "${dojo_home}"; )
55+
fi
4956

5057
# do not chown the "$dojo_work" directory, it already has proper uid and gid,
51-
# besides, when "$dojo_work" is very big, chown would take much time
58+
# besides, when "$dojo_work" is very big, chown would take long time

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package main
2-
const DojoVersion = "0.4.0"
2+
const DojoVersion = "0.4.1"
33

0 commit comments

Comments
 (0)