Hi,

Some months ago I was working on integrating SystemImager into LTSP. The idea was to run the installation scripts from an LTSP environment instead of running them from a custom initrd.

Why do this? Well, right now, if you want to modify some of this scripts, you have to regenerate the initrd and put it into the right place. As you usually make mistakes you have to repeat the process several times, which is a bit tedious. Things become worse when you need to regenerate the BOEL binaries tar ball, for example to update some of its utilities. It also a pain when something fails in the middle of an installation and you have to find out what happened from a so limited busy box environment.

So, what do we get from this? With LTSP we get a chroot of a standard distribution mounted through NFS, which means we can modify any file and install/upgrade any package in a really easy way. This makes it easier to test new functionality and debug problems.

With the attached patch I've succeeded doing installations with both rsync and BitTorrent, but there's still a lot of work do. I've not tested multicast and SSH installations, support for all installation parameters is incomplete and some other things don't work as they should.

As I don't think I'll be able to work on this anymore, I drop it here in the hope someone finds it useful. Apart from the patch, I've also attached the instructions on how to integrate the SystemImager scripts into the LTSP chroot.

Cheers,
Àlex

=== modified file 'etc/autoinstallscript.template'
--- etc/autoinstallscript.template	2009-08-11 09:00:44 +0000
+++ etc/autoinstallscript.template	2009-05-12 09:21:11 +0000
@@ -23,7 +23,7 @@
 . /tmp/variables.txt
 
 # Load functions and other variables
-. /etc/init.d/functions
+. /etc/init.d/functions.systemimager
 
 get_arch
 

=== modified file 'initrd_source/skel/etc/init.d/functions'
--- initrd_source/skel/etc/init.d/functions	2009-08-11 09:00:44 +0000
+++ initrd_source/skel/etc/init.d/functions	2009-06-02 12:01:41 +0000
@@ -130,51 +130,49 @@
     logmsg
     logmsg write_variables
 
-    if fs_on_tmpfs / ; then
-        # pass all variables set here on to the hostname.sh script
-        rm -f /tmp/variables.txt
-        
-        echo "HOSTNAME=$HOSTNAME"                   >> /tmp/variables.txt || shellout
-        echo "DOMAINNAME=$DOMAINNAME"               >> /tmp/variables.txt
-        
-        echo "DEVICE=$DEVICE"                       >> /tmp/variables.txt
-        echo "IPADDR=$IPADDR"                       >> /tmp/variables.txt
-        echo "NETMASK=$NETMASK"                     >> /tmp/variables.txt
-        echo "NETWORK=$NETWORK"                     >> /tmp/variables.txt
-        echo "BROADCAST=$BROADCAST"                 >> /tmp/variables.txt
-        
-        echo "GATEWAY=$GATEWAY"                     >> /tmp/variables.txt
-        echo "GATEWAYDEV=$GATEWAYDEV"               >> /tmp/variables.txt
-        
-        echo "IMAGESERVER=$IMAGESERVER"             >> /tmp/variables.txt
-        echo "IMAGENAME=$IMAGENAME"                 >> /tmp/variables.txt
-        
-        echo "LOG_SERVER=$LOG_SERVER"               >> /tmp/variables.txt
-        echo "LOG_SERVER_PORT=$LOG_SERVER_PORT" 	>> /tmp/variables.txt
-        echo "USELOGGER=$USELOGGER"                 >> /tmp/variables.txt
-        
-        echo "TMPFS_STAGING=$TMPFS_STAGING"         >> /tmp/variables.txt
-        
-        echo "SSH=$SSH"	           	 		>> /tmp/variables.txt
-        echo "SSHD=$SSHD"	            		>> /tmp/variables.txt
-        echo "SSH_USER=$SSH_USER"	            	>> /tmp/variables.txt
-        echo "SSH_DOWNLOAD_URL=$SSH_DOWNLOAD_URL"	>> /tmp/variables.txt
-        
-        echo "FLAMETHROWER_DIRECTORY_PORTBASE=$FLAMETHROWER_DIRECTORY_PORTBASE"	>> /tmp/variables.txt
-        
-        echo "MONITOR_SERVER=$MONITOR_SERVER"           >> /tmp/variables.txt
-        echo "MONITOR_PORT=$MONITOR_PORT"               >> /tmp/variables.txt
-        echo "MONITOR_CONSOLE=$MONITOR_CONSOLE"         >> /tmp/variables.txt
-
-        echo "BITTORRENT=$BITTORRENT"                   >> /tmp/variables.txt
-        echo "BITTORRENT_STAGING=$BITTORRENT_STAGING"   >> /tmp/variables.txt
-        echo "BITTORRENT_POLLING_TIME=$BITTORRENT_POLLING_TIME" >> /tmp/variables.txt
-        echo "BITTORRENT_SEED_WAIT=$BITTORRENT_SEED_WAIT"       >> /tmp/variables.txt
-        echo "BITTORRENT_UPLOAD_MIN=$BITTORRENT_UPLOAD_MIN"     >> /tmp/variables.txt
-
-        echo "GROUPNAMES=\"$GROUPNAMES\""     >> /tmp/variables.txt
-        echo "GROUP_OVERRIDES=\"$GROUP_OVERRIDES\""     >> /tmp/variables.txt
-    fi
+    # pass all variables set here on to the hostname.sh script
+    rm -f /tmp/variables.txt
+    
+    echo "HOSTNAME=$HOSTNAME"                   >> /tmp/variables.txt || shellout
+    echo "DOMAINNAME=$DOMAINNAME"               >> /tmp/variables.txt
+    
+    echo "DEVICE=$DEVICE"                       >> /tmp/variables.txt
+    echo "IPADDR=$IPADDR"                       >> /tmp/variables.txt
+    echo "NETMASK=$NETMASK"                     >> /tmp/variables.txt
+    echo "NETWORK=$NETWORK"                     >> /tmp/variables.txt
+    echo "BROADCAST=$BROADCAST"                 >> /tmp/variables.txt
+    
+    echo "GATEWAY=$GATEWAY"                     >> /tmp/variables.txt
+    echo "GATEWAYDEV=$GATEWAYDEV"               >> /tmp/variables.txt
+    
+    echo "IMAGESERVER=$IMAGESERVER"             >> /tmp/variables.txt
+    echo "IMAGENAME=$IMAGENAME"                 >> /tmp/variables.txt
+    
+    echo "LOG_SERVER=$LOG_SERVER"               >> /tmp/variables.txt
+    echo "LOG_SERVER_PORT=$LOG_SERVER_PORT" 	>> /tmp/variables.txt
+    echo "USELOGGER=$USELOGGER"                 >> /tmp/variables.txt
+    
+    echo "TMPFS_STAGING=$TMPFS_STAGING"         >> /tmp/variables.txt
+    
+    echo "SSH=$SSH"	           	 		>> /tmp/variables.txt
+    echo "SSHD=$SSHD"	            		>> /tmp/variables.txt
+    echo "SSH_USER=$SSH_USER"	            	>> /tmp/variables.txt
+    echo "SSH_DOWNLOAD_URL=$SSH_DOWNLOAD_URL"	>> /tmp/variables.txt
+    
+    echo "FLAMETHROWER_DIRECTORY_PORTBASE=$FLAMETHROWER_DIRECTORY_PORTBASE"	>> /tmp/variables.txt
+    
+    echo "MONITOR_SERVER=$MONITOR_SERVER"           >> /tmp/variables.txt
+    echo "MONITOR_PORT=$MONITOR_PORT"               >> /tmp/variables.txt
+    echo "MONITOR_CONSOLE=$MONITOR_CONSOLE"         >> /tmp/variables.txt
+    
+    echo "BITTORRENT=$BITTORRENT"                   >> /tmp/variables.txt
+    echo "BITTORRENT_STAGING=$BITTORRENT_STAGING"   >> /tmp/variables.txt
+    echo "BITTORRENT_POLLING_TIME=$BITTORRENT_POLLING_TIME" >> /tmp/variables.txt
+    echo "BITTORRENT_SEED_WAIT=$BITTORRENT_SEED_WAIT"       >> /tmp/variables.txt
+    echo "BITTORRENT_UPLOAD_MIN=$BITTORRENT_UPLOAD_MIN"     >> /tmp/variables.txt
+    
+    echo "GROUPNAMES=\"$GROUPNAMES\""     >> /tmp/variables.txt
+    echo "GROUP_OVERRIDES=\"$GROUP_OVERRIDES\""     >> /tmp/variables.txt
 }
 #
 ################################################################################
@@ -224,7 +222,6 @@
     	logmsg "Installation failed!! Stopping report task."
         stop_report_task -1
     fi
-    exec sh > /dev/console 2>&1
 }
 #
 ################################################################################
@@ -488,7 +485,7 @@
     breathing_room=102400
 
     # Evaluate torrent size
-    torrent_size=$((`/bin/torrentinfo-console $torrent | sed -ne 's/^file size\.*: \([0-9]\+\).*$/\1/p'` / 1024 + $breathing_room))
+    torrent_size=$((`torrentinfo-console $torrent | sed -ne 's/^file size\.*: \([0-9]\+\).*$/\1/p'` / 1024 + $breathing_room))
 
     # Find a directory to host the image tarball
     for dir in $preferred_dirs; do
@@ -519,7 +516,7 @@
         bittorrent_upload_min=${BITTORRENT_UPLOAD_MIN:-50}
 
         # Start downloading.
-        /bin/bittorrent-console --no_upnp --no_start_trackerless_client --max_upload_rate 0 --display_interval 1 --rerequest_interval 1 --bind ${IPADDR} --save_in ${destination} ${torrent} > $bittorrent_log &
+        bittorrent-console --no_upnp --no_start_trackerless_client --max_upload_rate 0 --display_interval 1 --rerequest_interval 1 --bind ${IPADDR} --save_in ${destination} ${torrent} > $bittorrent_log &
         pid=$!
         if [ ! -d /proc/$pid ]; then
             logmsg "error: couldn't run bittorrent-console!"
@@ -588,64 +585,6 @@
 #
 ################################################################################
 #
-#   Get other binaries, kernel module tree, and miscellaneous other stuff that
-#   got put in the binaries tarball. -BEF-
-#
-get_boel_binaries_tarball() {
-
-    logmsg
-    logmsg get_boel_binaries_tarball
-    mkdir -p ${BOEL_BINARIES_DIR}
-
-    if [ ! -z $SSH_DOWNLOAD_URL ]; then
-        # If we're using SSH, get the boel_binaries from a web server.
-        logmsg "SSH_DOWNLOAD_URL variable is set, so we will install over SSH!"
-
-        if [ ! -z $FLAMETHROWER_DIRECTORY_PORTBASE ]; then
-            logmsg "FLAMETHROWER_DIRECTORY_PORTBASE is also set, but I will be conservative and proceed with SSH."
-        fi
-
-        # Remove possible trailing / from URL
-        SSH_DOWNLOAD_URL=`echo $SSH_DOWNLOAD_URL | sed 's/\/$//'`
-
-        cd ${BOEL_BINARIES_DIR}
-        CMD="wget ${SSH_DOWNLOAD_URL}/${ARCH}/${FLAVOR}/boel_binaries.tar.gz"
-        logmsg "$CMD"
-        $CMD || shellout
-
-    elif [ "x$BITTORRENT" = "xy" ]; then
-
-        # Download BOEL binaries from peers
-        bittorrent_tarball="boel_binaries.tar.gz"
-        logmsg "Start downloading ${bittorrent_tarball} (${ARCH}) using bittorrent"
-        logmsg ""
-        logmsg "--> INFO: remember to start /etc/init.d/systemimager-server-bittorrent on the image server!"
-        logmsg ""
-        bittorrent_get_file ${TORRENTS_DIR}/${ARCH}-${bittorrent_tarball}.torrent ${BOEL_BINARIES_DIR}
-        cd ${BOEL_BINARIES_DIR} && mv ${ARCH}-${bittorrent_tarball} ${bittorrent_tarball}
-        unset bittorrent_tarball
-
-    elif [ ! -z $FLAMETHROWER_DIRECTORY_PORTBASE ]; then
-
-        MODULE_NAME="boot-${ARCH}-${FLAVOR}"
-        DIR="${BOEL_BINARIES_DIR}"
-        RETRY=7
-        flamethrower_client
-
-    else
-        # Use rsync
-        CMD="rsync -av ${IMAGESERVER}::boot/${ARCH}/${FLAVOR}/boel_binaries.tar.gz ${BOEL_BINARIES_DIR}"
-        logmsg "$CMD"
-        $CMD || shellout
-    fi
-
-    # Untar the tarball
-    tar -C / -xzf ${BOEL_BINARIES_DIR}/boel_binaries.tar.gz || shellout
-    chown -R 0.0 /lib/modules || shellout
-}
-#
-################################################################################
-#
 # Parse tmpfs options from /proc/cpuinfo
 # 
 parse_tmpfs_opts() {
@@ -698,72 +637,6 @@
 #
 ################################################################################
 #
-#   Switch root to tmpfs
-#
-switch_root_to_tmpfs() {
-    local MODULE=tmpfs
-    logmsg
-    logmsg switch_root_to_tmpfs
-    logmsg
-    logmsg "Loading $MODULE... "
-    modprobe $MODULE 2>/dev/null && logmsg "done!" || logmsg "Didn't load -- assuming it's built into the kernel."
-    parse_tmpfs_opts
-
-    # Switch root over to tmpfs so we don't have to worry about the size of
-    # the tarball and binaries that users may decide to copy over. -BEF-
-    if [ -d /old_root ]; then
-        logmsg
-        logmsg "already switched to tmpfs..."
-    else
-        logmsg
-        logmsg "switching root to tmpfs..."
-
-        mkdir -p /new_root || shellout
-        mount tmpfs /new_root -t tmpfs $tmpfs_opts || shellout
-        cd / || shellout
-        cp -a `/bin/ls | grep -v new_root` /new_root/ || shellout
-        cd /new_root || shellout
-        mkdir -p old_root || shellout
-        pivot_root . old_root || switch_root
-    fi
-
-    unset tmpfs_opts
-}
-#
-################################################################################
-#
-# Now mount proc. -BEF-
-mount_proc() {
-    logmsg
-    logmsg mount_proc
-    mkdir -p /proc || shellout
-    mount proc /proc -t proc || shellout
-}
-#
-################################################################################
-#
-mount_sys() {
-    logmsg
-    logmsg mount_sys
-    mkdir -p /sys || shellout
-    if grep -q '[[:space:]]\+sysfs$' /proc/filesystems 2>/dev/null; then
-        mount sysfs /sys -t sysfs || shellout
-    else
-        logmsg "sysfs is not supported by the kernel: `uname -r`"
-    fi
-}
-#
-################################################################################
-#
-mount_pts() {
-    logmsg
-    logmsg mount_pts
-    mkdir -p /dev/pts || shellout
-    mount devpts /dev/pts -t devpts || shellout
-}
-#
-################################################################################
-#
 monitor_save_dmesg() {
     if [ -z $MONITOR_SERVER ]; then
         return
@@ -775,56 +648,6 @@
 #
 ################################################################################
 #
-start_udevd() {
-    #
-    # Start udevd first, then hotplug
-    logmsg
-    logmsg start_udevd
-    /etc/init.d/udev start
-
-    # If udev failed fall back to a static /dev
-    if [ $? -ne 0 ]; then
-        logmsg "failed!"
-        logmsg "Creating a static /dev..."
-        cd / && tar -xzf dev.tar.gz || shellout
-        logmsg done
-    fi
-}
-#
-################################################################################
-#
-start_hotplug() {
-    #
-    # Start udevd first, then hotplug
-    logmsg
-    logmsg start_hotplug
-    touch /etc/fstab
-    /etc/init.d/hotplug start
-
-}
-#
-################################################################################
-#
-# Configure loopback interface (may as well)
-ifconfig_loopback() {
-    logmsg
-    logmsg ifconfig_loopback
-    ifconfig lo 127.0.0.1
-}
-#
-################################################################################
-#
-# Load any modules that were placed in the my_modules directory prior to
-# running "make initrd.gz".  -BEF-
-load_my_modules() {
-    logmsg
-    logmsg load_my_modules
-    cd /my_modules || shellout
-    sh ./INSMOD_COMMANDS
-}
-#
-################################################################################
-#
 # read in varibles obtained from kernel appends
 #
 read_kernel_append_parameters() {
@@ -928,119 +751,12 @@
         . /tmp/local.cfg || shellout
     fi
 }
-#
-################################################################################
-#
-#   Configure network interface using local.cfg settings if possible, else
-#   use DHCP. -BEF-
-#
-start_network() {
-    logmsg
-    logmsg start_network
-    if [ ! -z $IPADDR ]; then
-
-        # configure interface and add default gateway
-        ifconfig $DEVICE $IPADDR  netmask $NETMASK  broadcast $BROADCAST
-        if [ $? != 0 ]; then
-            logmsg
-            logmsg "I couldn't configure the network interface using your pre-boot settings:"
-            logmsg "  DEVICE:     $DEVICE"
-            logmsg "  IPADDR:     $IPADDR"
-            logmsg "  NETMASK:    $NETMASK"
-            logmsg "  BROADCAST:  $BROADCAST"
-            logmsg
-            shellout
-        fi
-
-        if [ ! -z $GATEWAY ]; then
-            route add default gw $GATEWAY
-            if [ $? != 0 ]; then
-                logmsg
-                logmsg "The command \"route add default gw $GATEWAY\" failed."
-                logmsg "Check your pre-boot network settings."
-                logmsg
-                shellout
-            fi
-        fi
-
-    else
-
-        ### try dhcp ###
-        logmsg "IP Address not set with pre-boot settings."
-        
-        ### BEGIN ether sleep ###
-        # Give the switch time to start passing packets.  Some switches won't
-        # forward packets until 30 seconds or so after an interface comes up.
-        # This means the dhcp server won't even get the request for 30 seconds.
-        # Many ethernet cards aren't considered "up" by the switch until the
-        # driver is loaded.  Because the driver is compiled directly into the
-        # kernel here, the driver is definitely loaded at this point. 
-        # 
-        # Default is 0.  The recommended setting of ETHER_SLEEP=35 can be set 
-        # with a local.cfg file. -BEF-
-        #
-        [ -z $ETHER_SLEEP ] && ETHER_SLEEP=0
-        logmsg
-        logmsg "sleep $ETHER_SLEEP:  This is to give your switch (if you're using one) time to"
-        logmsg "           recognize your ethernet card before we try the network."
-        logmsg "           Tip: You can use <ctrl>+<c> to pass the time (pun intended)."
-        logmsg
-        count_loop $ETHER_SLEEP
-        logmsg
-        ### END ether sleep ###
-        
-        # create directory to catch dhcp information
-        DHCLIENT_DIR="/var/state/dhcp"
-        mkdir -p $DHCLIENT_DIR
-        
-        # combine systemimager code to the stock debian dhclient-script
-        # and make executable
-        cat /etc/dhclient-script.si-prefix \
-            /etc/dhclient-script.debian-dist \
-            > /etc/dhclient-script
-        chmod +x /etc/dhclient-script
-
-        # be sure AF_PACKET is supported in the kernel
-        [ -f /lib/modules/`uname -r`/modules.dep ] && modprobe af_packet &> /dev/null
-        
-        # get info via dhcp
-        logmsg
-        logmsg "dhclient"
-        dhclient $DEVICE
-        if [ ! -s ${DHCLIENT_DIR}/dhclient.leases ]; then
-            logmsg
-            logmsg "I couldn't configure the network interface using DHCP."
-            logmsg
-            shellout
-        fi
-        
-        if [ -z ${DEVICE} ]; then
-            # Figure out which interface actually got configured.
-            # Suggested by James Oakley.
-            #
-            DEVICE=`grep interface ${DHCLIENT_DIR}/dhclient.leases | \
-                sed -e 's/^.*interface "//' -e 's/";//'`
-        fi
-        
-        # read dhcp info in as variables -- this file will be created by 
-        # the /etc/dhclient-start script that is run automatically by
-        # dhclient.
-        . /tmp/dhcp_info.${DEVICE} || shellout
-        ### END dhcp ###
-        
-        # Re-read configuration information from local.cfg to over-ride
-        # DHCP settings, if necessary. -BEF-
-        if [ -f /tmp/local.cfg ]; then
-            logmsg
-            logmsg "Overriding any DHCP settings with pre-boot local.cfg settings."
-            . /tmp/local.cfg || shellout
-        fi
-
-        logmsg
-        logmsg "Overriding any DHCP settings with pre-boot settings from kernel append"
-        logmsg "parameters."
-        read_kernel_append_parameters
-    fi
+
+read_dhcp_info() {
+	HOSTNAME=`grep host-name /dev/.dhclient-eth0.leases | sed 's/^.*option host-name "\(.*\)";.*$/\1/'`
+	DOMAINNAME=`grep " domain-name " /dev/.dhclient-eth0.leases | sed 's/^.*option domain-name "\(.*\)";.*$/\1/'`
+	DEVICE=`grep interface /dev/.dhclient-eth0.leases | sed 's/^.*interface "\(.*\)";.*$/\1/'`
+	IPADDR=`grep fixed-address /dev/.dhclient-eth0.leases | sed 's/^.*fixed-address \(.*\);.*$/\1/'`
 }
 #
 ################################################################################
@@ -1103,73 +819,6 @@
 
 }
 #
-################################################################################
-#
-start_syslogd() {
-    logmsg
-    logmsg start_syslogd
-    if [ ! -z $LOG_SERVER ]; then
-        logmsg "Starting syslogd..."
-        [ -z $LOG_SERVER_PORT ] && LOG_SERVER_PORT="514"
-        syslogd -R ${LOG_SERVER}:${LOG_SERVER_PORT}
-        # as long as we are starting syslogd, start klogd as well, in case
-        # there is a kernel issue that happens
-        klogd
-        # set USELOGGER=1 so logmsg knows to do the right thing
-        USELOGGER=1
-        logmsg "Successfully started syslogd!"
-    fi
-}
-#
-################################################################################
-#
-# Detect what we can.
-# Note: Modules that are needed during the initial boot stages of BOEL should
-#       be copied to the "skel/my_modules" directory prior to creating your
-#       custom initrd.gz. -BEF-
-#
-autodetect_hardware_and_load_modules() {
-    logmsg
-    logmsg autodetect_hardware_and_load_modules
-    if [ -e /proc/sys/kernel/hotplug ] && uname -r | grep -q boel; then
-        logmsg "Detecting hardware using hotplug (this may take a long time): "
-        /etc/init.d/hotplug stop
-        /etc/init.d/hotplug start
-    elif [ -d /sys/bus -a -e /lib/modules/`uname -r`/modules.pcimap ]; then
-        logmsg "Hardware already detected by hotplug"
-    else
-        logmsg "Detecting hardware using discover: "
-        MODULES=`discover --module bridge ethernet ide scsi usb`
-    fi
-
-    # Prepend with other modules that we will probably need.
-    MODULES=`echo sd_mod ide-disk $MODULES | sort -u`
-
-    logmsg $MODULES
-
-    for MODULE in $MODULES
-    do
-        logmsg
-        logmsg "Loading $MODULE... "
-	if echo $MODULE | grep '[-_]' >/dev/null 2>&1; then
-            if modprobe `echo $MODULE | sed 's/-/_/g'` 2>/dev/null; then
-                logmsg "done!"
-            elif modprobe `echo $MODULE | sed 's/_/-/g'` 2>/dev/null; then
-                logmsg "done!"
-            else
-                logmsg "not needed or already loaded."
-            fi
-        else
-            modprobe $MODULE 2>/dev/null && logmsg "done!" || logmsg "not needed or already loaded."
-        fi
-    done
-
-    # Show loaded modules
-    logmsg ">> Loaded kernel modules:"
-    for m in `cut -d' ' -f1 /proc/modules`; do
-        logmsg "$m"
-    done
-}
 #
 ################################################################################
 #
@@ -1494,29 +1143,8 @@
 
     # must be owned by root
     chown -R 0.0 /root/
-        
-    # create a private host key for this autoinstall client
-    logmsg
-    logmsg "Using ssh-keygen to create this hosts private key"
-    logmsg
-    mkdir -p /var/empty || shellout
-    if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
-        ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key || shellout
-    fi
-    if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
-        ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key || shellout
-    fi
-
-    # try to mount devpts (sometimes it's not really necessary)
-    mkdir -p /dev/pts
-    mount -t devpts none /dev/pts >/dev/null 2>&1
-
-    # fire up sshd
-    mkdir -p /var/run/sshd || shellout
-    chmod 0755 /var/run/sshd || shellout
-    /usr/sbin/sshd || shellout
-    logmsg "sshd started"
-    touch /tmp/sshd_started
+
+    /etc/init.d/sshd start
 }
 #
 ################################################################################
@@ -1758,7 +1386,7 @@
             logmsg "error: cannot find a valid torrent file for image ${IMAGENAME}"
             shellout
         fi
-        IMAGESIZE=`/bin/torrentinfo-console $torrent_file | sed -ne "s/file size\.*: \([0-9]*\) .*$/\1/p"`
+        IMAGESIZE=`torrentinfo-console $torrent_file | sed -ne "s/file size\.*: \([0-9]*\) .*$/\1/p"`
     fi
     IMAGESIZE=`expr $IMAGESIZE / 1024`
     logmsg "  --> Image size = `expr $IMAGESIZE / 1024`MiB"

=== modified file 'initrd_source/skel/etc/init.d/rcS'
--- initrd_source/skel/etc/init.d/rcS	2009-08-11 09:00:44 +0000
+++ initrd_source/skel/etc/init.d/rcS	2009-08-11 09:10:41 +0000
@@ -18,7 +18,7 @@
 #################################################################################
 #   Load functions and other variables
 #
-. /etc/init.d/functions
+. /etc/init.d/functions.systemimager
 #
 ################################################################################
 
@@ -28,28 +28,12 @@
 #
 {
 
-switch_root_to_tmpfs
-
-mount_proc
-
 monitor_save_dmesg
 
-mount_sys
-
 get_arch
 
 adjust_arch
 
-ifconfig_loopback
-
-load_my_modules
-
-start_udevd
-
-start_hotplug
-
-mount_pts
-
 # Need to do this prior to read_local_cfg to get last_root parameter, 
 # if specified. -BEF-
 variableize_kernel_append_parameters
@@ -62,7 +46,6 @@
 # the local.cfg files. -BEF-
 read_kernel_append_parameters
 
-start_network
 beep
 
 ping_test
@@ -71,7 +54,9 @@
     init_monitor_server
 fi
 
-start_syslogd
+# FIXME: we should run an init script before rsyslog one to change the server
+# and port.
+#start_syslogd
 
 if [ ! -z $FLAMETHROWER_DIRECTORY_PORTBASE ]; then
     get_flamethrower_directory
@@ -79,7 +64,6 @@
 
 get_torrents_directory
 
-get_boel_binaries_tarball
 beep
 
 tmpfs_watcher
@@ -101,8 +85,6 @@
 
 get_scripts_directory
 
-autodetect_hardware_and_load_modules
-
 # HOSTNAME may already be set via local.cfg -BEF-
 if [ -z $HOSTNAME ]; then
     get_hostname_by_hosts_file

=== modified file 'lib/SystemImager/Server.pm'
--- lib/SystemImager/Server.pm	2009-08-11 09:00:44 +0000
+++ lib/SystemImager/Server.pm	2009-05-19 11:09:58 +0000
@@ -414,7 +414,7 @@
         print $out "$cmd\n\n";
 
         print $out "# Get the size of the destination disk so that we can make the partitions fit properly.\n";
-        print $out qq(DISK_SIZE=`parted -s $devfs_dev unit MB print ) . q(| grep 'Disk geometry for' | sed 's/^.*-//g' | sed 's/\..*$//' | sed 's/MB//' `) . qq(\n);
+        print $out qq(DISK_SIZE=`parted -m -s $devfs_dev unit MB print ) . qq(| grep "$devfs_dev" | cut -d ':' -f 2 | sed 's/MB//' `) . qq(\n);
         print $out q([ -z $DISK_SIZE ] && shellout) . qq(\n);
 
         print $out q(if [ "$ARCH" = "alpha" ]; then) . qq(\n);	





I've tested it mainly with Fedora, but I also did some tests with Ubuntu. So
I'll explain first how to do it with Fedora and then the steps that are
different for Ubuntu.

1. Set up LTSP following these instructions:

https://fedorahosted.org/k12linux/wiki/InstallGuide

All the following steps must be done on the LTSP chroot.

2. Copy patched functions and rcS files from initrd_source/skel/etc/init.d
into LTSP chroot as /etc/init.d/functions.systemimager and
/etc/init.d/systemimager respectively.

3. Add a symolic link from /etc/rc5.d/S98systemimager to
/etc/init.d/systemimager.

4. Create /scripts, /torrents and /a directories.

5. Put a systemimager.rwtab file with the following content into /etc/rwtab.d:

        dirs "/scripts"
        dirs "/torrents"

6. Install rsync, bc, parted and bittorrent packages.

7. Copy pci-automod script into /bin.

8. Add SCREEN_0X=shell to /etc/lts.conf.


-- Ubuntu --

1. https://help.ubuntu.com/community/UbuntuLTSP

5. Add "/scripts" and "/torrents" to rw_dirs variable in
/etc/defaults/ltsp-client-setup.

6. Install rsync, dnsutils, bittornado, parted packages.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
sisuite-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisuite-users

Reply via email to