summaryrefslogtreecommitdiffstats
path: root/Cancer/query/realpath/install
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-12-30 03:57:10 +0100
committermakefu <github@syntax-fehler.de>2013-12-30 03:57:10 +0100
commit17890aed8488845cd38aac917596048f3f716387 (patch)
treee6c9bdcc43154598850f055bb728c307ccb88517 /Cancer/query/realpath/install
parent25f7b33bf43e4d7a049eb1f4885d24f24ac1dca9 (diff)
//query -> //Cancer
Diffstat (limited to 'Cancer/query/realpath/install')
-rwxr-xr-xCancer/query/realpath/install41
1 files changed, 41 insertions, 0 deletions
diff --git a/Cancer/query/realpath/install b/Cancer/query/realpath/install
new file mode 100755
index 00000000..74671c81
--- /dev/null
+++ b/Cancer/query/realpath/install
@@ -0,0 +1,41 @@
+#! /bin/sh
+set -euf
+
+cd `dirname $0`
+
+target=../../bin/realpath
+
+findexe() {
+ OLDIFS="$IFS"
+ IFS=:
+ for d in $PATH; do
+ f="$d/$1"
+ if test -f "$f" -a -x "$f"; then
+ echo $f
+ IFS="$OLDIFS"
+ return
+ fi
+ done
+ IFS="$OLDIFS"
+ ! :
+}
+
+if exe="`findexe readlink`" && $exe -f install | grep -q /install$; then
+ ! test -e $target || rm $target
+ cat > $target <<EOF
+#! /bin/sh -euf
+exec $exe -f "\${1-\$file_name}"
+EOF
+ chmod +x $target
+ echo '//query/realpath: install readlink' >&2
+ exit
+fi
+
+if type ruby 1>/dev/null 2>/dev/null; then
+ ln -snf ../query/realpath/src/realpath.rb $target
+ echo '//query/realpath: install realpath.rb' >&2
+ exit
+fi
+
+echo 'Error 2: your system is made of stupid!'
+exit 23