mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 13:08:17 -05:00
42 lines
876 B
Bash
42 lines
876 B
Bash
#!/bin/bash
|
|
|
|
USERNAME="bitwarden"
|
|
NOUSER=`id -u $USERNAME > /dev/null 2>&1; echo $?`
|
|
LUID=${LOCAL_UID:-999}
|
|
|
|
# Step down from host root
|
|
if [ $LUID == 0 ]
|
|
then
|
|
LUID=999
|
|
fi
|
|
|
|
if [ $NOUSER == 0 ] && [ `id -u $USERNAME` != $LUID ]
|
|
then
|
|
usermod -u $LUID $USERNAME
|
|
elif [ $NOUSER == 1 ]
|
|
then
|
|
useradd -r -u $LUID -g $USERNAME $USERNAME
|
|
fi
|
|
|
|
if [ ! -d "/home/$USERNAME" ]
|
|
then
|
|
mkhomedir_helper $USERNAME
|
|
fi
|
|
|
|
touch /var/log/cron.log
|
|
chown $USERNAME:$USERNAME /var/log/cron.log
|
|
chown -R $USERNAME:$USERNAME /app
|
|
chown -R $USERNAME:$USERNAME /jobs
|
|
mkdir -p /etc/bitwarden/core
|
|
mkdir -p /etc/bitwarden/logs
|
|
mkdir -p /etc/bitwarden/ca-certificates
|
|
chown -R $USERNAME:$USERNAME /etc/bitwarden
|
|
|
|
env >> /etc/environment
|
|
cron
|
|
|
|
cp /etc/bitwarden/ca-certificates/*.crt /usr/local/share/ca-certificates/ \
|
|
&& update-ca-certificates
|
|
|
|
gosu bitwarden:bitwarden dotnet /app/Api.dll
|