]> code.delx.au - gnu-emacs-elpa/commitdiff
Go over install-from-git.sh
authorrocky <rocky@gnu.org>
Sat, 6 Apr 2013 11:37:33 +0000 (07:37 -0400)
committerrocky <rocky@gnu.org>
Sat, 6 Apr 2013 11:37:33 +0000 (07:37 -0400)
.gitignore
install-from-git.sh

index c822622da4838c619d139736195147f5f8a73dd7..f37d4a23f6814c9f097c22126be68b8e726dda25 100644 (file)
@@ -1,5 +1,5 @@
-*~
 *elc
+*~
 /Makefile
 /Makefile.in
 /aclocal.m4
@@ -10,3 +10,4 @@
 /elc-stamp
 /install-sh
 /missing
+/script
index f2d9d0393c14af46643d5563acb8042e0ac8f7d2..012c46a1f533d3c07aa73fface19626d1062b18f 100755 (executable)
@@ -1,5 +1,50 @@
 #!/bin/bash
-# Install emacs-dbgr from git
+# This installs all emcs-test-simple and its prerequisites. If you are lucky
+# you can just run this:
+#
+#   bash ./install-from-git.sh
+#
+# However we do provide for some customization...
+#
+# 1. GIT PROTOCOL
+# ===============
+#
+# If your "git clone" can't handle the "http" protocol, you might be
+# able to use the "git" protocol. To do this set the GIT_PROTOCOL
+# variable like this:
+#
+#     GIT_PROTOCOL=git sh ./install-from-git.sh
+#
+# 2. configure options (e.g --prefix)
+# ====================================
+
+# If you want to customize configuration parameters, for example,
+# choose where to install, you can pass configure options to this
+# script. For example:# can pass configure options.
+#
+#     sh ./install-from-git.sh --prefix=/tmp
+#
+# 3. TO "sudo" or not to "sudo"?
+# ==============================
+# If you are running as root on a *Nix-like box, then there's no problem.
+#
+# If you are not running as root, "sudo" might be invoked to install
+# code.  On systems that don't have a "sudo" command but need
+# filesystem permission, then you get by with setting SUDO_CMD to "su root-c"
+# For example:
+#
+#    SUDO_CMD='su root -c' sh ./install-from-git.sh
+#
+# If you have sufficient filesystem permission (which is often the
+# case on Windows or cygwin) then you might not need or want sudo. So
+# here, set SUDO_CMD to a blank:
+#
+#      SUDO_CMD=' ' sh ./install-from-git.sh
+#
+#
+# To finish here is an invocation using all 3 above options:
+#   GIT_PROTOCOL='git' SUDO_CMD=' ' sh ./install-from-git.sh --prefix=/tmp
+
 run_cmd() {
     echo "--- Running command: $@"
     $@
@@ -8,12 +53,24 @@ run_cmd() {
     return $rc
 }
 
-if (( $(id -u) != 0)) ; then 
-    need_sudo='sudo'
+if (( $(id -u) != 0)) ; then
+    if [[ -z "$SUDO_CMD" ]] ; then
+       need_sudo='sudo'
+       if which $need_sudo >/dev/null 2>&1 ; then
+           try_cmd=''
+       else
+           need_sudo='su root -c'
+           try_cmd='su'
+       fi
+    else
+       need_sudo="$SUDO_CMD"
+    fi
 else
     need_sudo=''
+    try_cmd=''
 fi
-for program in git make $need_sudo ; do
+
+for program in git make $try_cmd ; do
     if ! which $program >/dev/null 2>&1 ; then
        echo "Cant find program $program in $PATH"
        exit 1
@@ -25,10 +82,10 @@ for pkg in $packages ; do
     echo '******************************************'
     echo Trying to install ${pkg}...
     echo '******************************************'
-    run_cmd git clone http://github.com/rocky/${pkg}.git
+    run_cmd git clone ${GIT_PROTOCOL}://github.com/rocky/${pkg}.git
     (cd $pkg && \
         run_cmd $SHELL ./autogen.sh && \
-       run_cmd ./configure && \
+       run_cmd ./configure $@ && \
        run_cmd make && \
        run_cmd make check && \
         run_cmd $need_sudo make install