alex Sun Jul 22 19:55:01 2001 EDT
Modified files:
/r2/binarycloud/ext get_pear.sh
Log:
Made this a pretty smart script for getting pear from cvs.
Soon this will (hopefully) do an automatic install of PEAR, also.
Index: r2/binarycloud/ext/get_pear.sh
diff -u r2/binarycloud/ext/get_pear.sh:1.1 r2/binarycloud/ext/get_pear.sh:1.2
--- r2/binarycloud/ext/get_pear.sh:1.1 Wed Jul 11 15:01:56 2001
+++ r2/binarycloud/ext/get_pear.sh Sun Jul 22 19:55:01 2001
@@ -1,10 +1,131 @@
-#!/bin/sh
-#
+# {{{ Header
+# -File $Id: get_pear.sh,v 1.2 2001/07/23 02:55:01 alex Exp $
+# -License LGPL (http://www.gnu.org/copyleft/lesser.html)
+# -Copyright 2001, The Turing Studio, Inc.
+# -Author alex black, en...@tu...
+# }}}
+
+
# Note that the php repository password is "phpfi"
# This will check out the entire PEAR tree (for the moment)
# to pwd/pear
-#
+
+do_cvs_checkout() {
+ echo "----------------------------------------";
+ cvs -d :pserver:cv...@cv...:/repository login
+ cvs -d :pserver:cv...@cv...:/repository co pear
+ #echo "doing the checkout.. testing";
+ echo "----------------------------------------";
+}
+
+do_cvs_update() {
+ echo "----------------------------------------";
+ cvs -d :pserver:cv...@cv...:/repository login
+ cvs up -P pear
+ #echo "doing the update.. testing";
+ echo "----------------------------------------";
+}
+
+
+rm_pear_dir() {
+ rm -rf pear/;
+}
+
+rm_cvs_in_pear_dir() {
+ echo "----------------------------------------";
+ find ./pear/ -name CVS -exec rm -rf {} \;
+ echo "----------------------------------------";
+}
+
+do_user_action() {
+
+ if (test ${user_action} = "--help") then
+ echo "This script checks out or updates the pear repository in ext/";
+ echo "The repository password for php cvs is phpfi";
+ echo "Some shortcuts:";
+ echo " -rmcvs removes all CVS dirs from pear/";
+ echo " -up logs in and updates the pear dir";
+ echo " -co deletes the current pear/ dir and does a fresh checkout";
+ exit;
+
+ elif (test ${user_action} = "rmcvs") then
+ rm_cvs_in_pear_dir
+ echo " --> Removed CVS Dirs in pear/. Exiting.";
+ exit;
+
+ elif (test ${user_action} = "up") then
+ do_cvs_update
+ echo " --> Completed CVS update in pear/. Exiting.";
+ exit;
+
+ elif (test ${user_action} = "co") then
+ rm_pear_dir
+ echo " --> Removed pear/ dir.";
+ do_cvs_checkout
+ echo " --> Completed CVS checkout into pear/. Exiting.";
+ exit;
+
+ else
+ echo " --> No action specified. Exiting";
+ exit;
+ fi
+}
+
+echo_read_menu() {
+ echo " ";
+ echo "----------------------------------------";
+ echo "PEAR dir found. Please select an action:"
+ echo "----------------------------------------";
+ echo "1) Remove CVS dirs from pear/";
+ echo "2) Do CVS Update in pear/";
+ echo "3) Remove pear/ and do a fresh checkout";
+ echo "4) Do nothing and exit";
+ echo "----------------------------------------";
+ echo " ";
+ echo -n "Please enter the number of your choice: ";
+ read user_choice
+}
+
+set_action_from_menu() {
+ if (test ${user_choice} = 1) then
+ user_action="rmcvs"
+ do_user_action
+
+ elif (test ${user_choice} = 2) then
+ user_action="up"
+ do_user_action
+
+ elif (test ${user_choice} = 3) then
+ user_action="co"
+ do_user_action
+
+ elif (test ${user_choice} = 4) then
+ echo "No action taken";
+ exit
+ else
+ echo "Invalid selection, please try again";
+ echo_read_menu
+ fi
+}
+
+# Process
+###########
+
+if (test $# != "0") then
+ user_action=${1}
+ do_user_action
+fi
+
+
+if (test -d pear) then
+ echo_read_menu
+ set_action_from_menu
+else
+ echo "----------------------------------------";
+ echo "No PEAR dir found. Doing Checkout"
+ echo "----------------------------------------";
+ user_action="co"
+ do_user_action
+fi
+
-cvs -d :pserver:cv...@cv...:/repository login
-rm -rf pear/
-cvs -d :pserver:cv...@cv...:/repository co pear
|