mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 05:28:15 -05:00
making the bash script command sections a bit easier to read (#1085)
This commit is contained in:
parent
2dc0fe3b31
commit
970712e014
@ -103,53 +103,54 @@ EOT
|
|||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
|
|
||||||
if [ "$1" == "install" ]
|
case $1 in
|
||||||
then
|
"install")
|
||||||
checkOutputDirNotExists
|
checkOutputDirNotExists
|
||||||
mkdir -p $OUTPUT
|
mkdir -p $OUTPUT
|
||||||
downloadRunFile
|
downloadRunFile
|
||||||
$SCRIPTS_DIR/run.sh install $OUTPUT $COREVERSION $WEBVERSION
|
$SCRIPTS_DIR/run.sh install $OUTPUT $COREVERSION $WEBVERSION
|
||||||
elif [ "$1" == "start" -o "$1" == "restart" ]
|
;;
|
||||||
then
|
"start" | "restart")
|
||||||
checkOutputDirExists
|
checkOutputDirExists
|
||||||
$SCRIPTS_DIR/run.sh restart $OUTPUT $COREVERSION $WEBVERSION
|
$SCRIPTS_DIR/run.sh restart $OUTPUT $COREVERSION $WEBVERSION
|
||||||
elif [ "$1" == "update" ]
|
;;
|
||||||
then
|
"update")
|
||||||
checkOutputDirExists
|
checkOutputDirExists
|
||||||
downloadRunFile
|
downloadRunFile
|
||||||
$SCRIPTS_DIR/run.sh update $OUTPUT $COREVERSION $WEBVERSION
|
$SCRIPTS_DIR/run.sh update $OUTPUT $COREVERSION $WEBVERSION
|
||||||
elif [ "$1" == "rebuild" ]
|
;;
|
||||||
then
|
"rebuild")
|
||||||
checkOutputDirExists
|
checkOutputDirExists
|
||||||
$SCRIPTS_DIR/run.sh rebuild $OUTPUT $COREVERSION $WEBVERSION
|
$SCRIPTS_DIR/run.sh rebuild $OUTPUT $COREVERSION $WEBVERSION
|
||||||
elif [ "$1" == "updateconf" ]
|
;;
|
||||||
then
|
"updateconf")
|
||||||
checkOutputDirExists
|
checkOutputDirExists
|
||||||
$SCRIPTS_DIR/run.sh updateconf $OUTPUT $COREVERSION $WEBVERSION
|
$SCRIPTS_DIR/run.sh updateconf $OUTPUT $COREVERSION $WEBVERSION
|
||||||
elif [ "$1" == "updatedb" ]
|
;;
|
||||||
then
|
"updatedb")
|
||||||
checkOutputDirExists
|
checkOutputDirExists
|
||||||
$SCRIPTS_DIR/run.sh updatedb $OUTPUT $COREVERSION $WEBVERSION
|
$SCRIPTS_DIR/run.sh updatedb $OUTPUT $COREVERSION $WEBVERSION
|
||||||
elif [ "$1" == "stop" ]
|
;;
|
||||||
then
|
"stop")
|
||||||
checkOutputDirExists
|
checkOutputDirExists
|
||||||
$SCRIPTS_DIR/run.sh stop $OUTPUT $COREVERSION $WEBVERSION
|
$SCRIPTS_DIR/run.sh stop $OUTPUT $COREVERSION $WEBVERSION
|
||||||
elif [ "$1" == "renewcert" ]
|
;;
|
||||||
then
|
"renewcrt")
|
||||||
checkOutputDirExists
|
checkOutputDirExists
|
||||||
$SCRIPTS_DIR/run.sh renewcert $OUTPUT $COREVERSION $WEBVERSION
|
$SCRIPTS_DIR/run.sh renewcert $OUTPUT $COREVERSION $WEBVERSION
|
||||||
elif [ "$1" == "updaterun" ]
|
;;
|
||||||
then
|
"updaterun")
|
||||||
checkOutputDirExists
|
checkOutputDirExists
|
||||||
downloadRunFile
|
downloadRunFile
|
||||||
elif [ "$1" == "updateself" ]
|
;;
|
||||||
then
|
"updateself")
|
||||||
downloadSelf && echo "Updated self." && exit
|
downloadSelf && echo "Updated self." && exit
|
||||||
elif [ "$1" == "help" ]
|
;;
|
||||||
then
|
"help")
|
||||||
listCommands
|
listCommands
|
||||||
else
|
;;
|
||||||
echo "No command found."
|
*)
|
||||||
echo
|
echo "No command found."
|
||||||
listCommands
|
echo
|
||||||
fi
|
listCommands
|
||||||
|
esac
|
||||||
|
@ -172,6 +172,23 @@ function updateDatabase() {
|
|||||||
echo "Database update complete"
|
echo "Database update complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updatebw() {
|
||||||
|
CORE_ID=$(docker-compose ps -q admin)
|
||||||
|
WEB_ID=$(docker-compose ps -q web)
|
||||||
|
if docker inspect --format='{{.Config.Image}}:' $CORE_ID | grep -F ":$COREVERSION:" | grep -q ":[0-9.]*:$" &&
|
||||||
|
docker inspect --format='{{.Config.Image}}:' $WEB_ID | grep -F ":$WEBVERSION:" | grep -q ":[0-9.]*:$"
|
||||||
|
then
|
||||||
|
echo "Update not needed"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
dockerComposeDown
|
||||||
|
update withpull
|
||||||
|
restart
|
||||||
|
dockerPrune
|
||||||
|
echo "Pausing 60 seconds for database to come online. Please wait..."
|
||||||
|
sleep 60
|
||||||
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
if [ "$1" == "withpull" ]
|
if [ "$1" == "withpull" ]
|
||||||
then
|
then
|
||||||
@ -211,48 +228,36 @@ function pullSetup() {
|
|||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
|
|
||||||
if [ "$1" == "install" ]
|
case $1 in
|
||||||
then
|
"install")
|
||||||
install
|
install
|
||||||
elif [ "$1" == "start" -o "$1" == "restart" ]
|
;;
|
||||||
then
|
"start" | "restart")
|
||||||
restart
|
restart
|
||||||
elif [ "$1" == "pull" ]
|
;;
|
||||||
then
|
"pull")
|
||||||
dockerComposePull
|
dockerComposePull
|
||||||
elif [ "$1" == "stop" ]
|
;;
|
||||||
then
|
"stop")
|
||||||
dockerComposeDown
|
dockerComposeDown
|
||||||
elif [ "$1" == "renewcert" ]
|
;;
|
||||||
then
|
"renewcert")
|
||||||
certRestart
|
certRestart
|
||||||
elif [ "$1" == "updateconf" ]
|
;;
|
||||||
then
|
"updateconf")
|
||||||
dockerComposeDown
|
dockerComposeDown
|
||||||
update withpull
|
update withpull
|
||||||
elif [ "$1" == "updatedb" ]
|
;;
|
||||||
then
|
"updatedb")
|
||||||
updateDatabase
|
updateDatabase
|
||||||
elif [ "$1" == "update" ]
|
;;
|
||||||
then
|
"update")
|
||||||
dockerComposeFiles
|
dockerComposeFiles
|
||||||
CORE_ID=$(docker-compose ps -q admin)
|
updatebw
|
||||||
WEB_ID=$(docker-compose ps -q web)
|
updateDatabase
|
||||||
if docker inspect --format='{{.Config.Image}}:' $CORE_ID | grep -F ":$COREVERSION:" | grep -q ":[0-9.]*:$" &&
|
;;
|
||||||
docker inspect --format='{{.Config.Image}}:' $WEB_ID | grep -F ":$WEBVERSION:" | grep -q ":[0-9.]*:$"
|
"rebuild")
|
||||||
then
|
dockerComposeDown
|
||||||
echo "Update not needed"
|
update nopull
|
||||||
exit
|
;;
|
||||||
fi
|
esac
|
||||||
dockerComposeDown
|
|
||||||
update withpull
|
|
||||||
restart
|
|
||||||
dockerPrune
|
|
||||||
echo "Pausing 60 seconds for database to come online. Please wait..."
|
|
||||||
sleep 60
|
|
||||||
updateDatabase
|
|
||||||
elif [ "$1" == "rebuild" ]
|
|
||||||
then
|
|
||||||
dockerComposeDown
|
|
||||||
update nopull
|
|
||||||
fi
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user