--- /dev/null
+#!/bin/sh
+# This is a preprocessor for 'less'. It is used when this environment
+# variable is set: LESSOPEN="|lesspipe.sh %s"
+
+lesspipe() {
+ case "$1" in
+ *.tar) tar tvvf $1 2>/dev/null ;; # View contents of .tar and .tgz files
+ *.tgz|*.tar.gz|*.tar.Z|*.tar.z) gzip -dc $1 | tar tvvf - 2>/dev/null ;;
+ *.tar.bz2) bzip2 -dc $1 | tar tvvf - 2>/dev/null ;;
+ *.zip) unzip -l $1 2>/dev/null ;;
+ *.[1-9n]|*.man)
+ groff -te -Tascii -mandoc $1 ;;
+ *.[1-9].gz|*.man.gz)
+ gzip -dc $1 | groff -te -Tascii -mandoc ;;
+ *.Z|*.z|*.gz) gzip -dc $1 2>/dev/null ;; # View compressed files correctly
+ *.bz2) bzip2 -dc $1 2>/dev/null ;; # View compressed files correctly
+# *) FILE=`file -L $1` ; # Check to see if binary, if so -- view with 'strings'
+# FILE1=`echo $FILE | cut -d ' ' -f 2`
+# FILE2=`echo $FILE | cut -d ' ' -f 3`
+# if [ "$FILE1" = "Linux/i386" -o "$FILE2" = "Linux/i386" \
+# -o "$FILE1" = "ELF" -o "$FILE2" = "ELF" ]; then
+# strings $1
+# fi ;;
+ esac
+}
+
+lesspipe $1
echo " all done."
###--------------------------------------------------------------------------
-### Install necessary things.
-
-echo "Installing useful scripts..."
-
-scripts="
- lesspipe.sh start-ssh-agent svnwrap"
-for script in $scripts; do
- $echon " $script:$echoc"
- found=
- for p in /bin /usr/bin /usr/local/bin $(echo $PATH | tr : ' '); do
- if $false [ -x $p/$script ]; then
- found=t
- break
- fi
- done
- if [ "$found" ]; then
- echo " already installed."
- else
- $echon " downloading$echoc"
- $GETURL $HOME$sub/bin/$script $REPO/$script
- chmod +x $HOME$sub/bin/$script
- echo " done."
- fi
-done
-
-echo " all done."
-
-###--------------------------------------------------------------------------
### Install some more complicated programs.
echo "Installing packages..."
systems="
- mlib:2.0.4:crc-mktab
- chkpath:1.1.0:tmpdir
+ mlib:crc-mktab
+ checkpath:tmpdir
"
[ "$xstuff" ] && systems="$systems
- xtoys:1.4.0:xatom
+ xtoys:xatom
"
for system in $systems; do
set -- $(echo $system | tr : ' ')
- sys=$1 ver=$2 prog=$3
+ sys=$1 prog=$2
$echon " $sys:$echoc"
if $false $prog >/dev/null 2>&1 --version; then
echo " already installed."
( set -e
$echon " downloading$echoc"
cd $HOME$sub/src
- rm -rf $sys-$ver.tar.gz $sys-$ver
- $GETURL $sys-$ver.tar.gz $REPO/$sys-$ver.tar.gz
+ rm -rf $sys.tar.gz $sys-$ver
+ $GETURL $sys.tar.gz $REPO/$sys.tar.gz
$echon " unpacking$echoc"
- gzip -cd $sys-$ver.tar.gz | tar xf -
+ dir=$(gzip -cd $sys.tar.gz | tar tf - | head -1)
+ gzip -cd $sys.tar.gz | tar xf -
$echon " configuring$echoc"
- cd $sys-$ver
+ cd $dir
mkdir build
cd build
../configure --prefix=$HOME$sub >>buildlog 2>&1
mdw-editor
mdw-conf
movemail-hack
- emerge-hack"
+ emerge-hack
+ lesspipe.sh
+ start-ssh-agent
+ svnwrap"
[ "$xstuff" ] && scripts="$scripts
xrun
xshutdown"
--- /dev/null
+#! /bin/sh
+
+set -e
+usage="Usage: $0 [-bc] [COMMAND [ARGS...]]"
+
+### Parse options
+case "${SHELL-/bin/sh}" in
+ *csh*) style=csh;;
+ *) style=sh;;
+esac
+force= chosen= commands=
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h | --help) echo "$usage"; exit 0;;
+ -c | --cshell | --tcsh) style=csh chosen=t;;
+ -b | --bourne | --bash | --zsh) style=sh chosen=t;;
+ -f | --force) force=t;;
+ --) shift; break;;
+ -*) echo >&2 "$usage"; exit 1;;
+ *) break;;
+ esac
+ shift
+done
+[ $# -gt 0 ] && style=commands
+case $chosen,$style in
+ t,commands)
+ echo >&2 "$0: output style and commands? you're odd"
+ exit 1
+ ;;
+esac
+
+### Should I start a new agent?
+case "$force,$SSH_AUTH_SOCK" in
+ t,* | ,)
+ start=t
+ ;;
+ *)
+ start=
+ set +e; ssh-add -l >/dev/null 2>&1; rc=$?; set -e
+ [ $rc -ge 2 ] && start=t
+ ;;
+esac
+
+### If so, do that
+if [ "$start" ]; then
+ hostname=${HOST-$(hostname)}
+ user=${USER-${LOGNAME-$(whoami)}}
+ dir=$TMPDIR/.ssh-agent.$hostname.$user socket=$dir/sock pid=$dir/pid
+ mkdir -p -m700 "$dir"
+ SSH_AUTH_SOCK=$socket; export SSH_AUTH_SOCK
+ set +e; ssh-add -l >/dev/null 2>&1; rc=$?; set -e
+ if [ $rc -ge 2 ]; then
+ if [ -f "$pid" ]; then
+ kill $(cat "$pid") >/dev/null 2>&1 || :
+ fi
+ rm -f "$socket" "$pid"
+ (cd /; exec ssh-agent -d -a "$socket" >/dev/null 2>&1)&
+ echo $! >"$pid"
+ SSH_AUTH_SOCK=$socket; export SSH_AUTH_SOCK
+ fi
+fi
+
+### Run a program, or export the details
+case $style in
+ sh)
+ echo "SSH_AUTH_SOCK='$SSH_AUTH_SOCK'; export SSH_AUTH_SOCK"
+ ;;
+ csh)
+ echo "setenv SSH_AUTH_SOCK '$SSH_AUTH_SOCK'"
+ ;;
+ commands)
+ exec "$@"
+ ;;
+esac
--- /dev/null
+#! /bin/bash
+
+set -e
+me=${0##*/}
+
+# --- Snarfle the arguments ---
+
+declare -a cmd
+declare -i i seq
+
+i=1 seq=0
+for j; do
+ file=$1; shift
+ case "$file" in
+ :*) file=$SVNROOT/${file#:};;
+ esac
+ cmd[i]=$file
+ i=i+1
+done
+
+# --- Run the program ---
+
+exec svn "${cmd[@]}"