1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

bash script updates

This commit is contained in:
Kyle Spearrin 2017-08-19 21:45:13 -04:00
parent b095a3b6fd
commit 9057815041
5 changed files with 65 additions and 35 deletions

View File

@ -1,8 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
YEAR=$(date +'%Y')
cat << "EOF" cat << "EOF"
_ _ _ _ _ _ _ _
| |__ (_) |___ ____ _ _ __ __| | ___ _ __ | |__ (_) |___ ____ _ _ __ __| | ___ _ __
@ -14,44 +12,78 @@ EOF
cat << EOF cat << EOF
Open source password management solutions Open source password management solutions
Copyright 2015-$YEAR, 8bit Solutions LLC Copyright 2015-$(date +'%Y'), 8bit Solutions LLC
https://bitwarden.com, https://github.com/bitwarden https://bitwarden.com, https://github.com/bitwarden
EOF EOF
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" OS="linux"
DOCKER_DIR="./docker"
GITHUB_BASE_URL="https://raw.githubusercontent.com/bitwarden/core/master"
OUTPUT=~/bitwarden
if [ $# -eq 2 ] if [ $# -eq 2 ]
then then
OUTPUT=$2 if [ $2 == "mac" -o $2 == "linux" ]
then
OS=$2
fi
fi fi
function dowloadRunFiles { DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
curl -s -o run.sh $GITHUB_BASE_URL/scripts/run.ps1 OUTPUT="$DIR/bitwarden"
if [ $# -eq 3 ]
then
OUTPUT=$3
fi
if [ ! -d "$OUTPUT" ]
then
mkdir $OUTPUT
fi
SCRIPTS_DIR="$OUTPUT/scripts"
DOCKER_DIR="$SCRIPTS_DIR/docker"
GITHUB_BASE_URL="https://raw.githubusercontent.com/bitwarden/core/master"
if [ ! -d "$SCRIPTS_DIR" ]
then
mkdir $SCRIPTS_DIR
fi
function downloadRunFiles() {
curl -s -o $SCRIPTS_DIR/run.sh $GITHUB_BASE_URL/scripts/run.ps1
curl -s -o $DOCKER_DIR/docker-compose.yml $GITHUB_BASE_URL/docker/docker-compose.yml curl -s -o $DOCKER_DIR/docker-compose.yml $GITHUB_BASE_URL/docker/docker-compose.yml
curl -s -o $DOCKER_DIR/docker-compose.linux.yml $GITHUB_BASE_URL/docker/docker-compose.linux.yml curl -s -o $DOCKER_DIR/docker-compose.$OS.yml $GITHUB_BASE_URL/docker/docker-compose.$OS.yml
curl -s -o $DOCKER_DIR/global.env $GITHUB_BASE_URL/docker/global.env curl -s -o $DOCKER_DIR/global.env $GITHUB_BASE_URL/docker/global.env
curl -s -o $DOCKER_DIR/mssql.env $GITHUB_BASE_URL/docker/mssql.env curl -s -o $DOCKER_DIR/mssql.env $GITHUB_BASE_URL/docker/mssql.env
} }
if [ $1 == 'install' ] if [ $1 == 'install' ]
then then
curl -s -o install.sh $GITHUB_BASE_URL/scripts/install.sh curl -s -o $SCRIPTS_DIR/install.sh $GITHUB_BASE_URL/scripts/install.sh
chmod u+x install.sh chmod u+x $SCRIPTS_DIR/install.sh
./install.sh $OUTPUT $SCRIPTS_DIR/install.sh $OUTPUT
elif [ $1 == 'run' -o $1 == 'restart' ] elif [ $1 == 'run' -o $1 == 'restart' ]
then then
# if [ ! -d "$DOCKER_DIR" ]
then
mkdir $DOCKER_DIR
downloadRunFiles
fi
chmod u+x $SCRIPTS_DIR/run.sh
$SCRIPTS_DIR/run.sh $DOCKER_DIR $OS
elif [ $1 == 'update' ] elif [ $1 == 'update' ]
then then
# if [ -d "$DOCKER_DIR" ]
then
rm -rf $DOCKER_DIR
fi
mkdir $DOCKER_DIR
downloadRunFiles
$SCRIPTS_DIR/run.sh $DOCKER_DIR $OS
elif [ $1 == 'updatedb' ] elif [ $1 == 'updatedb' ]
then then
curl -s -o update-db.sh $GITHUB_BASE_URL/scripts/update-db.sh curl -s -o $SCRIPTS_DIR/update-db.sh $GITHUB_BASE_URL/scripts/update-db.sh
chmod u+x update-db.sh chmod u+x $SCRIPTS_DIR/update-db.sh
./update-db.sh $OUTPUT $SCRIPTS_DIR/update-db.sh $OUTPUT
else else
echo "No command found." echo "No command found."
fi fi

View File

@ -4,7 +4,7 @@ set -e
docker --version docker --version
echo "" echo ""
OUTPUT_DIR=~/bitwarden OUTPUT_DIR="../."
if [ $# -eq 1 ] if [ $# -eq 1 ]
then then
OUTPUT_DIR=$1 OUTPUT_DIR=$1
@ -14,7 +14,7 @@ mkdir -p $OUTPUT_DIR
read -p "(!) Enter the domain name for your bitwarden instance (ex. bitwarden.company.com): " DOMAIN read -p "(!) Enter the domain name for your bitwarden instance (ex. bitwarden.company.com): " DOMAIN
read -p "(!) Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n): " LETS_ENCRYPT read -p "(!) Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n): " LETS_ENCRYPT
if [ $LETS_ENCRYPT == 'y' ] if [ $LETS_ENCRYPT == "y" ]
then then
read -p "(!) Enter your email address (Let's Encrypt will send you certificate expiration reminders): " EMAIL read -p "(!) Enter your email address (Let's Encrypt will send you certificate expiration reminders): " EMAIL
mkdir -p $OUTPUT_DIR/letsencrypt/live/$DOMAIN mkdir -p $OUTPUT_DIR/letsencrypt/live/$DOMAIN

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOCKER_DIR=$DIR/../docker
docker --version
docker-compose --version
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.mac.yml down
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.mac.yml up -d

View File

@ -3,9 +3,18 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOCKER_DIR=$DIR/../docker DOCKER_DIR=$DIR/../docker
OS="linux"
if [ $# -eq 1 ]
then
DOCKER_DIR=$1
fi
if [ $# -eq 2 ]
then
OS=$2
fi
docker --version docker --version
docker-compose --version docker-compose --version
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.linux.yml down docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.$OS.yml down
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.linux.yml up -d docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.$OS.yml up -d

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
OUTPUT_DIR=~/bitwarden OUTPUT_DIR="../."
if [ $# -eq 1 ] if [ $# -eq 1 ]
then then
OUTPUT_DIR=$1 OUTPUT_DIR=$1