2 #########################################################################
3 # AContent bundle script #
4 # ./bundle [VERSION] to specify an optional version number #
5 # Author: Greg Gay - IDI, July 2010 #
6 #########################################################################
8 set now = `date +"%Y_%m_%d"`
9 set acontent_dir = "AContent_$now"
10 set bundle = "AContent"
11 set svndir = "http://atutorsvn.atrc.utoronto.ca/repos/transformable2/trunk/docs/"
14 echo "\033[1mAContent Bundle Script [for CVS 1.3.1+] \033[0m"
15 echo "--------------------"
18 set extension = "-$argv[1]"
20 echo "\nNo argument given. Run \033[1m./bundle_acontent.sh [VERSION]\033[0m to specify bundle version."
24 if ($#argv == "2") then
25 set ignore_mode = true
27 set ignore_mode = false
30 echo "\nUsing $acontent_dir as temp bundle directory."
31 echo "Using $bundle$extension.tar.gz as bundle name."
33 if (-e $acontent_dir) then
34 echo -n "\nDir $acontent_dir exists. Overwrite? (y/q) "
39 echo "\n$acontent_dir not touched. Exiting.\n"
42 echo "\nRemoving old $acontent_dir"
48 echo "\nExporting from SVN/ to $acontent_dir"
50 $svnexec --force export $svndir
51 mv 'docs' $acontent_dir/AContent
54 echo "\nDumping language_text"
55 rm $acontent_dir/AContent/install/db/language_text.sql
56 echo "DROP TABLE language_text;" > $acontent_dir/AContent/install/db/language_text.sql
57 wget --output-document=- http://atutor.ca/atutor/translate/dump_lang_acontent.php >> $acontent_dir/AContent/install/db/language_text.sql
61 echo "\nRemoving $acontent_dir/AContent/include/config.inc.php"
62 rm -f $acontent_dir/AContent/include/config.inc.php
63 echo -n "<?php /* This file is a placeholder. Do not delete. Use the automated installer. */ ?>" > $acontent_dir/AContent/include/config.inc.php
68 echo "\nDisabling TR_DEVEL if enabled."
69 sed "s/define('TR_DEVEL', 1);/define('TR_DEVEL', 0);/" $acontent_dir/AContent/include/vitals.inc.php > $acontent_dir/vitals.inc.php
70 rm $acontent_dir/AContent/include/vitals.inc.php
71 echo "\nDisabling AT_DEVEL_TRANSLATE if enabled."
72 sed "s/define('AT_DEVEL_TRANSLATE', 1);/define('AT_DEVEL_TRANSLATE', 0);/" $acontent_dir/vitals.inc.php > $acontent_dir/AContent/include/vitals.inc.php
75 echo -n "<?php "'$svn_data = '"'" >> $acontent_dir/AContent/svn.php
76 $svnexec log -q -r HEAD http://atutorsvn.atrc.utoronto.ca/repos/transformable2/trunk/ >> $acontent_dir/AContent/svn.php
77 echo -n "';?>" >> $acontent_dir/AContent/svn.php
79 echo "\nTargz'ing $bundle${extension}.tar.gz $acontent_dir/AContent/"
82 if (-f "$bundle${extension}.tar.gz") then
83 echo -n "\nBundle $bundle$extension.tar.gz exists. Overwrite? (y/n/q) "
89 echo "\n$bundle$extension.tar.gz not touched."
92 echo "\nRemoving old $bundle$extension.tar.gz"
93 set final_name = "$bundle$extension.tar.gz"
94 rm -r "$bundle$extension.tar.gz"
97 set time = `date +"%k_%M_%S"`
98 set extension = "${extension}-${time}"
99 echo "\nSaving as $bundle$extension.tar.gz instead.\n"
100 set final_name = "$bundle$extension.tar.gz"
104 set final_name = "$bundle$extension.tar.gz"
107 echo "Creating \033[1m$final_name\033[0m"
109 tar -zcf $final_name AContent/
114 if ($ignore_mode == true) then
117 echo -n "\nRemove temp $acontent_dir directory? (y/n) "
121 if ($ans == "y") then
122 echo "\nRemoving temp $acontent_dir directory"
126 echo "\n\033[1m >> Did you update check_acontent_version.php ?? << \033[0m"
128 echo "\n\033[1mBundle complete. Enjoy.\n\nExiting.\033[0m"