# vim: set ft=sh: # --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../runit/overlay.d/runit/D%libdir_runit-run.in.txt # Copyright (C) 2010 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. A copy of the # GNU General Public License can be found in the file COPYING. # --- SDE-COPYRIGHT-NOTE-END --- usage() { cat <&2 usage: $0 ln -s $0 ; EOT exit 1 } die() { [ $# -eq 0 ] || echo "$*" >&2 exit 1 } progname() { case "$1" in /*) echo "$1" ;; */*) echo "$(cd "${1%/*}"; pwd)/${1##*/}" ;; *) if [ "$PWD" = / ]; then echo "/$1" else echo "$PWD/$1" fi ;; esac } case "$0" in D_sbindir/${TEMPLATE:-runit-run}) # Sha-Bang'ed [ $# -gt 0 ] || usage if [ -s "$1" ] && ${SHELL:-sh} -n "$1"; then PROGNAME="$(progname "$1")"; shift SCRIPT=yes else die "$PROGNAME: invalid script" >&2 fi ;; *) # symlinked PROGNAME="$(progname "$0")" SCRIPT= esac cd "${PROGNAME%/*}"