Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

heirloom-sh - download/compile/run old 'sh'

  • Loading branch information...
commit 90fa89d4d478e8c2944a9d60902047d8e00dbf16 1 parent 39e794f
@rking rking authored rking@sharpsaw.org committed
Showing with 37 additions and 0 deletions.
  1. +37 −0 bin/heirloom-sh
View
37 bin/heirloom-sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Run (maybe make (maybe download)) the "Traditional Unix Shell" (useful for testing shell portability.)
+HEIRLOOM_BASE_DIR=${HEIRLOOM_BASE_DIR:-~/pkg}
+HEIRLOOM_DIR="$HEIRLOOM_BASE_DIR/heirloom-sh"
+CVS_ROOT=:pserver:anonymous@heirloom.cvs.sourceforge.net:/cvsroot/heirloom
+
+run() {
+ [ -x $HEIRLOOM_DIR/sh ] && exec $HEIRLOOM_DIR/sh "$@"
+}
+retry() {
+ exec $0 "$@"
+}
+build () {
+ echo "Found $HEIRLOOM_DIR, but no 'sh' executable. Building."
+ cd $HEIRLOOM_DIR
+ make && echo Ok\!; echo
+}
+download() {
+ type cvs || (echo 'Requires `cvs` to download. =('; exit 1)
+ [ -d $HEIRLOOM_BASE_DIR ] || \
+ mkdir $HEIRLOOM_BASE_DIR || \
+ (echo 'Weird. Couldn''t `mkdir $HEIRLOOM_BASE_DIR`'; exit 1)
+ cd $HEIRLOOM_BASE_DIR
+ cvs -d$CVS_ROOT co -P heirloom-sh
+ cd $_
+ type ctags && ctags -R . &
+}
+
+if [ -e $HEIRLOOM_DIR ]; then
+ run "$@"
+ build
+ retry "$@"
+else
+ download
+ build
+ retry "$@"
+fi
Please sign in to comment.
Something went wrong with that request. Please try again.