From 251b9a516e5419f14d1862d5f2726f6a1cf42192 Mon Sep 17 00:00:00 2001 From: gh2o Date: Sun, 20 Jul 2014 03:45:47 -0700 Subject: [PATCH] allow local running --- install.sh | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index a75e2ce..afe69b4 100755 --- a/install.sh +++ b/install.sh @@ -4,19 +4,36 @@ ### INSTRUCTIONS AT https://github.com/gh2o/digitalocean-debian-to-arch/ ### ################################################################################ +run_from_file() { + local f t + for f in /dev/fd/*; do + [ -h ${f} ] || continue + [ ${f} -ef "${0}" ] && return + done + t=$(mktemp) + cat >${t} + if [ "$(head -n 1 ${t})" = '#!/bin/bash' ]; then + chmod +x ${t} + exec /bin/bash ${t} "$@" &2 - exit 1 -fi - if [ -n "${POSIXLY_CORRECT}" ] || [ -z "${BASH_VERSION}" ]; then unset POSIXLY_CORRECT - exec bash "$0" "$@" + exec /bin/bash "${0}" "$@" exit 1 fi