Skip to content

Commit

Permalink
Merge pull request #6 from ai-traders/faster-fix-uid-gid
Browse files Browse the repository at this point in the history
Do not run chown dojo home dir when uid/gid matches
  • Loading branch information
tomzo authored Apr 29, 2019
2 parents 6f76549 + 1136255 commit e2f65ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 0.4.1 (2019-Apr-29)
* do not run chown dojo home dir when uid/gid matches

### 0.4.0 (2019-Apr-27)

* added e2e tests on alpine and ubuntu18, executed in `inception-dojo` image
Expand Down
11 changes: 9 additions & 2 deletions image_scripts/src/50-fix-uid-gid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,16 @@ fi
# but on Alpine, there is no --numeric-uid-gid option
newuid=$(ls -n -d "${dojo_work}" | awk '{ print $3 }')
newgid=$(ls -n -d "${dojo_work}" | awk '{ print $4 }')
olduid=$(ls -n -d ${dojo_home} | awk '{ print $3 }')
oldgid=$(ls -n -d ${dojo_home} | awk '{ print $4 }')

( set -x; usermod -u "${newuid}" "${owner_username}"; groupmod -g "${newgid}" "${owner_groupname}"; )
( set -x; chown ${newuid}:${newgid} -R "${dojo_home}"; )

if [[ "${olduid}" == "${newuid}" ]] && [[ "${oldgid}" == "${newgid}" ]]; then
echo "No need to chown ${dojo_home}"
else
( set -x; chown ${newuid}:${newgid} -R "${dojo_home}"; )
fi

# do not chown the "$dojo_work" directory, it already has proper uid and gid,
# besides, when "$dojo_work" is very big, chown would take much time
# besides, when "$dojo_work" is very big, chown would take long time
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main
const DojoVersion = "0.4.0"
const DojoVersion = "0.4.1"

0 comments on commit e2f65ec

Please sign in to comment.