If you're running Freenet from a Portage-installed package on Gentoo, the
following script will work.

----------

#!/bin/sh
# Freenet Wrapper Script

if [ ${1} == "start" ]; then
        echo "/etc/init.d/freenet start"
        /etc/init.d/freenet start
fi

if [ ${1} == "stop" ]; then
        echo "/etc/init.d/freenet stop"
        /etc/init.d/freenet stop
fi

if [ ${1} == "restart" ]; then
        echo "/etc/init.d/freenet restart"
        /etc/init.d/freenet restart
fi

# The most important part follows.  This is to
# update the node.  The others are almost as easy
# to do myself, from the command line.  But the
# update script is the heart of the matter.

if [ ${1} == "update" ]; then
        cp -f /usr/lib/freenet/freenet.jar.old
/usr/lib/freenet/freenet.jar.ancient
        cp -f /usr/lib/freenet/freenet.jar /usr/lib/freenet/freenet.jar.old
        wget http://freenetproject.org/snapshots/freenet-latest.jar -O
/usr/lib/freenet/freenet.jar
        wget http://freenetproject.org/snapshots/seednodes.ref.bz2 -O
/var/freenet/seednodes.ref.bz2
        bunzip2 -f /var/freenet/seednodes.ref.bz2

        touch -d "1/1/1970" /var/freenet/seednodes.ref
        chown freenet:freenet /var/freenet/seednodes.ref
fi

----------

Call this script "freenet" and add it to your $PATH and running/administering
Freenet becomes a matter of typing 'freenet start'.  This may not be useful,
it's almost just as easy to type '/etc/init.d/freenet start', or you may have
'rc-update add freenet default' in the past.  But the fourth option 'freenet
update' is where it gets interesting.  The default install of Freenet, via
Portage, requires you to type that god-awful ebuild-config-wait-2-seconds
thing.  Once you get that typed in you have the problem of wget nuking your
Freenet jar if freenetproject.org is down.  This happened to me.  Wget tried to
overwrite the freenet.jar, but since the website was down, got no further than
the 0th byte, leaving me with no Freenet. =(

The above script fixes both of these issues.  It simplifies the command to
update Freenet, and it makes a backup of freenet.jar before downloading the new
one.

Caveats: It actually makes two backups.  This is probably not useful to anybody.
 You can remove the creation of the second backup.  Also, this doesn't handle
updating unstable nodes.  But if you're running unstable, you're more than
likely not running a Portage ebuild of Freenet.  Third caveat, I suppose, is
that this doesn't give you a 'freenet config' command.  'vi /etc/freenet.conf'.

-todd

_______________________________________________
Support mailing list
[EMAIL PROTECTED]
http://news.gmane.org/gmane.network.freenet.support
Unsubscribe at http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/support
Or mailto:[EMAIL PROTECTED]

Reply via email to