Changeset 3943
- Timestamp:
- Tue Sep 20 09:38:50 2005
- Files:
-
- trunk/campsite/implementation/search/install_search (modified) (diff)
- trunk/campsite/implementation/search/uninstall_search (modified) (diff)
- trunk/campsite/implementation/mailnotify/install_mailnotify (modified) (diff)
- trunk/campsite/implementation/mailnotify/uninstall_mailnotify (modified) (diff)
- trunk/campsite/implementation/parser/parser/install_parser (modified) (diff)
- trunk/campsite/install_conf/backup_instance.php (modified) (diff)
- trunk/campsite/install_conf/global_functions (modified) (diff)
- trunk/campsite/install_conf/check4_functions (modified) (diff)
- trunk/campsite/install_conf/remove_all_instances (modified) (diff)
- trunk/campsite/install_conf/install_functions (modified) (diff)
- trunk/campsite/install_conf/cli_script_lib.php (modified) (diff)
- trunk/campsite/install_conf/remove_instance.php (modified) (diff)
- trunk/campsite/install_conf/create_instance.php (modified) (diff)
- trunk/campsite/install_conf/conf_functions (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
trunk/campsite/implementation/search/install_search
r3242 r3943 2 2 3 3 mkdir -p $BIN_DIR 4 install -o $ROOT_USER -g $APACHE_GROUP -m 750 gather $"$BIN_DIR"4 install -o $ROOT_USER -g $APACHE_GROUP -m 750 gather "$BIN_DIR" 4 4 [ $? -ne 0 ] && exit 1 5 5 -
trunk/campsite/implementation/search/uninstall_search
r2750 r3943 1 1 #!/bin/bash 2 2 3 rm -f $"$BIN_DIR/gather"3 rm -f "$BIN_DIR/gather" 3 3 4 4 if $USER_INSTALL; then exit 0; fi 7 7 . ${INSTALL_CONF}/cron_functions 8 8 if [ -f /etc/crontab ]; then 9 uninstall_cron_task $"$BIN_DIR/gather" /etc/crontab9 uninstall_cron_task "$BIN_DIR/gather" /etc/crontab 9 9 fi 10 uninstall_cron_task $"$BIN_DIR/gather" /etc/cron.d/campsite_gather -d || exit 110 uninstall_cron_task "$BIN_DIR/gather" /etc/cron.d/campsite_gather -d || exit 1 10 10 restart_cron 11 11 exit 0 -
trunk/campsite/implementation/mailnotify/install_mailnotify
r3239 r3943 1 1 #!/bin/bash 2 2 3 mkdir -p $"$BIN_DIR" 4 install -o $ROOT_USER -g $APACHE_GROUP -m 750 notifyendsubs $"$BIN_DIR" 5 install -o $ROOT_USER -g $APACHE_GROUP -m 750 notifyevents $"$BIN_DIR" 3 mkdir -p "$BIN_DIR" 4 install -o $ROOT_USER -g $APACHE_GROUP -m 750 notifyendsubs "$BIN_DIR" 5 install -o $ROOT_USER -g $APACHE_GROUP -m 750 notifyevents "$BIN_DIR" 6 6 7 7 if $USER_INSTALL; then exit 0; fi 9 9 . ${INSTALL_CONF}/cron_functions 10 10 if [ -f /etc/crontab ]; then 11 uninstall_cron_task $"$BIN_DIR/notifyendsubs" /etc/crontab 12 uninstall_cron_task $"$BIN_DIR/notifyevents" /etc/crontab 11 uninstall_cron_task "$BIN_DIR/notifyendsubs" /etc/crontab 12 uninstall_cron_task "$BIN_DIR/notifyevents" /etc/crontab 13 13 fi 14 14 install_cron_task "0" "*/8" "*" "*" "*" "$ROOT_USER" "$BIN_DIR/notifyendsubs" "/etc/cron.d/notifyendsubs" || exit 1 -
trunk/campsite/implementation/mailnotify/uninstall_mailnotify
r2750 r3943 1 1 #!/bin/bash 2 2 3 rm -f $"$BIN_DIR/notifyendsubs" 4 rm -f $"$BIN_DIR/notifyevents" 3 rm -f "$BIN_DIR/notifyendsubs" 4 rm -f "$BIN_DIR/notifyevents" 5 5 6 6 if $USER_INSTALL; then exit 0; fi 8 8 . ${INSTALL_CONF}/cron_functions 9 9 if [ -f /etc/crontab ]; then 10 uninstall_cron_task $"$BIN_DIR/notifyendsubs" /etc/crontab 11 uninstall_cron_task $"$BIN_DIR/notifyevents" /etc/crontab 10 uninstall_cron_task "$BIN_DIR/notifyendsubs" /etc/crontab 11 uninstall_cron_task "$BIN_DIR/notifyevents" /etc/crontab 12 12 fi 13 uninstall_cron_task $"$BIN_DIR/notifyendsubs" "/etc/cron.d/notifyendsubs" || exit 1 14 uninstall_cron_task $"$BIN_DIR/notifyevents" "/etc/cron.d/notifyevents" || exit 1 13 uninstall_cron_task "$BIN_DIR/notifyendsubs" "/etc/cron.d/notifyendsubs" || exit 1 14 uninstall_cron_task "$BIN_DIR/notifyevents" "/etc/cron.d/notifyevents" || exit 1 15 15 restart_cron 16 16 exit 0 -
trunk/campsite/implementation/parser/parser/install_parser
r3598 r3943 41 41 42 42 RC_INIT=/etc/init.d 43 if [ -d $"$RC_INIT" ]; then 44 cp -f $"$CAMPSITEINIT" $"$RC_INIT" 43 if [ -d "$RC_INIT" ]; then 44 cp -f "$CAMPSITEINIT" "$RC_INIT" 45 45 chown ${ROOT_USER}:${ROOT_GROUP} $"${RC_INIT}/$CAMPSITEINIT" 46 46 [ $? -ne 0 ] && echo "ERROR installing start/stop script" && exit 1 47 chmod 755 $"$RC_INIT/$CAMPSITEINIT" 48 ln -s $"$RC_INIT/$CAMPSITEINIT" $"/etc/rc2.d/S95$CAMPSITEINIT" 49 ln -s $"$RC_INIT/$CAMPSITEINIT" $"/etc/rc3.d/S95$CAMPSITEINIT" 50 ln -s $"$RC_INIT/$CAMPSITEINIT" $"/etc/rc5.d/S95$CAMPSITEINIT" 51 ln -s $"$RC_INIT/$CAMPSITEINIT" $"/etc/rc0.d/K50$CAMPSITEINIT" 52 ln -s $"$RC_INIT/$CAMPSITEINIT" $"/etc/rc6.d/K50$CAMPSITEINIT" 47 chmod 755 "$RC_INIT/$CAMPSITEINIT" 48 ln -s "$RC_INIT/$CAMPSITEINIT" "/etc/rc2.d/S95$CAMPSITEINIT" 49 ln -s "$RC_INIT/$CAMPSITEINIT" "/etc/rc3.d/S95$CAMPSITEINIT" 50 ln -s "$RC_INIT/$CAMPSITEINIT" "/etc/rc5.d/S95$CAMPSITEINIT" 51 ln -s "$RC_INIT/$CAMPSITEINIT" "/etc/rc0.d/K50$CAMPSITEINIT" 52 ln -s "$RC_INIT/$CAMPSITEINIT" "/etc/rc6.d/K50$CAMPSITEINIT" 53 53 elif [ -d /etc/rc.d ]; then 54 54 if [ ! -f /etc/rc.d/rc.local ]; then -
trunk/campsite/install_conf/backup_instance.php
r3184 r3943 28 28 $html_dir = $Campsite['WWW_DIR'] . "/$instance_name/html"; 29 29 $backup_dir = $Campsite['CAMPSITE_DIR'] . "/backup/$instance_name"; 30 exec_command("mkdir -p \$'$backup_dir'");30 exec_command("mkdir -p " . escape_shell_arg($backup_dir); 30 30 31 31 // backup look (templates) directory -
trunk/campsite/install_conf/global_functions
r3163 r3943 297 297 if [ "$file_type" = "executable" ]; then 298 298 [ "$search_path" != "" ] && export PATH=$search_path 299 file_path=` $"$PHP" -q $"$INSTALL_CONF/is_executable.php" $"$file_name"`299 file_path=`"$PHP" -q "$INSTALL_CONF/is_executable.php" "$file_name"` 299 299 result=$? 300 300 [ "$search_path" != "" ] && export PATH=$old_path -
trunk/campsite/install_conf/check4_functions
r3706 r3943 629 629 bin_names="apache httpd httpd2 apache2 httpds" 630 630 for bn in $bin_names; do 631 check4_file --executable $"$bn" &> /dev/null631 check4_file --executable "$bn" &> /dev/null 631 631 [ $? -eq 0 ] && bin_path=$file_path && apache_bin_name="$bn" && break 632 632 bin_path="" 1067 1067 is_checked php_mysql && return 0 1068 1068 check4_php_cli || return 1 1069 $"$PHP" -q $"$INSTALL_CONF/php_mysql_exists.php"1069 "$PHP" -q "$INSTALL_CONF/php_mysql_exists.php" 1069 1069 [ $? -ne 0 ] && output="PHP MySQL extension was not installed. Please install it." && return 1 1070 1070 set_checked php_mysql -
trunk/campsite/install_conf/remove_all_instances
r3151 r3943 12 12 fi 13 13 14 call_dir=`dirname $"$0"`14 call_dir=`dirname "$0"` 14 14 if [ "$call_dir" != "." ]; then 15 call_dir=`dirname $"$call_dir"`15 call_dir=`dirname "$call_dir"` 15 15 fi 16 . $"$call_dir/make.env"16 . "$call_dir/make.env" 16 16 if [ $? -ne 0 ]; then 17 17 exit 1 18 18 fi 19 19 20 pushd $"$ETC_DIR" > /dev/null20 pushd "$ETC_DIR" > /dev/null 20 20 if [ $? -ne 0 ]; then 21 21 exit 1 29 29 if [ -d "$inst_name" ]; then 30 30 echo -n "Removing instance $inst_name ..." 31 $"$BIN_DIR/remove_instance" $inst_name31 "$BIN_DIR/remove_instance" $inst_name 31 31 echo "done" 32 32 fi -
trunk/campsite/install_conf/install_functions
r3864 r3943 37 37 [ $? -ne 0 ] && echo "Error configuring install parameters" && exit 1 38 38 install_conf --set 39 . $"$INSTALL_CONF/../configure" --define_start_env &> /dev/null39 . "$INSTALL_CONF/../configure" --define_start_env &> /dev/null 39 39 [ $? -ne 0 ] && echo "Error configuring install environment" && exit 1 40 40 160 160 read_parameter template_engine_max_threads 0 "This sets the maximum number of threads for the\ntemplate engine - 0 means use default" 161 161 read_parameter smtp_server_port 25 "This is the email server listening port - default 25" 162 read_parameter apache_user $"$APACHE_USER" "The owner of instance files; the template engine will run\nwith this user id - default apache user should work ok" 163 read_parameter apache_group $"$APACHE_GROUP" "The group owner of instance files; the template engine will\nrun with this group id - default apache group should work ok" 162 read_parameter apache_user "$APACHE_USER" "The owner of instance files; the template engine will run\nwith this user id - default apache user should work ok" 163 read_parameter apache_group "$APACHE_GROUP" "The group owner of instance files; the template engine will\nrun with this group id - default apache group should work ok" 164 164 } 165 165 -
trunk/campsite/install_conf/cli_script_lib.php
r2863 r3943 1 1 <?php 2 2 3 function escape_shell_arg($p_arg) 4 { 5 $arg = str_replace('\\', '\\\\', $p_arg); 6 $arg = str_replace(' ', '\ ', $arg); 7 $arg = str_replace('`', '\`', $arg); 8 $arg = str_replace('!', '\!', $arg); 9 $arg = str_replace('@', '\@', $arg); 10 $arg = str_replace('$', '\$', $arg); 11 $arg = str_replace('%', '%%', $arg); 12 $arg = str_replace('^', '\^', $arg); 13 $arg = str_replace('&', '\&', $arg); 14 $arg = str_replace('*', '\*', $arg); 15 $arg = str_replace('(', '\(', $arg); 16 $arg = str_replace(')', '\)', $arg); 17 $arg = str_replace('=', '\=', $arg); 18 $arg = str_replace('{', '\{', $arg); 19 $arg = str_replace('}', '\}', $arg); 20 $arg = str_replace('[', '\[', $arg); 21 $arg = str_replace(']', '\]', $arg); 22 $arg = str_replace(':', '\:', $arg); 23 $arg = str_replace(';', '\;', $arg); 24 $arg = str_replace('"', '\"', $arg); 25 $arg = str_replace('\'', '\\\'', $arg); 26 $arg = str_replace('<', '\<', $arg); 27 $arg = str_replace('>', '\>', $arg); 28 $arg = str_replace(',', '\,', $arg); 29 $arg = str_replace('?', '\?', $arg); 30 $arg = str_replace('/', '%2f', $arg); 31 $arg = str_replace('|', '\|', $arg); 32 return $arg; 33 } 34 3 35 function exec_command($cmd, $err_msg = "", $print_output = true) 4 36 { -
trunk/campsite/install_conf/remove_instance.php
r3186 r3943 22 22 if (!$no_backup) { 23 23 // backup instance 24 $cmd = $Campsite['BIN_DIR'] . "/backup_instance \$'$instance_name'--silent_exit";24 $cmd = $Campsite['BIN_DIR'] . "/backup_instance " . escape_shell_arg($instance_name) . " --silent_exit"; 24 24 exec_command($cmd); 25 25 } … … 28 28 // remove WWW directory 29 29 $www_dir = $Campsite['WWW_DIR'] . "/$instance_name"; 30 $cmd = "rm -fr \$'$www_dir'";30 $cmd = "rm -fr " . escape_shell_arg($www_dir); 30 30 exec_command($cmd); 31 31 43 43 44 44 // remove etc directory 45 $cmd = "rm -fr \$'$etc_dir/$instance_name'";45 $cmd = "rm -fr " . escape_shell_arg($etc_dir) . "/" . escape_shell_arg($instance_name); 45 45 exec_command($cmd); 46 46 -
trunk/campsite/install_conf/create_instance.php
r3913 r3943 134 134 135 135 $cmd = "chown -R \"" . $Campsite['APACHE_USER'] . ":" . $Campsite['APACHE_GROUP'] 136 . "\" \$'$instance_etc_dir'2>&1";136 . "\" " . escape_shell_arg($instance_etc_dir) . " 2>&1"; 136 136 exec($cmd, $output, $res); 137 137 if ($res != 0) 138 138 return implode("\n", $output); 139 139 140 $cmd = "chmod 640 \$'$instance_etc_dir/'* 2>&1";140 $cmd = "chmod 640 " . escape_shell_arg($instance_etc_dir) . "/* 2>&1"; 140 140 exec($cmd, $output, $res); 141 141 if ($res != 0) … … 180 180 if ($db_password != "") 181 181 $cmd .= " --password=\"$db_password\""; 182 $cmd .= " $db_name < \$'$db_dir/campsite-db.sql'2>&1";182 $cmd .= " " . escape_shell_arg($db_name) . " " . escape_shell_arg($db_dir) . "/campsite-db.sql 2>&1"; 182 182 exec($cmd, $output, $res); 183 183 if ($res != 0) … … 223 223 224 224 // run upgrade scripts 225 $cmd_prefix = "cd \$'$upgrade_dir'; mysql --user=$db_user --host="225 $cmd_prefix = "cd " . escape_shell_arg($upgrade_dir) . "; mysql --user=$db_user --host=" 225 225 . $Campsite['DATABASE_SERVER_ADDRESS'] 226 226 . " --port=" . $Campsite['DATABASE_SERVER_PORT']; 227 227 if ($db_password != "") 228 228 $cmd_prefix .= " --password=\"$db_password\""; 229 $cmd_prefix .= " $p_db_name < \$'";229 $cmd_prefix .= " " . escape_shell_arg($p_db_name) . " < "; 229 229 $sql_scripts = array("tables.sql", "data-required.sql", "data-optional.sql"); 230 230 foreach ($sql_scripts as $index=>$script) { 231 231 if (!is_file($upgrade_dir . $script)) 232 232 continue; 233 $cmd = $cmd_prefix . $script . " '2>&1";233 $cmd = $cmd_prefix . $script . " 2>&1"; 233 233 exec($cmd, $output, $res); 234 234 if ($res != 0 && $script != "data-optional.sql") … … 296 296 if ($Campsite['DATABASE_PASSWORD'] != "") 297 297 $cmd .= " --password=\"" . $Campsite['DATABASE_PASSWORD'] . "\""; 298 $cmd .= " $p_db_name > \$'$backup_dir/$p_db_name-database.sql'"; 298 $cmd .= " " . escape_shell_arg($p_db_name) . " > " 299 . escape_shell_arg($backup_dir) . "/" . escape_shell_arg($p_db_name) . "-database.sql"; 299 300 exec($cmd, $output, $res); 300 301 if ($res != 0) … … 350 351 if ($Campsite['DATABASE_PASSWORD'] != "") 351 352 $cmd .= " --password=\"" . $Campsite['DATABASE_PASSWORD'] . "\""; 352 $cmd .= " $p_db_name < \$'$backup_file'";353 $cmd .= " $p_db_name < " . escape_shell_arg($backup_file); 352 353 exec($cmd, $output, $res); 353 354 if ($res != 0) … … 385 386 386 387 if (isset($CampsiteOld['.MODULES_HTML_DIR'])) { 387 $cmd = "cp -fr \$'" . $CampsiteOld['.MODULES_HTML_DIR'] . "/look' \$'$html_dir'"; 388 $cmd = "cp -fr " . escape_shell_arg($CampsiteOld['.MODULES_HTML_DIR']) . "/look " 389 . escape_shell_arg($html_dir); 388 390 exec($cmd); 389 391 } 414 416 return $res; 415 417 416 $cp_cmd = "cp -f \$'$common_cgi_dir/'* \$'$cgi_dir'";418 $cp_cmd = "cp -f " . escape_shell_arg($common_cgi_dir) . "/* " . escape_shell_arg($cgi_dir); 416 418 exec($cp_cmd); 417 419 418 420 $cmd = "chown -R " . $Campsite['APACHE_USER'] . ":" . $Campsite['APACHE_GROUP'] 419 . " \$'$instance_www_dir'";421 . " " . escape_shell_arg($instance_www_dir); 419 421 exec($cmd); 420 $cmd = "chmod -R u+w \$'$instance_www_dir'";422 $cmd = "chmod -R u+w " . escape_shell_arg($instance_www_dir); 420 422 exec($cmd); 421 $cmd = "chmod -R ug+r \$'$instance_www_dir'";423 $cmd = "chmod -R ug+r " . escape_shell_arg($instance_www_dir); 421 423 exec($cmd); 422 424 -
trunk/campsite/install_conf/conf_functions
r3864 r3943 247 247 modules=`modules_list $*` 248 248 for m in $modules; do 249 conf_file=`cd "$INSTALL_CONF"; $"$PHP" -q module_conf_file.php "$m"`249 conf_file=`cd "$INSTALL_CONF"; "$PHP" -q module_conf_file.php "$m"` 249 249 if [ ! -f "$INSTALL_CONF/$conf_file" ]; then 250 250 continue 251 251 fi 252 252 configurable_modules="$configurable_modules $m" 253 mod_conf=`cd "$INSTALL_CONF"; $"$PHP" -q export_conf.php "$m"`253 mod_conf=`cd "$INSTALL_CONF"; "$PHP" -q export_conf.php "$m"` 253 253 if [ $? -ne 0 ]; then 254 254 echo "$mod_conf" … … 260 260 echo "$mod_conf" | cut -f 2 -d " " 261 261 fi 262 mod_param_list=`cd "$INSTALL_CONF"; $"$PHP" -q export_module_params.php "$m"`262 mod_param_list=`cd "$INSTALL_CONF"; "$PHP" -q export_module_params.php "$m"` 262 262 if [ $? -ne 0 ]; then 263 263 echo "$mod_param_list" … … 298 298 [ "$1" = "--reset" ] && action="reset" && shift 1 299 299 [ "$1" = "--unset" ] && action="unset" && shift 1 300 conf_file=`cd "$INSTALL_CONF"; $"$PHP" -q module_conf_file.php "install"`300 conf_file=`cd "$INSTALL_CONF"; "$PHP" -q module_conf_file.php "install"` 300 300 if [ ! -f "$INSTALL_CONF/$conf_file" ]; then 301 301 return 1 302 302 fi 303 inst_conf=`cd "$INSTALL_CONF"; $"$PHP" -q export_conf.php "install"`303 inst_conf=`cd "$INSTALL_CONF"; "$PHP" -q export_conf.php "install"` 303 303 if [ $? -ne 0 ]; then 304 304 echo "$inst_conf" … … 310 310 echo "$inst_conf" | cut -f 2 -d " " 311 311 fi 312 inst_param_list=`cd "$INSTALL_CONF"; $"$PHP" -q export_module_params.php "install"`312 inst_param_list=`cd "$INSTALL_CONF"; "$PHP" -q export_module_params.php "install"` 312 312 if [ $? -ne 0 ]; then 313 313 echo "$inst_param_list" … … 519 519 return 0 520 520 fi 521 conf_file=`cd "$INSTALL_CONF"; $"$PHP" -q module_conf_file.php "$module"`521 conf_file=`cd "$INSTALL_CONF"; "$PHP" -q module_conf_file.php "$module"` 521 521 if [ ! -f "$INSTALL_CONF/$conf_file" ]; then 522 522 echo "Module $module is not configurable" … … 739 739 { 740 740 module=$1 741 module_file=`cd "$INSTALL_CONF"; $"$PHP" -q module_conf_file.php "$module"`741 module_file=`cd "$INSTALL_CONF"; "$PHP" -q module_conf_file.php "$module"` 741 741 tmp_file=".$$.$module_file" 742 742 module_name=`echo "$module_file" | cut -f 1 -d "_"` 749 749 fi 750 750 fi 751 module_vars=`cd "$INSTALL_CONF"; $"$PHP" -q export_module_params.php "$module"`751 module_vars=`cd "$INSTALL_CONF"; "$PHP" -q export_module_params.php "$module"` 751 751 echo -e "<?php\n" > $tmp_file; 752 752 vars_list_str=""