From 51a2e892217b4a84db8b97771fd09ef762813c74 Mon Sep 17 00:00:00 2001 From: sullrich Date: Sat, 5 Dec 2009 15:59:05 -0500 Subject: Cleanup after sync --- etc/phpshellsessions/gitsync | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'etc/phpshellsessions') diff --git a/etc/phpshellsessions/gitsync b/etc/phpshellsessions/gitsync index 92c601e..18268c4 100644 --- a/etc/phpshellsessions/gitsync +++ b/etc/phpshellsessions/gitsync @@ -123,12 +123,18 @@ if(is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) { exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git fetch"); exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git clean -f -f -x -d"); if($branch == "master") { - exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset --hard HEAD"); - exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git rebase origin"); + $git_cmd = array( + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset HEAD --hard", + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git rebase origin" + ); + run_cmds($git_cmd); } else { - exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset --hard HEAD"); - exec("cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git rebase origin/$branch"); + $git_cmd = array( + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset HEAD --hard", + "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git rebase origin/$branch" + ); } + run_cmds($git_cmd); } else { exec("mkdir -p $CODIR/pfSenseGITREPO"); echo "Executing cd $CODIR/pfSenseGITREPO && git clone $GIT_REPO pfSenseGITREPO\n"; @@ -179,6 +185,8 @@ exec($command); post_cvssync_commands(); +run_cmds($git_cmd); + echo "===> Checkout complete.\n"; echo "\n"; echo "Your system is now sync'd and PHP and Lighty will be restarted in 5 seconds.\n\n"; @@ -237,4 +245,11 @@ function isUrl($url = "") { return false; } +function run_cmds($cmds) { + foreach($cmds as $cmd) { + echo "Running $cmd"; + exec($cmd); + } +} + conf_mount_ro(); -- cgit v1.1