NSLU2-Linux
view · edit · print · history
 
# cat /unslung/rc.sysinit
#!/bin/sh

# The raid devices are /dev/md1 /dev/md2 /dev/md3 /dev/md4
# They have already been created in 'linuxrc'

# Create and use swap partition 
/sbin/mkswap /dev/md3
/bin/sleep 2
/sbin/swapon /dev/md3

# Mount data and conf partitions
/bin/mount -t ext3 /dev/md2 /share/hdd/conf -o rw,noatime
/bin/mount -t ext3 /dev/md1 /share/hdd/data -o rw,noatime
# Mount the 4th partition
/bin/mount -t ext3 /dev/md4 /share/hdd/data/public -o rw,noatime
/bin/mount /share/hdd/data/public /public -o bind

# Continue with the rest of the /etc/rc.d/rc.sysinit script
return 1

 
# cat /unslung/rc.1
#!/bin/sh

#/sbin/ifconfig ixp0 hw ether 00:C0:02:01:01:04
#/bin/echo  "Starting Set CGI_ds.conf:"; /etc/rc.d/rc.bootbin; check_status

# Next section only required to allow Maxtor drives to spin down:
# Script section to create ramdisk for /var
# Some find that they have to repeat the process with /dev
/bin/echo "Creating ramfs for /var:"
/bin/mount -t ramfs ramfs /mnt/tmpmnt -o maxsize=256
/bin/cp -rp /var/* /mnt/tmpmnt/
/bin/mkdir -p /var.state
/bin/mount -o bind /var /var.state
/bin/mount -o bind /mnt/tmpmnt /var
/bin/umount /mnt/tmpmnt

# We have commented out the 'bootbin' line above so we must provide replacements
# The rc.sysinit diversion has already mounted the RAID arrays
# This next line brings the ethernet interface up
/sbin/ifup

# These three lines are optional
cp /opt/etc/passwd /etc/passwd
cp /opt/etc/passwd /share/hdd/conf/passwd
[ -L /root ] || ln -sf /opt/user/root /root

/bin/echo  "Restore time and timezone:"; /etc/rc.d/rc.rstimezone; check_status
#/bin/echo  "Restore usrgrpshares:"; /etc/rc.d/rc.reset_usrgrpshare; check_status
#/bin/echo  "Generating telnet password:"; /usr/sbin/TelnetPassword; check_status
#/bin/echo  "Restore time and timezone:"; /etc/rc.d/rc.rstimezone; check_status
/bin/echo  "Starting WEB Server:"; . /etc/rc.d/rc.thttpd;check_status
/bin/echo  "Starting samba:"; . /etc/rc.d/rc.samba
#/bin/echo  "Starting download:"; /usr/sbin/download
#/bin/echo  "Starting INET Server:"; . /etc/rc.d/rc.xinetd; check_status
#/bin/echo  "Starting QuickSet Daemon :"; . /etc/rc.d/rc.quickset
/bin/echo  "Starting Crond :"; . /etc/rc.d/rc.crond
/bin/echo  "Starting Rest Task :"; . /etc/rc.d/rc.local

/bin/echo  "Starting UNSLUNG Packages:"; ( . /etc/rc.d/rc.unslung-start )

/usr/bin/Set_Led ready
/usr/bin/Set_Led beep1
#/bin/echo  "Checking disk status :"; /usr/sbin/CheckDiskFull 2 >/dev/null

# Do not continue with the /etc/rc.d/rc.1 script
return 0
 
# cat /unslung/rc.reboot
#!/bin/sh

cd /
/bin/cp /etc/passwd /opt/etc/passwd

/bin/echo "Stopping Unslung packages"; ( . /etc/rc.d/rc.unslung-stop )

/bin/killall -2 upnpd         2>/dev/null
/bin/sleep 4

# Switch off ethernet interface
/sbin/ifdown ixp0

# Stop Samba
/bin/killall nmbd             2>/dev/null
/bin/killall smbd             2>/dev/null

# Stop webserver
/bin/killall -SIGUSR2 thttpd  2>/dev/null
/bin/sleep 2

# Unmount all drives
/bin/umount /share/flash/conf 2>/dev/null
/bin/umount /share/flash/data 2>/dev/null
/bin/umount /share/hdd/conf   2>/dev/null
/bin/umount /share/hdd/data/public 2>/dev/null
/bin/umount /public           2>/dev/null
/bin/umount /share/hdd/data   2>/dev/null

/sbin/swapoff /dev/sda3       2>/dev/null
/sbin/swapoff /dev/sdb3       2>/dev/null
/sbin/swapoff /dev/md3        2>/dev/null

# Stop RAID arrays
# we will not be able to stop the boot drive
/opt/sbin/mdadm -Ss --config=/opt/etc/mdadm.conf
/bin/sleep 2

# doing reverse of '/etc/rc' script
/bin/mount -o remount,ro /dev/root /
/bin/umount /proc/bus/usb
/bin/umount /proc

# REboot!
/sbin/reboot


 
# cat /unslung/rc.halt
#!/bin/sh

chdir /
/bin/cp /etc/passwd /opt/etc/passwd

/bin/echo "Stopping Unslung packages"; ( . /etc/rc.d/rc.unslung-stop )
/bin/killall sshd             2>/dev/null
/opt/etc/init.d/S80thttpd stop

/bin/killall -2 upnpd         2>/dev/null

# Stop cron job daemon
/bin/killall crond            2>/dev/null

# Switch off ethernet interface
/sbin/ifdown ixp0

# Stop Samba
/bin/killall nmbd             2>/dev/null
/bin/killall smbd             2>/dev/null

# turn off quotas
/usr/bin/quotaoff -a  

# Stop webserver
/bin/killall -SIGUSR2 thttpd  2>/dev/null
/bin/sleep 2

# Unmount all drives
/bin/umount /var.state        2>/dev/null
/bin/umount /var              2>/dev/null
/bin/umount /share/flash/conf 2>/dev/null
/bin/umount /share/hdd/data/public 2>/dev/null
/bin/umount /public           2>/dev/null
/bin/umount /share/flash/data 2>/dev/null
/bin/umount /share/hdd/conf   2>/dev/null
/bin/umount /share/hdd/data   2>/dev/null

/sbin/swapoff /dev/sda3       2>/dev/null
/sbin/swapoff /dev/sdb3       2>/dev/null
/sbin/swapoff /dev/md3        2>/dev/null

# Stop RAID arrays
# We will not be able to stop the root drive
# But thats OK because we resync it at startup
/opt/sbin/mdadm -Ss --config=/opt/etc/mdadm.conf
/bin/sleep 3

# doing reverse of '/etc/rc' script
/bin/mount -o remount,ro /dev/root /
/bin/umount /proc/bus/usb
/bin/umount /proc

/sbin/halt-test &>/dev/null
/bin/sleep 2
/sbin/halt-test &>/dev/null


view · edit · print · history · Last edited by Bullfrog.
Originally by nsc.
Page last modified on July 07, 2006, at 10:09 PM