shellcheck fixes
This commit is contained in:
parent
9b22fbb982
commit
b9c03f5094
1 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# detect userid:groupid of contents of data folder
|
# detect userid:groupid of contents of data folder
|
||||||
DATA_DIR="${DATA_DIR:-/data}"
|
DATA_DIR="${DATA_DIR:-/data}"
|
||||||
|
@ -7,7 +7,7 @@ ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}"
|
||||||
# Autodetect UID and GID of host user based on ownership of files in the volume
|
# Autodetect UID and GID of host user based on ownership of files in the volume
|
||||||
USID=$(stat --format="%u" "$DATA_DIR")
|
USID=$(stat --format="%u" "$DATA_DIR")
|
||||||
GRID=$(stat --format="%g" "$DATA_DIR")
|
GRID=$(stat --format="%g" "$DATA_DIR")
|
||||||
COMMAND="$@"
|
COMMAND="$*"
|
||||||
|
|
||||||
# run django as the host user's uid:gid so that any files touched have the same permissions as outside the container
|
# run django as the host user's uid:gid so that any files touched have the same permissions as outside the container
|
||||||
# e.g. ./manage.py runserver
|
# e.g. ./manage.py runserver
|
||||||
|
@ -15,8 +15,8 @@ COMMAND="$@"
|
||||||
chown "$USID":"$GRID" "$DATA_DIR"
|
chown "$USID":"$GRID" "$DATA_DIR"
|
||||||
|
|
||||||
if [[ "$USID" != 0 && "$GRID" != 0 ]]; then
|
if [[ "$USID" != 0 && "$GRID" != 0 ]]; then
|
||||||
usermod -u $USID $ARCHIVEBOX_USER
|
usermod -u "$USID" "$ARCHIVEBOX_USER"
|
||||||
groupmod -g $GRID $ARCHIVEBOX_USER
|
groupmod -g "$GRID" "$ARCHIVEBOX_USER"
|
||||||
chown -R "$USID":"$GRID" "/home/$ARCHIVEBOX_USER"
|
chown -R "$USID":"$GRID" "/home/$ARCHIVEBOX_USER"
|
||||||
fi
|
fi
|
||||||
gosu $ARCHIVEBOX_USER bash -c "$COMMAND"
|
gosu "$ARCHIVEBOX_USER" bash -c "$COMMAND"
|
||||||
|
|
Loading…
Reference in a new issue