From dc40972cd87ee4f20b5d2b72718447ed89cd4b4c Mon Sep 17 00:00:00 2001 From: Jordon Bedwell <jordon@envygeeks.io> Date: Thu, 30 Apr 2020 04:35:00 -0500 Subject: [PATCH] More cleanup. --- repos/jekyll/copy/all/usr/jekyll/bin/bundle | 16 +++++++-------- .../jekyll/copy/all/usr/jekyll/bin/entrypoint | 20 ++++++++----------- repos/jekyll/copy/all/usr/jekyll/bin/jekyll | 17 ++++++++-------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/repos/jekyll/copy/all/usr/jekyll/bin/bundle b/repos/jekyll/copy/all/usr/jekyll/bin/bundle index f80ad36..3e8903c 100755 --- a/repos/jekyll/copy/all/usr/jekyll/bin/bundle +++ b/repos/jekyll/copy/all/usr/jekyll/bin/bundle @@ -3,28 +3,26 @@ exe=/usr/local/bin/bundle set -e -# -- +# # Skip out if we aren't UID=0 because it's Jekyll # Don't prevent the user from doing normal bundle stuff # this is really rare but can happen during debugs -# -- +# if [[ ! -f "Gemfile" ]] || [ "$(id -u)" != "0" ]; then exec $exe "$@" fi - - -# -- +# # Make sure we have permissions. -# -- +# + if [ "$1" = "install" ] || [ "$1" = "clean" ] || [ "$1" = "update" ]; then - if [ "$(stat -c '%U' $BUNDLE_HOME)" != "jekyll" ]; then - chown -R jekyll:jekyll $BUNDLE_HOME + if [ "$(stat -c '%U' "$BUNDLE_HOME")" != "jekyll" ]; then + chown -R jekyll:jekyll "$BUNDLE_HOME" fi fi -# -- if [ "$1" = "install" ] || [ "$1" = "update" ]; then # There is no need to report that we are using check. if [ "$1" = "update" ] || ! su-exec jekyll $exe check 1>/dev/null 2>&1; then diff --git a/repos/jekyll/copy/all/usr/jekyll/bin/entrypoint b/repos/jekyll/copy/all/usr/jekyll/bin/entrypoint index f7ecbaf..1657761 100755 --- a/repos/jekyll/copy/all/usr/jekyll/bin/entrypoint +++ b/repos/jekyll/copy/all/usr/jekyll/bin/entrypoint @@ -2,31 +2,28 @@ [ "$DEBUG" = "true" ] && set -x set -e -# -- -# Running rootless means that we force Jekyll to run -# entirely as 'root'. This is substituted by the container +# +# Running rootless means that we force Jekyll to run +# entirely as 'root'. This is substituted by the container # to the uid of the actual user. -# -- +# if [ "$JEKYLL_ROOTLESS" ]; then JEKYLL_UID=0 JEKYLL_GID=0 fi -# -- : ${JEKYLL_UID:=$(id -u jekyll)} : ${JEKYLL_GID:=$(id -g jekyll)} - -# -- export JEKYLL_UID export JEKYLL_GID -# -- +# # Users can customize our UID's to fit their own so that # we don't have to chown constantly. Well it's not like # we do so much of it (anymore) it's slow, but we do # change permissions which can result in some bad # behavior on OS X. -# -- +# if [ "$JEKYLL_UID" != "0" ] && [ "$JEKYLL_UID" != "$(id -u jekyll)" ]; then usermod -u $JEKYLL_UID jekyll groupmod -g $JEKYLL_GID jekyll @@ -38,14 +35,13 @@ if [ "$JEKYLL_UID" != "0" ] && [ "$JEKYLL_UID" != "$(id -u jekyll)" ]; then done fi -# -- +# # Make sure JEKYLL matches the UID/GID # This will most likely end up as 1 -# -- +# if [ "$JEKYLL_ROOTLESS" ]; then usermod -o -u $JEKYLL_UID jekyll groupmod -o -g $JEKYLL_GID jekyll fi -# -- exec "$@" diff --git a/repos/jekyll/copy/all/usr/jekyll/bin/jekyll b/repos/jekyll/copy/all/usr/jekyll/bin/jekyll index 8e752d3..4ae2ba7 100755 --- a/repos/jekyll/copy/all/usr/jekyll/bin/jekyll +++ b/repos/jekyll/copy/all/usr/jekyll/bin/jekyll @@ -2,16 +2,16 @@ [ "$DEBUG" = "true" ] && set -x set -e -args=$(default-args $@) +args=$(default-args "$@") -# -- +# # The assumption here is that if we aren't ID 0 then # something we wrapped, recalled us, so we need to ship # them to the right spot. This can happen in one # scenario (when you do `jekyll new`.) -# -- +# if [ "$(id -u)" != "0" ]; then - exec $BUNDLE_BIN/jekyll "$@" + exec "$BUNDLE_BIN/jekyll" "$@" fi [ -d ".cache" ] && chown -R jekyll:jekyll .cache @@ -19,17 +19,18 @@ fi [ -d ".sass-cache" ] && chown -R jekyll:jekyll .sass-cache [ -d "_site" ] && chown -R jekyll:jekyll _site -# -- +# # Install if the user has a Gemfile. # Install if we are also connecteds. -# -- +# if [ -f "Gemfile" ] && connected; then bundle install fi +ruby --version + sup_args="" exe=$BUNDLE_BIN/jekyll -echo "$(ruby --version)" [ "$JEKYLL_DOCKER_TAG" = "pages" ] && sup_args="-r github-pages" [ -x "$exe" ] && exec su-exec jekyll bundle exec ruby $sup_args $exe $args -su-exec jekyll ruby $sup_args $GEM_BIN/jekyll $args +su-exec jekyll ruby $sup_args "$GEM_BIN/jekyll" $args -- GitLab