jeffd
committed
on 18 Mar 05
apply patch 654 to make cop-ui work with current head from Orzenil Silva Junior. Thanks\!
openacs-4/etc/install/install.sh (+22 -7)
29 29     --no-checkout Do not checkout new source code
30 30     --oacs-only   Do not install .LRN, only OpenACS
31 31     --postgresql  Install on PostgreSQL. Overrides database setting in install config file.
32 32     --interactive Gives you the possibility to exit at certain points during installation
33 33 "
34 34
35 35 # Check that script is executed as root
36 36 if [ $(whoami) != "root" ]; then
37 37     echo "$0: You must execute this script as root, exiting"
38 38     exit -1
39 39 fi
40 40
41 41 # Check that the config file exists
42 42 if [ ! -r ${config_file} ]; then
43 43     echo "$0: Aborting installation. The config file \"$config_file\" does not exist or is not readable."
44 44     exit -1
45 45 fi
46 46
47 47 # Set important configuration parameters
48 48 serverroot=`get_config_param serverroot`
  49 svscanroot=`get_config_param svscanroot`
49 50 database=`get_config_param database`
50 51 server_url=`get_config_param server_url`
51 52 error_log_file=`get_config_param error_log_file`
52 53 tclwebtest_dir=`get_config_param tclwebtest_dir`
53 54 stop_server_command=`get_config_param stop_server_command`
54 55 start_server_command=`get_config_param start_server_command`
55 56 restart_server_command=`get_config_param restart_server_command`
56 57 startup_seconds=`get_config_param startup_seconds`
57 58 shutdown_seconds=`get_config_param shutdown_seconds`
58 59 restart_seconds=$(expr $startup_seconds + $shutdown_seconds)
59 60 dotlrn_demo_data=`get_config_param dotlrn_demo_data`
60 61 dotlrn=`get_config_param dotlrn`
61 62 crawl_links=`get_config_param crawl_links`
62  
  63 do_checkout=`get_config_param do_checkout`
63 64 # command-line settings override config file settings
64 65 while [ -n "$1" ] ; do
65 66    case "$1" in
66 67       "--config-file")       
67 68         shift
68 69         export config_file=$1
69 70       ;;
70 71       "--no-checkout")
71 72         do_checkout="no"
72 73       ;;
73 74       "--oacs-only")
74 75         dotlrn="no"
75 76       ;;
76 77       # For backward compatibility I am keeping the --postgresql switch
77 78       # which overrides setting in config file
78 79       "--postgresql")
79 80         database="postgresql"
80 81       ;;
81 82       "--interactive")
82 83         interactive="yes"
 
94 95
95 96    shift
96 97 done
97 98
98 99 # If pre/post checkout scripts have been provided - check that they can
99 100 # be executed
100 101 pre_checkout_script=`get_config_param pre_checkout_script`
101 102 post_checkout_script=`get_config_param post_checkout_script`
102 103 if [ -n "$pre_checkout_script" ] && [ ! -x $pre_checkout_script ]; then
103 104     echo "The pre checkout script $pre_checkout_script does not exist or is not executable"
104 105     exit -1
105 106 fi
106 107 if [ -n "$post_checkout_script" ] && [ ! -x $post_checkout_script ]; then
107 108     echo "The post checkout script $post_checkout_script does not exist or is not executable"
108 109     exit -1
109 110 fi
110 111
111 112 # Log some important parameters for the installation
112 113 echo "$0: Starting installation with config_file $config_file. Using serverroot=$serverroot, server_url=$server_url, do_checkout=$do_checkout, dotlrn=$dotlrn, and database=$database."
113 114 prompt_continue $interactive
  115 set -x
  116 # See if a daemontools directory exists.
114 117
115   # Take down the server
  118 if [ -d "${svscanroot}" ]; then
  119     # if so, cycle the server.
116 120     echo "$0: Taking down $serverroot at $(date)"
117 121     $stop_server_command
118 122     # Wait for the server to come down
119 123     echo "$0: Waiting $shutdown_seconds seconds for server to shut down at $(date)"
120 124     sleep $shutdown_seconds
121 125
  126 else
  127     # if not, create one
  128     echo "$0: Creating daemontools directory"
  129     # TODO: should put error handling here and a config param to make this optional
  130     #create the directory disabled
  131     touch $svscanroot/down
  132     ln -s $serverroot/etc/daemontools $svscanroot
  133 fi
  134
  135
  136
122 137 # Recreate the database user
123 138 echo "$0: Recreating database user at $(date)"
124 139 if [ $database == "postgres" ]; then
125 140     pg_bindir=`get_config_param pg_bindir`
126 141     pg_port=`get_config_param pg_port`
127 142     pg_db_name=`get_config_param pg_db_name`
128 143
129 144
130 145     su  `get_config_param pg_db_user` -c "export LD_LIBRARY_PATH=${pg_bindir}/../lib; ${pg_bindir}/dropdb -p $pg_port $pg_db_name; ${pg_bindir}/createdb -p $pg_port $pg_db_name; ${pg_bindir}/createlang -p $pg_port plpgsql $pg_db_name";
131 146 else
132 147     su oracle -c "cd $script_path; config_file=$config_file ./oracle/recreate-user.sh";
133 148 fi
134 149
135 150 prompt_continue $interactive
136 151
137 152 echo $do_checkout
138 153 # Move away the old sources and checkout new ones check do_checkout
139 154 if [ $dotlrn == "yes" ]; then
140 155     echo "$0: Checking out .LRN at $(date)"
141 156     config_file=$config_file dotlrn=$dotlrn ./checkout.sh