1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

step down from host root LUID

This commit is contained in:
Kyle Spearrin 2018-03-27 22:56:50 -04:00
parent 68427fd2de
commit 443822fd52

View File

@ -1,20 +1,28 @@
#!/bin/bash
NOUSER=`id -u bitwarden > /dev/null 2>&1; echo $?`
USERNAME="bitwarden"
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
LUID=${LOCAL_UID:-999}
if [ $NOUSER == 0 ] && [ `id -u bitwarden` != $LUID ]
# Step down from host root
if [ $LUID == 0 ]
then
usermod -u $LUID bitwarden
elif [ $NOUSER == 1 ]
then
useradd -r -u $LUID -g bitwarden bitwarden
LUID=999
fi
chown -R bitwarden:bitwarden /etc/bitwarden
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
then
usermod -u $LUID $USERNAME
elif [ $NOUSER == 1 ]
then
useradd -r -u $LUID -g $USERNAME $USERNAME
fi
chown -R $USERNAME:$USERNAME /etc/bitwarden
cp /etc/bitwarden/web/settings.js /app/js/settings.js
cp /etc/bitwarden/web/app-id.json /app/app-id.json
chown -R bitwarden:bitwarden /app
chown -R bitwarden:bitwarden /bitwarden_server
chown -R $USERNAME:$USERNAME /app
chown -R $USERNAME:$USERNAME /bitwarden_server
gosu bitwarden:bitwarden dotnet /bitwarden_server/Server.dll \
gosu $USERNAME:$USERNAME dotnet /bitwarden_server/Server.dll \
/contentRoot=/app /webRoot=. /serveUnknown=false