-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathprod
executable file
·25 lines (21 loc) · 1.05 KB
/
prod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# this script build the production directory, execute some tasks (minification etc.) and upload its content over SSH to the server then execute the setup script
mkdir prod_dir
cd ..
tar -cf - -T prod_files | (cd prod_dir && tar xf -)
remove-html-comments prod_dir/client/index.html prod_dir/client/index.html
remove-html-comments prod_dir/www/index.html prod_dir/www/index.html
remove-html-comments prod_dir/placeholder/index.html prod_dir/placeholder/index.html
cd prod_dir
if [ -z "$1" ]
then
launch_setup="sh setup;"
else
launch_setup="sh setup $1 $2;"
fi
# archive from a list of files and unarchive over ssl connection to a specified remote folder
tar cvzf - * | ssh -v -i /home/mine/.ssh/key -p 22 [email protected] "cd /home/fragment/; mkdir -p fsynth_upload; cd fsynth_upload; tar xzf -; rsync -av /home/fragment/fsynth_upload/ /home/fragment/fsynth/; rsync -av /home/fragment/fsynth/placeholder/ /home/fs/www/; rm -rf /home/fs/fsynth/placeholder; cd /home/fs/fsynth; chmod +x setup; $launch_setup"
cd prod_dir
rm -rf *
cd ..
rmdir prod_dir