Skip to content

Commit

Permalink
Merge pull request #4 from linuxserver/path-fixes
Browse files Browse the repository at this point in the history
Path fixes #2
  • Loading branch information
aptalca authored Feb 21, 2019
2 parents 19e69d4 + bbf88d1 commit 64c4208
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Empty file.
32 changes: 12 additions & 20 deletions root/etc/cont-init.d/50-config
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
#!/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" ]] && \
cp /app/grocy/config-dist.php /config/data/config.php
cp /app/grocy/config-dist.php /config/data/config.php

[[ ! -f "/config/data/plugins/DemoBarcodeLookupPlugin.php" ]] && \
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
cp -R /defaults/plugins /config/data

chown -R abc:abc \
/app/grocy \
/config
/app/grocy \
/config

0 comments on commit 64c4208

Please sign in to comment.