#!/bin/sh # # Copyright 2005 Orangevolt (www.orangevolt.com) abs_file() { FIRST_CHAR=`echo $1 | cut -c1` if [ "${FIRST_CHAR}" = "/" ] then absolutepath=$1 else PWD=`pwd` absolutepath="${PWD}/$1" fi } get_abs_file() { abs_file $1 if [ -L "$absolutepath" ]; then absolutepath=`ls -l $absolutepath | cut -d\> -f2` abs_file $absolutepath # echo "File is a link: $absolutepath" get_abs_file $absolutepath # else # echo "File is not a link: $absolutepath" fi } get_abs_file $0 # now absolutepath is valid #echo $absolutepath path=${absolutepath%/*} # now path is valid #echo $path absolutename=${absolutepath##*/} # now absolutepath is valid #echo $absolutename name=${absolutename%%.*} # now name is valid #echo $name exe="__EXECUTABLE__NAME__" path="__EXECUTABLE__PATH__" if [ ! -d "/tmp/$absolutename" ] then mkdir /tmp/$absolutename fi unzip -o -qq $0 -d /tmp/$absolutename >/dev/null 2>&1 echo "cd /tmp/$absolutename$path" cd /tmp/$absolutename$path #chmod 755 $exe #echo "$exe $@" $exe $@ exit 0 ##### zipped content starts here ####