Menu

[r993]: / trunk / etc / rc  Maximize  Restore  History

Download this file

87 lines (66 with data), 2.2 kB

#!/bin/sh
#
# /etc/rc 
#part of FreeNAS (http://www.freenas.org)
#Copyright (C) 2005-2006 Olivier Cochard <cochard@gmail.com>.
#All rights reserved.
#
#Based on m0n0wall (http://m0n0.ch/wall)
#Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
#All rights reserved.
	

stty status '^T'

# Set shell to ignore SIGINT (2), but not children;
# shell catches SIGQUIT (3) and returns to single user.
#
trap : 2
trap "echo 'Boot interrupted'; exit 1" 3

HOME=/
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin

export HOME PATH

# Set our operating platform
PLATFORM=`cat /etc/platform`

#If running from liveCD or embedded, mount the root (ramdisk) in Read-Write
if [ "$PLATFORM" = "i386-liveCD" ] || [ "$PLATFORM" = "i386-embedded" ]; then
    mount -u -o rw /dev/md0 /
fi
#If running from full, mount the root (/) in Read-Write
if [ "$PLATFORM" = "i386-full" ] ; then
    mount -u -o rw /
fi

set -T
trap "echo 'Reboot interrupted'; exit 1" 3

# make some directories in /var if doesn't exist
if [ ! -d "/var/run" ]; then
	mkdir /var/run /var/log /var/etc /var/etc/ssh /var/db /var/log/samba /var/mount /var/etc/private /var/empty /var/etc/iscsi
fi

# If the file /etc/cfdevice exist (this mean 'full' release), and symlink /var/etc/cfdevice doesn't exist.. create it.
if [ -f "/etc/cfdevice" ] && [ ! -h /var/etc/cfdevice ] ; then
	ln -s /etc/cfdevice /var/etc/cfdevice
fi

# Make spool dor (for afpd) if doesn't exist
if [ ! -d "/var/spool" ]; then
	mkdir /var/spool
	mkdir /var/spool/lock
fi

# generate circular logfiles
clog -i -s 262144 /var/log/system.log
clog -i -s 32768 /var/log/ftp.log
clog -i -s 32768 /var/log/rsyncd.log
clog -i -s 32768 /var/log/sshd.log
clog -i -s 32768 /var/log/lastlog
clog -i -s 32768 /var/log/smartd.log
clog -i -s 32768 /var/log/daemon.log
chmod 0600 /var/log/*.log

adjkerntz -i

# Create an initial utmp file
cd /var/run && cp /dev/null utmp && chmod 0644 utmp

# Create symlink for lighhtpd file upload if doesn't exist
if [ ! -h "/var/tmp" ]; then
	ln -s /ftmp /var/tmp
fi

# Run ldconfig
/sbin/ldconfig -elf /usr/lib /usr/local/lib /lib

# let the PHP-based configuration subsystem set up the system now
/etc/rc.bootup

/etc/rc.banner

exit 0

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.