Author: toad
Date: 2008-05-01 13:47:49 +0000 (Thu, 01 May 2008)
New Revision: 19643

Added:
   trunk/apps/new_installer/res/unix/bin/install_autostart.sh
Modified:
   trunk/apps/new_installer/ProcessPanel.Spec.xml
   trunk/apps/new_installer/install.xml
Log:
Auto-start on reboot on unix.
Currently we use a cron job. This will work on non-root, and doesn't require 
the LSB-utils to be installed (they usually aren't).
However, we should make the script detect if it's run as root and the LSB utils 
exist, and if so, use the useradd and install_initd scripts.

Modified: trunk/apps/new_installer/ProcessPanel.Spec.xml
===================================================================
--- trunk/apps/new_installer/ProcessPanel.Spec.xml      2008-05-01 08:19:44 UTC 
(rev 19642)
+++ trunk/apps/new_installer/ProcessPanel.Spec.xml      2008-05-01 13:47:49 UTC 
(rev 19643)
@@ -184,6 +184,11 @@
                <executefile name="$INSTALL_PATH\bin\install_jsite.cmd"/>
        </job>

+       <job name="Setting up auto-start">
+               <os family="unix"/>
+               <executefile name="$INSTALL_PATH/bin/install_autostart.sh"/>
+       </job>
+
        <!-- Do I have to mention that nothing ought to be below ?  -->
        <job name="Cleaning up">
                <os family="unix"/>

Modified: trunk/apps/new_installer/install.xml
===================================================================
--- trunk/apps/new_installer/install.xml        2008-05-01 08:19:44 UTC (rev 
19642)
+++ trunk/apps/new_installer/install.xml        2008-05-01 13:47:49 UTC (rev 
19643)
@@ -225,6 +225,11 @@
                        <description>The opennet seednodes file. Used to 
connect quickly (but insecurely) to the network. The node will ask whether to 
use this after install.</description>
                        <singlefile src="res/license/LICENSE.Freenet" 
target="$INSTALL_PATH/opennet.install"/>
                </pack>
+               
+               <pack name="AutoStart" id="autostart" required="no" os="unix">
+                       <description>Start the node automatically on startup. 
Strongly recommended.</description>
+                       <singlefile src="res/license/LICENSE.Freenet" 
target="$INSTALL_PATH/autostart.install"/>
+               </pack>

                <pack name="UPnP" id="upnp" required="no">
                        <description>A plugin enabling the node to use 
Universal Plug and Play to determine your external internet address and set up 
port forwarding on your router. Note that this involves contacting your default 
gateway and may be a security risk on an untrusted LAN, however it improves 
connectivity significantly.</description>

Added: trunk/apps/new_installer/res/unix/bin/install_autostart.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/install_autostart.sh                  
        (rev 0)
+++ trunk/apps/new_installer/res/unix/bin/install_autostart.sh  2008-05-01 
13:47:49 UTC (rev 19643)
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. "$HOME/_install_toSource.sh"
+cd "$INSTALL_PATH"
+
+# FIXME if we are running as root, and they are installed use the LSB 
utilities, with crontab as a fallback.
+# See here: 
+# 
http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/initsrcinstrm.html
+# 
http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/useradd.html
+if test -e autostart.install
+then
+       echo "Enabling auto-start."
+       if test -x `which crontab`
+       then
+               echo "Installing cron job to start Freenet on reboot..."
+               rm -f crontab.tmp
+               crontab -l > crontab.tmp
+               echo "@reboot   \"$INSTALL_PATH/run.sh\" start" >> crontab.tmp
+               if crontab crontab.tmp
+               then
+                       echo Installed cron job.
+               else
+                       echo Could not install cron job, you will have to run 
run.sh start manually to start Freenet after a reboot.
+               fi
+               rm crontab.tmp
+       else
+               echo Cron appears not to be installed, you will have to run 
run.sh start manually to start Freenet after a reboot.
+       fi
+else
+       echo Auto-start is disabled, you will have to run run.sh start manually 
to start Freenet after a reboot.
+fi


Reply via email to