#!/bin/bash set -e if [ -z "$1" ] then echo "ERROR: Can't continue. Version querying not implemented, because we might not use the latest major release." echo "Usage: bash ./update.sh 9.9.9" exit 1 fi export XDG_RUNTIME_DIR=/run/user/$UID location=$HOME olddir=`readlink $location/latest` # becomes $location/latest/themes/themename # script does not require this to function #themename=mytheme systemctl stop --user keycloak cd $location # FIXME: move to rsync or use git tags directly wget "https://github.com/keycloak/keycloak/releases/download/$1/keycloak-$1.zip" unzip keycloak-$1.zip rm keycloak-$1.zip [ -L $location/latest ] && rm -v $location/latest ln -sv $location/keycloak-$1 $location/latest # default config got the same filename! rm -v $location/latest/conf/keycloak.conf ln -sv $location/config/* $location/latest/conf/ if [ -z ${themename+x} ]; # FIXME: had trouble with symlinking but might have been a coincidence then echo "Theme directory is not configured for this script." echo "Uncomment its variable of needed." echo "Checking directories in ./themes of old install:" find $olddir/themes -maxdepth 1 -mindepth 1 -type d echo echo "Proceeding..." else cp -rp $location/theme $location/latest/themes/$themename; fi bash $location/latest/bin/kc.sh build systemctl start --user keycloak sleep 2 systemctl status --user keycloak