From fbacfba133e02e244d36bb59defdf9fa6632da0e Mon Sep 17 00:00:00 2001 From: Homer <19776252+homerr@users.noreply.github.com> Date: Tue, 5 Feb 2019 20:32:05 +0000 Subject: [PATCH 1/3] fixed path issues in init files --- root/defaults/plugins/.placeholder | 0 root/etc/cont-init.d/50-config | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 root/defaults/plugins/.placeholder diff --git a/root/defaults/plugins/.placeholder b/root/defaults/plugins/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index f106456..ee56a7c 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -8,8 +8,9 @@ mkdir -p \ [[ ! -f "/config/data/config.php" ]] && \ cp /app/grocy/config-dist.php /config/data/config.php +# check for plugins existence, copy if required [[ ! -f "/config/data/plugins/DemoBarcodeLookupPlugin.php" ]] && \ - cp -R /defaults/plugins /config/data + cp -R /defaults/plugins/ /config/data # create symlinks symlinks=( \ From 94d0035343f4e9ab477b56ae5f4e8d0c9bff367b Mon Sep 17 00:00:00 2001 From: j0nnymoe Date: Sat, 9 Feb 2019 09:58:34 +0000 Subject: [PATCH 2/3] Update 50-config adjust symlink --- root/etc/cont-init.d/50-config | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index ee56a7c..b5bd5a9 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -2,29 +2,21 @@ # create directory structure mkdir -p \ - /config/data/{plugins,viewcache} + /config/data/{plugins,viewcache} # check for config file and copy default if needed [[ ! -f "/config/data/config.php" ]] && \ - cp /app/grocy/config-dist.php /config/data/config.php + cp /app/grocy/config-dist.php /config/data/config.php -# check for plugins existence, copy if required [[ ! -f "/config/data/plugins/DemoBarcodeLookupPlugin.php" ]] && \ - cp -R /defaults/plugins/ /config/data + cp -R /defaults/plugins /config/data # create symlinks -symlinks=( \ -/app/grocy/data/plugins \ -/app/grocy/data/viewcache \ -/app/grocy/data -) - -for i in "${symlinks[@]}" -do -[[ -e "$i" && ! -L "$i" ]] && rm -rf "$i" -[[ ! -L "$i" ]] && ln -s /config/"$(basename "$i")" "$i" -done +i=/app/grocy/data +[[ -e "$i" && ! -L "$i" ]] && \ +rm -rf "$i" && \ +ln -s /config/"$(basename "$i")" "$i" chown -R abc:abc \ - /app/grocy \ - /config + /app/grocy \ + /config From bbf88d11bb9781c5c1a8aa540e71a85b71624b9a Mon Sep 17 00:00:00 2001 From: thelamer Date: Thu, 21 Feb 2019 12:38:39 -0800 Subject: [PATCH 3/3] fixes for symlink init, purge the folder if we allready have a config data dir and move if this is a first run --- root/etc/cont-init.d/50-config | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index b5bd5a9..32ed0f5 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -1,8 +1,13 @@ #!/usr/bin/with-contenv bash -# create directory structure -mkdir -p \ - /config/data/{plugins,viewcache} +# create symlinks +i=/app/grocy/data +[[ -e "$i" && ! -L "$i" && -e /config/"$(basename "$i")" ]] && \ + rm -Rf "$i" && \ + ln -s /config/"$(basename "$i")" "$i" +[[ -e "$i" && ! -L "$i" ]] && \ + mv "$i" /config/"$(basename "$i")" && \ + ln -s /config/"$(basename "$i")" "$i" # check for config file and copy default if needed [[ ! -f "/config/data/config.php" ]] && \ @@ -11,12 +16,6 @@ mkdir -p \ [[ ! -f "/config/data/plugins/DemoBarcodeLookupPlugin.php" ]] && \ cp -R /defaults/plugins /config/data -# create symlinks -i=/app/grocy/data -[[ -e "$i" && ! -L "$i" ]] && \ -rm -rf "$i" && \ -ln -s /config/"$(basename "$i")" "$i" - chown -R abc:abc \ /app/grocy \ /config