SM2Gen/copySM2.sh

37 lines
1.2 KiB
Bash
Raw Normal View History

2024-09-18 16:54:05 +02:00
#!/bin/bash
if [ $# -ne 3 ]; then
echo "Error: copySM2.sh requires two parameters."
echo "copySM2.sh <systemname> <prefix> <packagename>"
exit 1
fi
export REMOTE=/home/brianr/$1/usr/share/smanager
cd ~/clients/SM2/SM2Gen/venv/Targets/$3
echo `pwd`
# controller file name is just capitalised
cont_file=$(echo "$3" | awk '{
for(i=1; i<=NF; i++) {
$i = toupper(substr($i, 1, 1)) tolower(substr($i, 2))
}
print
}' | tr ' ' '_')
echo $cont_file
#if [ ! -f "$cont_file.pm" ]; then
# echo "no controller file $cont_file found in `pwd`"
# exit 1
#fi
mkdir -p $REMOTE/lib/SrvMngr/Controller
mkdir -p $REMOTE/themes/default/templates/partials/
mkdir -p $REMOTE/lib/SrvMngr/I18N/Modules/Nfsshare
mkdir -p $REMOTE/themes/default/templates/
cp -fv *.pm $REMOTE/lib/SrvMngr/Controller
cp -fv *.css $REMOTE/themes/default/public/css
cp -fv _$2*.html.ep $REMOTE/themes/default/templates/partials/
find . -maxdepth 1 -type f -name "[!_]*\.ep" | xargs -I% bash -c 'cp -fv % $REMOTE/themes/default/templates/'
mkdir -p $REMOTE/lib/SrvMngr/I18N/Modules/$3
cp -fv *.lex $REMOTE/lib/SrvMngr/I18N/Modules/$3
rm -f $REMOTE/lib/SrvMngr/I18N/Modules/$3/*.pm
ssh -p 1234 root@$1.thereadclan.me.uk 'signal-event smanager-refresh'
exit 0