diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-11-23 07:42:26 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-11-23 07:42:26 +0000 |
commit | 784cca4da175d3167b4b284634fd821a2f7bb6d8 (patch) | |
tree | 546b3d8b691e7c65ccdc54773f98af7f70bccf41 | |
parent | 991193e4ef9bb2b4f1856edaa5960ccbd221fff4 (diff) | |
download | pfsense-784cca4da175d3167b4b284634fd821a2f7bb6d8.zip pfsense-784cca4da175d3167b4b284634fd821a2f7bb6d8.tar.gz |
Simplify the process and do not download the entire cvs tree for cvssync operations. Simply cvsup the needed branch. Saves bandwidth, time, diskspace, etc.
-rw-r--r-- | etc/phpshellsessions/cvssync | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/etc/phpshellsessions/cvssync b/etc/phpshellsessions/cvssync index 7451016..ff8a51a 100644 --- a/etc/phpshellsessions/cvssync +++ b/etc/phpshellsessions/cvssync @@ -5,10 +5,26 @@ * For users of cvs accounts to keep your test machine up to date */ -unlink_if_exists("/tmp/config.cache"); +function create_supfile($branch) { + + if($branch == "HEAD") + $BRANCHTAG = "."; + else + $BRANCHTAG = $branch; + + $supfile = " +*default host=cvs.pfsense.com +*default base=/home/pfsense/$branch +*default release=cvs tag=$BRANCHTAG +*default delete use-rel-suffix +pfSense +*default compress +"; + + file_put_contents("/var/etc/pfSense-supfile", $supfile); +} -$TMPDIR = "/root/pfSense/"; -$CODIR = "/root/pfSenseCO/"; +unlink_if_exists("/tmp/config.cache"); if(!file_exists("/usr/local/bin/cvsup")) { echo "Cannot find cvsup, pkg_add in progress..."; @@ -28,45 +44,28 @@ 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"; +create_supfile($branch); + +$CODIR = "/home/pfsense/$branch"; + +exec("mkdir -p /home/pfsense/$BRANCHTAG"); + +$branches = array("HEAD","RELENG_1","RELENG_1_2"); + +if (!in_array("$branch", $branches)) { + echo "Invalid branch.\n"; exit; } +echo "\n===> Checking out $branch\n"; +exec("mkdir -p /home/pfsense/$branch"); +system("cvsup /var/etc/pfSense-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("mkdir -p /tmp/lighttpd/cache/compress/"); + 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*"); @@ -88,7 +87,7 @@ exec("rm -rf ${CODIR}/pfSense/root/.tcshrc"); echo "Installing new files...\n"; -exec("cd $CODIR/pfSense ; tar -cpf - . | (cd / ; tar -Uxpvf -)"); +exec("cd $CODIR/pfSense ; tar -cpf - . | (cd / ; tar -Uxpf -)"); echo "CVS Sync Complete\n"; |