why not

INSTALL_PATH=`dirname $0`





>Hello,

>This variant does not depend on external definition of INSTALL_PATH or
>whatever, but derives it from the location of the 1run.sh binary itself.
>The INSTALL_PATH variable and its current uses should never lead to extraneous
>slashes in filepaths or URLs.

>This exact quoting works nicely even for directories having several consecutive
>spaces so beware touching that unless really needed [read: havn't tested with
>anything but bash]. Together with earlier patches this variant should work well
>for URLs too (and yes, URL encoding should be inside downloader code, as that
>encoding introduced solely for HTTP transport/protocol not for process
>parameters or anything).

>The method of finding out the script own directory teoretically might fail if
>the calling process makes certain dirty non-standard things with execve syscall
>parameters; but then it's the calling process who would be at fault. Not sure
>about the particular 'gui' installer [read: havn't tested], but for example
>Java Runtime Library does not provide means to munch with parameter #0 thus
>enforcing it to be valid, as well as many other environments do things robustly
>(shells themselves for example).

>===
>--- 1run.sh-old 2007-01-03 16:48:22.000000000 +0000
>+++ 1run.sh     2007-01-03 17:06:12.000000000 +0000
>@@ -1,8 +1,13 @@
> #!/bin/sh

>-INSTALL_PATH=${INSTALL_PATH:-$PWD}
>+cd "$(echo '$0' | sed -e 's|[^/]*$|..|')" || exit 1
>+INSTALL_PATH="$PWD"
>+if [ "$INSTALL_PATH" = "/" ] ; then
>+       # INSTALL_PATH=""
>+       echo "Intalling freenet at fs root is definitelly a bug"
>+       exit 1
>+fi

>-cd $INSTALL_PATH
> if test -s freenet-ext.jar
> then
>        echo "This script isn't meant to be used more than once."
>===

>Aga.
>_______________________________________________
>Devl mailing list
>[email protected]
>http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl



_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to