diff options
-rw-r--r-- | etc/phpshellsessions/gitsync | 23 |
1 files changed, 19 insertions, 4 deletions
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(); |