Fixes:
- Now works with /bin/sh (obviously)
- gets IP correctly not only on Linux but on sane systems as *BSD & SunOS
- SunOS still needs work, someone *please* bring me those guys heads!
Their /bin/sh needs some getting used to..
+ doesn't have 'read -p'
+ doesn't have 'echo -n'
+ likes 'test -z {$foo}', which would break everything for the rest
- get random port number from random device
- use 'expr' for arithmetics
I tested the patch on FreeBSD & Linux, YMMV.
--- /opt/space/.vs/freenet-30102001/config.sh Tue Oct 30 09:30:02 2001
+++ config.sh Sun Nov 4 14:14:10 2001
@@ -1,5 +1,10 @@
-#!/bin/bash
+#!/bin/sh
+if [ `uname` = SunOS ]; then
+ AWK=gawk;
+else
+ AWK=awk;
+fi;
cat <<-EOF > freenet.conf
# Freenet configuration file
@@ -8,8 +13,8 @@
EOF
# Determine IP address
-DEFIP=$(/sbin/ifconfig | awk '{if ($1 == "inet") {split($2,a,":") ;print a[2];
exit}}')
-echo -n Please enter your IP address [$DEFIP] :
+DEFIP=`/sbin/ifconfig -a | "$AWK" '/inet .+[[:digit:]]\./ {print
substr($2,index($2,":")+1); exit}'`
+echo Please enter your IP address [$DEFIP] :
read ip
if test -z $ip; then
ip=$DEFIP
@@ -17,22 +22,23 @@
echo ipAddress=$ip >> freenet.conf
# Is this a transient node?
-echo -n Will you be running your node [F]ull-time or just [O]ccasionally? [F] :
+echo Will you be running your node [F]ull-time or just [O]ccasionally? [F] :
read trans
if test -z $trans; then
trans=F
fi
-echo -n How much disk space can Freenet use \(in bytes\) [209715200] :
+echo 'How much disk space can Freenet use (in bytes) [209715200] :'
read dssz
if test -z $dssz; then
dssz=209715200
fi
echo storeCacheSize=$dssz >> freenet.conf
-let DEFLP=($RANDOM%30000)+2000
+RAND=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c"1-5"`
+DEFLP=`expr \( $RAND % 30000 \) + 2000`
# We should really check for a port collision, but it is very unlikely
-echo -n What port should Freenet listen on [$DEFLP] :
+echo What port should Freenet listen on [$DEFLP] :
read lp
if test -z $lp; then
lp=$DEFLP
--
Volker Stolz * vs at foldr.org * PGP + S/MIME
_______________________________________________
Devl mailing list
Devl at freenetproject.org
http://lists.freenetproject.org/mailman/listinfo/devl