#!/bin/sh # # Read-only disk bootup script by Ralph Siemsen. # # This script can be placed for example in /etc or /sbin # Then arrange for the kernel to execute this script instead of init. # # CAVEAT: you have to move all the writable things to /mnt/ram # before you can use this script. Create a /mnt/ram directory and # the move /etc/mtab, /dev/pts and /var/{lock,log,run,tmp} into # /mnt/ram. Then create symlinks at the original locations. # # After making this change you can boot using the normal init process # if you wish. You won't be able to log in as root, unless you edit # /etc/securetty and add /mnt/ram/dev/tty[0-6] to it. # # Set the path PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH # Print a banner. ;) echo "Booting in read-only mode..." # Prepare the ramdisk mke2fs -q /dev/ram mount /dev/ram /mnt/tmp mkdir /mnt/tmp/pts mkdir /mnt/tmp/lock mkdir /mnt/tmp/log mkdir /mnt/tmp/log/httpd mkdir /mnt/tmp/run mkdir /mnt/tmp/tmp umount /mnt/tmp # Bring ramdisk to life mount -n /dev/ram /mnt/ram # Mount /proc mount -n -t proc /proc /proc cat /proc/mounts >/mnt/ram/mtab # Make /dev/pts work (relies on proper fstab entry) mount /dev/pts # Set the system clock. /sbin/hwclock -ur # Mount other filesystem mount -o ro /dev/hda3 /usr # Set the hostname. . /etc/sysconfig/network hostname ${HOSTNAME} domainname ${DOMAINNAME} # Bring up network (uncomment eth1 if you want it) ifconfig lo up . /etc/sysconfig/network-scripts/ifcfg-eth0 ifconfig $DEVICE $IPADDR netmask $NETMASK broadcast $BROADCAST up #. /etc/sysconfig/network-scripts/ifcfg-eth1 #ifconfig $DEVICE $IPADDR netmask $NETMASK broadcast $BROADCAST up # Load mixer settings (turn off internal speaker) mixer -private=17 mixer -master=95 mixer -dsp=95 # Start daemons that we want sshd httpd gpsd >/dev/null 2>/dev/null /dev/audio #cat /etc/welcome-2.au >/dev/audio # Run user shell while true ; do bash -i ; done