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


# Freenet Wrapper Script

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

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

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

# 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
        cp -f /usr/lib/freenet/freenet.jar /usr/lib/freenet/freenet.jar.old
        wget http://freenetproject.org/snapshots/freenet-latest.jar -O
        wget http://freenetproject.org/snapshots/seednodes.ref.bz2 -O
        bunzip2 -f /var/freenet/seednodes.ref.bz2

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


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

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'.


Support mailing list
Unsubscribe at http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/support

Reply via email to