summaryrefslogtreecommitdiffstats
path: root/etc/phpshellsessions/gitsync
diff options
context:
space:
mode:
authorErik Fonnesbeck <efonnes@gmail.com>2012-04-07 16:20:58 -0600
committerErik Fonnesbeck <efonnes@gmail.com>2012-04-07 16:20:58 -0600
commit26b8990538c71c99df8e95fd5fada57f79465d93 (patch)
tree2c71802bf9ada297978106a2da03e778e86736df /etc/phpshellsessions/gitsync
parent0b4ae4b5caa2f64acec0fc89c3c5801de9e9c73e (diff)
downloadpfsense-26b8990538c71c99df8e95fd5fada57f79465d93.zip
pfsense-26b8990538c71c99df8e95fd5fada57f79465d93.tar.gz
Move some constants in gitsync closer to the top of the source code and add some new ones of potential interest to those reconfiguring gitsync. Also modify messages to indicate that Git URLs are also allowed.
Diffstat (limited to 'etc/phpshellsessions/gitsync')
-rw-r--r--etc/phpshellsessions/gitsync38
1 files changed, 20 insertions, 18 deletions
diff --git a/etc/phpshellsessions/gitsync b/etc/phpshellsessions/gitsync
index f66f541..9fd5b66 100644
--- a/etc/phpshellsessions/gitsync
+++ b/etc/phpshellsessions/gitsync
@@ -14,7 +14,17 @@ require_once("pfsense-utils.inc");
conf_mount_rw();
$GIT_REPO="git://github.com/bsdperimeter/pfsense.git";
+$DEFAULT_BRANCH = "master";
$CODIR = "/root/pfsense/";
+$GITSYNC_MERGE = "/root/.gitsync_merge";
+
+/* NOTE: Set branches here */
+$branches = array(
+ "master" => "2.1 development branch",
+ "RELENG_2_0" => "2.0.* release branch",
+ "RELENG_1_2" => "1.2.* release branch",
+ "build_commit" => "The commit originally used to build the image"
+);
global $g;
global $argv;
@@ -50,14 +60,6 @@ if(is_dir("/root/pfsense/RELENG_1_2"))
if(is_dir("/root/pfsense/HEAD"))
exec("rm -rf /root/pfsense/HEAD");
-/* NOTE: Set branches here */
-$branches = array(
- "master" => "2.1 development branch",
- "RELENG_2_0" => "2.0.* release branch",
- "RELENG_1_2" => "1.2.* release branch",
- "build_commit" => "The commit originally used to build the image"
-);
-
if(file_exists("/root/cvssync_backup.tgz")) {
$backup_date = `ls -lah /root/cvssync_backup.tgz | awk '{ print $6,$7,$8 }'`;
$tmp = array("RESTORE" => "Restores prior CVSSync backup data performed at {$backup_date}");
@@ -80,7 +82,7 @@ if($command_split[2]) {
foreach($branches as $branchname => $branchdesc) {
echo "{$branchname} \t {$branchdesc}\n";
}
- echo "\nOr alternatively you may enter a custom RCS branch URL (HTTP).\n\n";
+ echo "\nOr alternatively you may enter a custom RCS branch URL (Git or HTTP).\n\n";
$branch = readline("> ");
echo "\n";
} else {
@@ -128,9 +130,9 @@ if(!$found) {
$command = readline("Is this a custom GIT URL? [y]? ");
if(strtolower($command) == "y" or $command == "") {
$GIT_REPO = $branch;
- $command = readline("Checkout which branch [master]? ");
+ $command = readline("Checkout which branch [${DEFAULT_BRANCH}]? ");
if($command == "")
- $branch = "master";
+ $branch = $DEFAULT_BRANCH;
if($command)
$branch = $command;
$found = true;
@@ -145,10 +147,10 @@ if(!$found) {
}
$merge_repos = array();
-if(file_exists("/root/.gitsync_merge")) {
- $gitsync_merges = file("/root/.gitsync_merge", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+if(file_exists($GITSYNC_MERGE)) {
+ $gitsync_merges = file($GITSYNC_MERGE, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if(!empty($gitsync_merges) && is_array($gitsync_merges)) {
- echo "\n===> Automatic merge list read from /root/.gitsync_merge\n";
+ echo "\n===> Automatic merge list read from ${GITSYNC_MERGE}\n";
foreach($gitsync_merges as $merge_line_num => $merge_line) {
$merge_comments = explode("#", trim($merge_line));
if(empty($merge_comments[0]))
@@ -169,12 +171,12 @@ if(file_exists("/root/.gitsync_merge")) {
}
if(!$command_split[2] && !$argv[3] && !$upgrading) {
do {
- echo "\nAdd a custom RCS branch URL (HTTP) to merge in or press enter if done.\n\n";
+ echo "\nAdd a custom RCS branch URL (Git or HTTP) to merge in or press enter if done.\n\n";
$merge_repo = readline("> ");
if(!empty($merge_repo)) {
- $merge_branch = readline("Merge which branch [master]? ");
+ $merge_branch = readline("Merge which branch [${DEFAULT_BRANCH}]? ");
if($merge_branch == "")
- $merge_repos[] = array('repo' => $merge_repo, 'branch' => 'master');
+ $merge_repos[] = array('repo' => $merge_repo, 'branch' => $DEFAULT_BRANCH);
else if($merge_branch)
$merge_repos[] = array('repo' => $merge_repo, 'branch' => $merge_branch);
}
@@ -352,7 +354,7 @@ function isUrl($url = "") {
if($url)
if(strstr($url, "rcs.pfsense.org") or
strstr($url, "mainline") or
- strstr($url, ".git"))
+ strstr($url, ".git") or strstr($url, "git://"))
return true;
return false;
}
OpenPOWER on IntegriCloud