Ensemble des services de KAZ
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

74 lines
1.6 KiB

#!/bin/bash
KAZ_ROOT=$(cd $(dirname $0)/..; pwd)
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
setKazVars
cd $(dirname $0)
. "${DOCKERS_ENV}"
declare -a available_orga target_cloud
available_orga=$("${KAZ_BIN_DIR}/kazList.sh" "compose" "enable" "orga" 2>/dev/null | sed "s/-orga\b//g")
export SIMU=""
ALL=""
ERROR=""
usage () {
echo "Usage: $0 [-n] [-all] orga..."
echo " -n : simulation"
echo " -all : simulation"
echo " [orga] : in ${available_orga}"
exit 1
}
upgradeNC () {
# $1 nextcloud ${orga}-nextcloud
if [ "$1" == "nextcloud" ]; then
ORGA="common"
[ -e "${DOCK_VOL}/cloud_cloudMain" ] || return
DockerServName="nextcloudServ"
else
#ORGA="$1"
ORGA=${1%-nextcloud}
[ -e "${DOCK_VOL}/orga_${ORGA}-cloudMain" ] || return
DockerServName="${ORGA}-nextcloudServ"
fi
echo "upgrade cloud ${BLUE}${ORGA}${NC}"
${SIMU} docker exec -ti -u 33 ${DockerServName} /var/www/html/occ upgrade;
}
for ARG in $@; do
case "${ARG}" in
'-h' | '-help' )
usage
;;
'-n' )
export SIMU="echo"
;;
'-all' )
ALL="yes"
;;
* )
if [[ ! " ${available_orga[*]} " =~ " ${ARG} " ]]; then
echo "${RED}${ARG}${NC} not an orga"
ERROR="yes"
else
target_cloud+=("${ARG}-nextcloud")
fi
;;
esac
done
[ -n "${ERROR}" ] && usage
if [ -n "${ALL}" ]; then
target_cloud=("nextcloud")
for orga in ${available_orga[@]}; do
target_cloud+=("${orga}-nextcloud")
done
fi
[ ${#target_cloud[@]} -eq 0 ] && target_cloud+=("nextcloud")
for nc in ${target_cloud[@]}; do
upgradeNC "${nc}"
done