xwiki/abra.sh
2024-11-28 12:11:58 -08:00

37 lines
1.0 KiB
Bash

#!/bin/bash
CONTEXT_PATH=ROOT
WEBINF=/usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF
# Config files
xwiki_cfg=$WEBINF/xwiki.cfg
xwiki_properties=$WEBINF/xwiki.properties
hibernate_cfg_xml=$WEBINF/hibernate.cfg.xml
logback_xml=$WEBINF/classes/logback.xml
web_xml=$WEBINF/web.xml
ALL_FILES=($xwiki_cfg $xwiki_properties $hibernate_cfg_xml $logback_xml $web_xml)
edit_config() {
select_file
echo -e "Pulling $FILE_NAME from the app\n"
abra app cp $APP_NAME app:$FILE_PATH ./
echo -e "$FILE_NAME is temporarily available\n"
echo -e "edit the file, save and exit, then press enter to continue\n"
read </dev/tty
echo -e "Moving the edited file to the app\n"
abra app cp $APP_NAME $FILE_NAME app:$FILE_PATH
echo -e "deleting the local copy\n"
rm $FILE_NAME
echo "Done!"
}
select_file() {
echo -e "Which config file do you wish to edit?\n"
for f in ${ALL_FILES[*]}; do
echo -e $f
done
echo -e "Enter file name (without the path)"
read FILE_NAME </dev/tty
echo -e "Enter file path (including the file name)"
read FILE_PATH </dev/tty
}