Skip to content

Commit

Permalink
add reown_r for recursive, fix compatibility mode
Browse files Browse the repository at this point in the history
  • Loading branch information
feederbox826 committed Nov 23, 2023
1 parent cca867c commit f9f0636
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ services:
environment:
- PUID=1000
- PGID=1000
- MIGRATE=TRUE
# - MIGRATE=TRUE
volumes:
- E:/Workspace/stash-dev-media:/media/stash
- E:/Workspace/stash-dev/config:/config
- E:/Workspace/stash-dev/root:/root/.stash
#- E:/Workspace/stash-dev/pip:/pip-install
- pip:/pip-install
deploy:
resources:
Expand Down
16 changes: 12 additions & 4 deletions stash/root/opt/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@
# setup UID/GID
PUID=${PUID:-911}
PGID=${PGID:-911}
UMASK=${UMASK:-002}

###
# FUNCTIONS
###

reown() {
if [ -n "$SKIP_CHOWN" ]; then
return
fi
chown stash:stash "$1"
}

reown_r() {
if [ -n "$SKIP_CHOWN" ]; then
return
fi
Expand All @@ -27,7 +33,7 @@ reown() {

mkown() {
mkdir -p "$1"
reown "$1"
reown_r "$1"
}

## migration helpers
Expand All @@ -39,7 +45,7 @@ migrate_update() {
# old path doesn't exist, create instead
if [ -e "$OLD_PATH" ]; then
mv -n "$OLD_PATH" "$NEW_PATH"
reown "$NEW_PATH"
reown_r "$NEW_PATH"
else
mkown "$NEW_PATH"
fi
Expand Down Expand Up @@ -109,7 +115,7 @@ stashapp_stash_migration() {
echo "leftover files:"
ls -la "$CONFIG_ROOT"
# reown files
reown "/config"
reown_r "/config"
# symlink old directory for compatibility
echo "symlinking $CONFIG_ROOT to /config"
rmdir "$CONFIG_ROOT" && ln -s "/config" "$CONFIG_ROOT"
Expand All @@ -127,6 +133,8 @@ try_migrate() {
else
if [ -e "/root/.stash" ]; then
echo "WARNING: /root/.stash exists, but MIGRATE is not set. This may cause issues."
reown "/root/"
reown_r "/root/.stash"
export STASH_CONFIG_FILE="/root/.stash/config.yml"
fi
fi
Expand Down

0 comments on commit f9f0636

Please sign in to comment.