diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-11-23 06:08:55 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-11-23 06:08:55 +0000 |
commit | 800351cc327169646a79fef2e9d2227c0e9c7ae8 (patch) | |
tree | f7230326890882a0822ad3525ef7bd569e5102b9 | |
parent | 415c850d1a391a4a1af589e182cbc6a2c8155c2c (diff) | |
download | pfsense-800351cc327169646a79fef2e9d2227c0e9c7ae8.zip pfsense-800351cc327169646a79fef2e9d2227c0e9c7ae8.tar.gz |
Move cvs_sync.sh to pfSense shell as the cvssync playback command.
-rw-r--r-- | etc/phpshellsessions/cvssync | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/etc/phpshellsessions/cvssync b/etc/phpshellsessions/cvssync new file mode 100644 index 0000000..f7e1dc2 --- /dev/null +++ b/etc/phpshellsessions/cvssync @@ -0,0 +1,119 @@ +/* cvs_sync + * Written by Scott Ullrich + * (C)2005 Scott Ullrich + * Part of the pfSense project + * For users of cvs accounts to keep your test machine up to date + */ + +unlink_if_exists("/tmp/config.cache"); + +$TMPDIR = "/root/pfSense/"; +$CODIR = "/root/pfSenseCO/"; + +if(!file_exists("/usr/local/bin/cvsup")) { + echo "Cannot find cvsup, pkg_add in progress..."; + system("/usr/sbin/pkg_add -r http://www.pfsense.com/packages/All/cvsup-without-gui-16.1h_2.tbz"); +} + +if(!file_exists("/usr/bin/cvs")) { + echo "Cannot find cvs, fetching static cvs..."; + system("fetch -o /usr/bin/cvs http://www.pfsense.com/~sullrich/extra/cvs"); + system("chmod a+rx /usr/bin/cvs"); +} + +echo "\nPlease select which branch you would like:\n\n"; +echo "RELENG_1_2 - 1.2 Release branch\n"; +echo "RELENG_1 - 1.3 branch\n"; +echo "HEAD - Main development branch\n"; + +$branch = readline("\n> "); + +if($branch == "HEAD") { + echo "\n===> Checking out HEAD"; + exec("mkdir -p $TMPDIR"); + exec("cd $TMPDIR/.. && cvsup /etc/current-supfile"); + exec("rm -rf /usr/local/www/includes/*"); + exec("rm -rf /usr/local/www/javascript/*"); + exec("find /usr/local/www -name \"*.js\" -exec rm {} \;"); + exec("rm -rf $CODIR"); + exec("mkdir -p $CODIR"); + exec("mkdir -p /tmp/lighttpd/cache/compress/"); + exec("cd $CODIR && cvs -d $TMPDIR co pfSense"); +} else if($branch == "RELENG_1_2") { + echo "\n===> Checking out RELENG_1_2\n"; + exec("mkdir -p $TMPDIR"); + exec("cd $TMPDIR/.. && cvsup /etc/current-supfile"); + exec("rm -rf /usr/local/www/includes/*"); + exec("rm -rf /usr/local/www/javascript/*"); + exec("find /usr/local/www -name \"*.js\" -exec rm {} \;"); + exec("rm -rf $CODIR"); + exec("mkdir -p $CODIR"); + exec("mkdir -p /tmp/lighttpd/cache/compress/"); + exec("cd $CODIR && cvs -d $TMPDIR co -r RELENG_1_2 pfSense"); + +} else if($branch == "RELENG_1") { + echo "\n===> Checking out RELENG_1\n"; + exec("mkdir -p $TMPDIR"); + exec("cd $TMPDIR/.. && cvsup /etc/current-supfile"); + exec("rm -rf /usr/local/www/includes/*"); + exec("rm -rf /usr/local/www/javascript/*"); + exec("find /usr/local/www -name \"*.js\" -exec rm {} \;"); + exec("rm -rf $CODIR"); + exec("mkdir -p $CODIR"); + exec("mkdir -p /tmp/lighttpd/cache/compress/"); + exec("cd $CODIR && cvs -d $TMPDIR co -r RELENG_1 pfSense"); +} else { + echo "\nInvalid branch\n"; + exit; +} + +exec("cd ${CODIR}/ && find . -name CVS -exec rm -rf {} \; 2>/dev/null"); +exec("cd ${CODIR}/ && find . -name pfSense.tgz -exec rm {} \; 2>/dev/null"); +exec("rm -rf ${CODIR}/conf*"); +exec("rm ${CODIR}/pfSense/usr/local/www/trigger_initial_wizard 2>/dev/null"); +exec("rm ${CODIR}/pfSense/etc/crontab 2>/dev/null"); +exec("rm ${CODIR}/pfSense/etc/master.passwd 2>/dev/null"); +exec("rm ${CODIR}/pfSense/etc/passwd 2>/dev/null"); +exec("rm ${CODIR}/pfSense/etc/fstab 2>/dev/null"); +exec("rm ${CODIR}/pfSense/etc/ttys 2>/dev/null"); +exec("rm ${CODIR}/pfSense/etc/group 2>/dev/null"); +exec("rm ${CODIR}/pfSense/etc/fstab 2>/dev/null"); +exec("rm ${CODIR}/pfSense/boot/device.hints 2>/dev/null"); +exec("rm ${CODIR}/pfSense/boot/loader.conf 2>/dev/null"); +exec("rm ${CODIR}/pfSense/boot/loader.rc 2>/dev/null"); +exec("rm -rf ${CODIR}/pfSense/conf/ 2>/dev/null"); +exec("rm -rf ${CODIR}/pfSense/cf/ 2>/dev/null"); +exec("rm -rf ${CODIR}/pfSense/root/.shrc"); +exec("rm -rf ${CODIR}/pfSense/root/.tcshrc"); + +echo "Installing new files..."; + +exec("cd $CODIR/pfSense ; tar -cpf - . | (cd / ; tar -Uxpvf -)"); + +echo "CVS Sync Complete"; + +echo "Removing FAST-CGI temporary files..."; +exec("find /tmp -name \"*php*\" -exec rm -rf {} \;"); + +exec("rm -rf /tmp/xcache/* 2>/dev/null"); + +echo "Upgrading configuration..."; + +convert_config(); +/* setup php.ini */ +convert_config(); +sync_webgui_passwords(); + +echo "Restarting check_reload_status..."; +exec("killall check_reload_status"); +mwexec_bg("nohup /usr/bin/nice -n20 /usr/local/sbin/check_reload_status &"); + +echo "Configuring filter..."; +exec("/etc/rc.filter_configure_sync"); +exec("pfctl -f /tmp/rules.debug"); + +echo "===> Checkout complete. Your system is now sync'd."; + +exec("killall php"); +touch("/tmp/restart_webgui"); + |