2 #########################################################################
3 # AContent bundle script #
4 # ./bundle [VERSION] to specify an optional version number #
5 # Author: Greg Gay - IDI, July 2010 #
6 #########################################################################
9 set now = `date +"%Y_%m_%d"`
10 set acontent_dir = "AContent_$now"
11 set bundle = "AContent"
12 set svndir = "http://svn.atutor.ca/repos/transformable2/trunk/docs/"
15 echo "\033[1mAContent Bundle Script [for CVS 1.3.1+] \033[0m"
16 echo "--------------------"
19 set extension = "-$argv[1]"
21 echo "\nNo argument given. Run \033[1m./bundle_acontent.sh [VERSION]\033[0m to specify bundle version."
25 if ($#argv == "2") then
26 set ignore_mode = true
28 set ignore_mode = false
31 echo "\nUsing $acontent_dir as temp bundle directory."
32 echo "Using $bundle$extension.tar.gz as bundle name."
34 if (-e $acontent_dir) then
35 echo -n "\nDir $acontent_dir exists. Overwrite? (y/q) "
40 echo "\n$acontent_dir not touched. Exiting.\n"
43 echo "\nRemoving old $acontent_dir"
49 echo "\nExporting from SVN/ to $acontent_dir"
51 $svnexec --force export $svndir
52 mv 'docs' $acontent_dir/AContent
55 echo "\nDumping language_text"
56 rm $acontent_dir/AContent/install/db/language_text.sql
57 echo "DROP TABLE language_text;" > $acontent_dir/AContent/install/db/language_text.sql
58 wget --output-document=- http://atutor.ca/atutor/translate/dump_lang_acontent.php >> $acontent_dir/AContent/install/db/language_text.sql
62 echo "\nRemoving $acontent_dir/AContent/include/config.inc.php"
63 rm -f $acontent_dir/AContent/include/config.inc.php
64 echo -n "<?php /* This file is a placeholder. Do not delete. Use the automated installer. */ ?>" > $acontent_dir/AContent/include/config.inc.php
69 echo "\nDisabling TR_DEVEL if enabled."
70 sed "s/define('TR_DEVEL', 1);/define('TR_DEVEL', 0);/" $acontent_dir/AContent/include/vitals.inc.php > $acontent_dir/vitals.inc.php
71 rm $acontent_dir/AContent/include/vitals.inc.php
72 echo "\nDisabling AT_DEVEL_TRANSLATE if enabled."
73 sed "s/define('AT_DEVEL_TRANSLATE', 1);/define('AT_DEVEL_TRANSLATE', 0);/" $acontent_dir/vitals.inc.php > $acontent_dir/AContent/include/vitals.inc.php
76 echo -n "<?php "'$svn_data = '"'" >> $acontent_dir/AContent/svn.php
77 $svnexec log -q -r HEAD http://svn.atutor.ca/repos/transformable2/trunk/ >> $acontent_dir/AContent/svn.php
78 echo -n "';?>" >> $acontent_dir/AContent/svn.php
80 echo "\nTargz'ing $bundle${extension}.tar.gz $acontent_dir/AContent/"
83 if (-f "$bundle${extension}.tar.gz") then
84 echo -n "\nBundle $bundle$extension.tar.gz exists. Overwrite? (y/n/q) "
90 echo "\n$bundle$extension.tar.gz not touched."
93 echo "\nRemoving old $bundle$extension.tar.gz"
94 set final_name = "$bundle$extension.tar.gz"
95 rm -r "$bundle$extension.tar.gz"
98 set time = `date +"%k_%M_%S"`
99 set extension = "${extension}-${time}"
100 echo "\nSaving as $bundle$extension.tar.gz instead.\n"
101 set final_name = "$bundle$extension.tar.gz"
105 set final_name = "$bundle$extension.tar.gz"
108 echo "Creating \033[1m$final_name\033[0m"
110 tar -zcf $final_name AContent/
115 if ($ignore_mode == true) then
118 echo -n "\nRemove temp $acontent_dir directory? (y/n) "
122 if ($ans == "y") then
123 echo "\nRemoving temp $acontent_dir directory"
127 echo "\n\033[1m >> Did you update check_acontent_version.php ?? << \033[0m"
129 echo "\n\033[1mBundle complete. Enjoy.\n\nExiting.\033[0m"