#!/bin/sh
#(c) copyright Barry Kauler 2003,2004,2005, www.puppylinux.com
#NOTE: edit rc.local0 for your custom setup (see README.txt)
#v1.0.2
#previous versions had rc.sysinit, rc.sysinit-hd (h.d.), rc.sysinit-cd (multi-session CD),
#also rc.reboot, rc.reboot-hd and rc.reboot-cd. and the build had to choose which one
#and rename to rc.sysinit/rc.reboot, discard the others.
#now want to keep them all, put code here to jump to the one we need.
#booting a h.d. option2 installation is what we call "SCENARIO 2".
#branch code is bit further down...
#v1.0.4
#can now enter with PFILE=ask, but only relevant for SCENARIO1 and not multisession,
#so testing for this occurs below the branch (off to other rc.sysinit variants).
PATH=/bin:/sbin
COMPRFS="squashfs" #0.9.8 changed from cramfs to squashfs.
DEBUGFUNC()
{
xxcc="$1"
while [ "$xxcc" ];do
echo -n "DEBUG: ENTER or type a command: "
read xxcc
eval $xxcc
done
}
check_status()
{
/bin/echo -en "\\033[65G"
if [ $1 -eq 0 ]
then
/bin/echo -en "\\033[1;32mdone"
/bin/echo -e "\\033[0;39m"
else
/bin/echo -en "\\033[1;31mfailed"
/bin/echo -e "\\033[0;39m"
echo "Pausing for 60 seconds..."
sleep 60
fi
}
echo "Now executing /etc/rc.d/rc.sysinit..."
echo -n "Mounting /proc: ";mount /proc;check_status $?
echo -n "Remounting root rw: ";mount -o remount,rw /;check_status $?
echo -n "Mounting devpts: ";mount /dev/pts;check_status $?
mount > /etc/mtab
if [ -d /root0 ];then #v1.0.2
#SCENARIO 1
#0.9.3 updated by /sbin/init...
SIZERAMDISKK=`cat /root0/.etc/ramdisksize` #compiled into kernel, or by ramdisk_size boot param.
#...0.9.8 note, Puppy now running in tmpfs, so this value no longer matters.
SIZEFILLK=`cat /root0/.etc/ramdiskfssize` #max allowed size of f.s. (physical ram + swap)
#0.9.8 max allowed size of f.s., if use physical ram only...
SIZEPHYSICALFILLK=`cat /root0/.etc/ramdiskphysicalfssize`
#0.9.3 now have /sbin/init script, which changed / from /dev/ram0 to /dev/ram3,
#the old ram0 is still here...
#note, still supporting running in ram0, but old_root won't exist.
if [ ! "`cat /proc/mounts | grep "old_root"`" = "" ];then #no need to use df.
#echo 0x103 > /proc/sys/kernel/real-root-dev #this was set to ram0
echo -n "Unmounting /dev/ram0...";umount /old_root;check_status $?
echo -n "Freeing /dev/ram0 memory...";freeramdisk /dev/ram0;check_status $?
rmdir /old_root
echo "Puppy is now running in tmpfs ramdisk, mounted on /"
#0.9.8R2 need to turn on swap partition, if /sbin/init found one...
if [ -e /root0/.etc/swappartition1 ];then
SWAPPART="`cat /root0/.etc/swappartition1`"
if [ "`echo -n "$SWAPPART" | grep "/mnt/swap"`" = "" ];then
swapon $SWAPPART;check_status $?
else #v1.0.6 only for multisession (see /sbin/init)...
SPARTTYPE="`echo -n "$SWAPPART" | cut -f 2 -d ','`"
SWAPFILE="`echo -n "$SWAPPART" | cut -f 1 -d ','`"
mount -t $SPARTTYPE /dev/hda1 /mnt/swap
if [ $? -eq 0 ];then
swapon $SWAPFILE;check_status $?
fi
fi
fi
fi
fi
#load modules
. /etc/rc.d/rc.modules
#...note, also loads usb-storage and sleeps if PSLEEP defined.
cat /proc/pci | grep -i "usb" > /dev/null #old PCs may not have usb.
if [ $? -eq 0 ];then
#need to mount this, but not here if it is in /etc/fstab...
echo -n "Mounting usbfs:"
mount -t usbfs none /proc/bus/usb;check_status $?
#...RH doesn't have this one in fstab, so I won't.
#Here is what could be put into fstab:
# none /proc/bus/usb usbfs defaults 0 0
fi
#v1.0.7 busybox 1.01 syslogd does not have -L option...
#echo -n "Starting syslogd: ";syslogd -m 0 -L;check_status $?
echo -n "Starting syslogd: ";syslogd -m 0;check_status $?
echo -n "Starting klogd: ";klogd;check_status $?
#v1.0.2 this is where can branch off to rc.sysinit-cd or rc.sysinit-hd...
if [ ! -d /root0 ];then
#SCENARIO 2 hard drive option-2 installation.
cp -f /etc/rc.d/rc.reboot-hd /tmp/rc.reboot
sync
exec /etc/rc.d/rc.sysinit-hd
else
# SCENARIO 1
if [ ! $PSLEEP ];then #PSLEEP defined if booting from usb.
# the tricky part here is need to find out if CD is multisession
##note cdrecord will cause load of cdrom, sr_mod, ide_cd...
#TALLYCD="`cdrecord -scanbus -dev=ATAPI 2> /dev/null | grep "[0-9],[0-9],[0-9]" | grep -v '*' | cut -f 2`"
#no, need to find cd drives in /dev/hd format...
modprobe ide-cd
#PROBLEM v1.0.2RC k2.6... this gives an error msg... sr_mod is for real scsi cdroms...
#modprobe sr_mod
#note, probedisk won't work if sr_mod not loaded.
#TALLYCD="`probedisk 2>/dev/null | grep "/dev/" | grep -i "cd" | grep -i "rom" | cut -f 1 -d "|" | tr "\n" " "`"
#stupid 2.6 kernel... leave sr_mod out for now, try this way...
TALLYCD="`dmesg | grep -i "cd" | grep -i "atapi" | cut -b 1-4 | grep "hd[a-z]:" | cut -f 1 -d ':' | sort -u | tr "\n" " "`"
#note, this technique using dmesg need to have /dev/ appended below...
#EXPERIMENT, REMOVE...
#for ONECD in $TALLYCD
#do
# ONECD="/dev/$ONECD" #see dmesg note above
# #is there a cd inserted in tray?... this way can detect it...
# if [ ! "`disktype $ONECD 2>/dev/null | grep "ISO9660"`" = "" ];then
# #but i think this is faster, well they're both fast...
# #if [ "`fdisk -s $ONECD 2>&1 | grep "Unable to open"`" = "" ];then
# #is it multisession...
# CDOUTP="`cdrecord -msinfo dev=$ONECD 2>/tmp/cdrerr.txt`"
# if [ ! "`echo "$CDOUTP" | grep ","`" = "" ];then #looking for number1,number2
# if [ "`cat /tmp/cdrerr.txt 2> /dev/null | grep "Cannot read first writable"`" = "" ];then
# #it seems to be multisession...
# #well this would be the one we are booting off hence is the burner.
# echo -n "$ONECD" | cut -f 3 -d '/' > /etc/cdburnerdevice #in /root0/.etc
# cp -f /etc/rc.d/rc.reboot-cd /tmp/rc.reboot
# sync
# exec /etc/rc.d/rc.sysinit-cd
# fi
# fi
# fi
#done
for ONECD in $TALLYCD
do
ONECD="/dev/$ONECD" #see dmesg note above
GETDISKINFO="`disktype $ONECD 2>&1`"
CDHASFS="`echo -n "$GETDISKINFO" | grep "ISO9660"`" #v1.0.3
if [ "$CDHASFS" = "" ];then #v1.0.3 want to ignore music cd in another drive.
GETDISKINFO=""
else
if [ "$PFILE" = "cd" ];then #v1.0.3 1st-boot-multisession boot-menu option.
echo "Booting multisession CD in $ONECD"
GETDISKINFO="Track 2:" #so that next if will be true.
fi
fi
#having trouble testing for multisession cd here, but can test if more than one track...
if [ ! "`echo "$GETDISKINFO" | grep "Track 2:"`" = "" ];then
#well this would be the one we are booting off hence is the burner.
echo -n "$ONECD" | cut -f 3 -d '/' > /etc/cdburnerdevice #in /root0/.etc
cp -f /etc/rc.d/rc.reboot-cd /tmp/rc.reboot
sync
exec /etc/rc.d/rc.sysinit-cd
fi
done
fi
fi
#normal rc.sysinit starts here...
# when shutdown, want rc.reboot to be out of /root so home device can be unmounted...
cp /root0/.etc/rc.d/rc.reboot /tmp/rc.reboot
# ...inittab uses /tmp/rc.reboot to shutdown.
#v1.0.4
#boot option causes PFILE=ask...
if [ "$PFILE" = "ask" ];then
echo -e "\\033[1;31m" #34=blue, 33=yellow, 32=green, 31=red, 35=purple, 36=aquablue, 38=black.
echo -e "You chose \"Choose HD\" option at the boot menu."
echo "This now allows you to choose the location and name of the pupxxx file, or"
echo "not to use a hard drive at all for personal data (run totally in ramdisk)."
echo "Here are suitable partitions:"
SUITPARTS="`probepart -k | grep "/dev/" | grep --extended-regexp -i "ext2|ext3|msdos|vfat|reiserfs"`"
echo "$SUITPARTS"
echo "Please type in which partition has the pupxxx file"
echo "(note: if pupxxx does not exist, it will be created),"
echo "(or press ENTER only to run totally in ramdisk, no pupxxx)"
echo -en "for example \"hda1\" (but do not type the quotes): "
echo -en "\\033[0;39m"
read PHOME
if [ "$PHOME" ];then
if [ "`echo "$SUITPARTS" | grep "/dev/" | grep "$PHOME"`" = "" ];then
echo "ERROR: Incorrect entry, partition does not exist."
PHOME=""
PFILE="no" #special case handled below.
export PFILE
else
echo "Okay, you chose $PHOME."
echo -e "\\033[1;31m" #34=blue, 33=yellow, 32=green, 31=red, 35=purple, 36=aquablue, 38=black.
echo "Now type the name of the pupxxx file (as a precaution"
echo -e "always use a name starting with the 3 letters \"pup\")"
echo "(pressing ENTER only, default name will be pup001)"
echo -en "for example \"pup002\" (but do not type the quotes): "
echo -en "\\033[0;39m"
read TRYPFILE
if [ ! "$TRYPFILE" ];then
TRYPFILE="pup001"
fi
if [ ! "`echo -n "$TRYPFILE" | cut -b 1-3`" = "pup" ];then
echo -e "ERROR: Name does not start with letters \"pup\""
echo "Renaming to pup001"
TRYPFILE="pup001"
fi
PFILE="${TRYPFILE}-none-262144"
echo "Okay, you chose $TRYPFILE."
export PHOME PFILE
fi
else
PFILE="no" #special case handled below.
export PFILE
fi
fi
if [ ! $PSLEEP ];then #PSLEEP is a boot parameter.
PSLEEP=0
fi
#allow a boot parameter to specify f.s. type on /root...
if [ ! $PROOTFS ];then
if [ $PFILE ];then #v0.7.6 see below
PROOTFS="ext2"
else
PROOTFS="umsdos"
fi
export PROOTFS
fi
HOMEPARTITION="nothing"
#for booting from ide/atapi zip drive, recognises PHOME=zip
if [ "$PHOME" = "zip" ];then
echo -n "Loading ide-floppy module:"
modprobe ide-floppy;check_status $? #needed for ide/atapi zip drive.
#need to search for a zip drive
#(note: have relocated head from /usr/bin to /bin)
ZIPDRIVE="`probedisk | grep -i "zip" | head -n 1 - | cut -f 1 -d '|'`"
ZIPDRIVX="`echo -n $ZIPDRIVE | cut -f 3 -d '/'`"
PHOM4="`
echo -n $ZIPDRIVX
echo "4"
`"
PHOM1="`
echo -n $ZIPDRIVX
echo "1"
`"
if [ ! "$ZIPDRIVE" = "" ];then
PROBEPHOME="`disktype /dev/$PHOM4 2>&1`"
echo "$PROBEPHOME" | grep "No such device"
if [ $? -eq 0 ];then
#failed to find the partition...
PROBEPHOME="`disktype /dev/$PHOM1 2>&1`"
echo "$PROBEPHOME" | grep "No such device"
if [ $? -eq 0 ];then
#failed to find the partition...
PHOME=
else
PHOME="$PHOM1"
HOMEPARTITION="$PHOME"
fi
else
PHOME="$PHOM4"
HOMEPARTITION="$PHOME"
fi
else
#fail...
PHOME=
fi
fi
echo "Puppy wants to mount the users home device..."
#echo "PHOME = $PHOME"
#echo "PFILE = $PFILE"
#read zzxx
#v0.7.6 instead of mounting a partition on /root, can now have
#a file...
if [ $PFILE ];then #ID076
if [ "$PFILE" = "no" ];then #ID103E v1.0.3
#isolinux live-cd boot option, do not use h.d.
PHOME=""
HOMEPARTITION="nothing"
else
modprobe -v ide-cd #rc.local0 loads these, so doing it temporarily here.(also loads cdrom)
modprobe -v sr_mod # ditto. (also loads ide-scsi)
#...probedisk, probepart work without these, but complain about missing /proc/scsi.
modprobe -v ntfs #gets removed below if no ntfs partition.
modprobe -v reiserfs #gets removed below if no reiserfs partition.
mount > /etc/mtab #as busybox doesn't have proper mtab (mkfs needs it).
echo "Attempting to mount a file on /root..."
#this runs Antonio Gallo's app that discovers the drive partitions...
#v1.0.0 mods to error handling...
echo "Wait, probing drives..."
ALLPARTITIONS="`probepart -k 2> /tmp/probefail.txt | grep "/dev/"`"
echo "$ALLPARTITIONS" > /tmp/fsparts.txt #for compatibility with existing code.
#i'm going to ignore errors....
#probepart 2> /tmp/probefail.txt
#if [ -s /tmp/probefail.txt ];then #test if file is not zero size. ID2303
# #error...
# echo "Antonios partition probing failed"
# echo "Here is the error message:"
# cat /tmp/probefail.txt
# echo " "
# echo "note, Antonios probepart program returns an error if a usb"
# echo "card reader is plugged in but no flash card inserted."
# echo "(Antonio needs to fix this!)"
# echo " "
# echo "Pausing for 20 seconds...";sleep 20
#else #ID2303
# probepart > /tmp/fsparts.txt
if [ ! "$ALLPARTITIONS" = "" ];then #ID2303
#PFILE has the format name-password-size
NAMEPFILE="`echo -n $PFILE | cut -f 1 -d "-"`"
PASSPFILE="`echo -n $PFILE | cut -f 2 -d "-"`"
SIZEPFILE=`echo -n $PFILE | cut -f 3 -d "-"` #has to be numerical, calcs further down.
#if [ ! "$PASSPFILE" = "none" ];then
# PFILE="${NAMEPFILE}-hidden-${SIZEPFILE}" #empty this for security.
#fi
if [ "$PASSPFILE" = "ask" ];then
echo -e "\\033[1;31m"
echo -n "File $NAMEPFILE is encrypted. Enter password: "
echo -en "\\033[0;39m"
read PASSPFILE
echo
fi
echo "Filename is $NAMEPFILE requested size is $SIZEPFILE"
#if PROOTFS not defined, default is ext2, see above.
#if don't specify PHOME, will have to search for a suitable partition...
#even if do have PHOME, need to find its f.s. and where to mount it...
VFATPAR0="`cat /tmp/fsparts.txt | grep "vfat" | grep "/" | head -n 1 - | cut -f 1 -d '|'`"
VFATPAR1="`cat /tmp/fsparts.txt | grep "vfat" | grep "/" | tail -n 1 - | cut -f 1 -d '|'`"
#...if there is a Win32 vfat partition, say /dev/hda1, it is now in VFATPAR0.
#cut off the /dev/...
VFATPART="`echo -n "$VFATPAR0" | cut -f 3 -d "/"`"
VFATPAR2nd="`echo -n "$VFATPAR1" | cut -f 3 -d "/"`"
if [ "$VFATPART" = "$VFATPAR2nd" ];then
VFATPAR2nd=""
fi
VFATDEV0="$VFATPART"
VFATDEV1="$VFATPAR2nd"
if [ ! "$VFATPAR2nd" = "" ];then
#if two partitions, find biggest...
PARTFREE=`cat /tmp/fsparts.txt | grep "/dev/$VFATPART|" | cut -f 3 -d '|'`
PARTFRE2nd=`cat /tmp/fsparts.txt | grep "/dev/$VFATPAR2nd|" | cut -f 3 -d '|'`
#...well this is really find the total size of partitions, not free space.
if [ $PARTFRE2nd -gt $PARTFREE ];then
VFATPART="$VFATPAR2nd"
fi
fi
#do same for Linux...
EXT2PAR0="`cat /tmp/fsparts.txt | grep --extended-regexp "ext2|ext3" | grep "/" | head -n 1 - | cut -f 1 -d '|'`"
EXT2PAR1="`cat /tmp/fsparts.txt | grep --extended-regexp "ext2|ext3" | grep "/" | tail -n 1 - | cut -f 1 -d '|'`"
#cut off the /dev/...
EXT2PART="`echo -n "$EXT2PAR0" | cut -f 3 -d "/"`"
EXT2PAR2nd="`echo -n "$EXT2PAR1" | cut -f 3 -d "/"`"
if [ "$EXT2PART" = "$EXT2PAR2nd" ];then
EXT2PAR2nd=""
fi
EXT2DEV0="$EXT2PART"
EXT2DEV1="$EXT2PAR2nd"
if [ ! "$EXT2PAR2nd" = "" ];then
#if two partitions, find biggest...
PARTFREE=`cat /tmp/fsparts.txt | grep "/dev/$EXT2PART|" | cut -f 3 -d '|'`
PARTFRE2nd=`cat /tmp/fsparts.txt | grep "/dev/$EXT2PAR2nd|" | cut -f 3 -d '|'`
#...well this is really find the total size of partitions, not free space.
if [ $PARTFRE2nd -gt $PARTFREE ];then
EXT2PART="$EXT2PAR2nd"
fi
fi
#there may be an msdos partition in the system...
DOSPART="`cat /tmp/fsparts.txt | grep "msdos" | grep "/" | head -n 1 - | cut -f 1 -d '|'`"
#maybe a reiserfs...
REISERPAR0="`cat /tmp/fsparts.txt | grep "reiser" | grep "/" | head -n 1 - | cut -f 1 -d '|'`"
#cut off the /dev/...
REISERPART="`echo -n $REISERPAR0 | cut -f 3 -d "/"`"
if [ "$REISERPART" = "" ];then
modprobe -r reiserfs #why keep it loaded.
fi
#Puppy 0.9.3 now support ntfs, sort of...
#but, ntfs driver is a module, must be loaded before run probepart.
#probepart is weird, returns "/dev/hdx|none|nnn|abdcdef NTFS", so use case-insensitive search...
NTFSPAR0="`cat /tmp/fsparts.txt | grep -i "ntfs" | grep "/" | head -n 1 - | cut -f 1 -d '|'`"
#cut off the /dev/...
NTFSPART="`echo -n $NTFSPAR0 | cut -f 3 -d "/"`"
if [ "$NTFSPART" = "" ];then
modprobe -r ntfs #why keep it loaded.
fi
if [ ! $PHOME ];then
if [ ! "$VFATPART" = "" ];then
PHOME="$VFATPART"
HOMEFS="vfat"
HOMEDIR="/mnt/home" #"/mnt/cdrive"
else
if [ ! "$EXT2PART" = "" ];then
PHOME="$EXT2PART"
#HOMEFS="ext2" no, can be ext2 or ext3...
HOMEFS=`cat /tmp/fsparts.txt | grep "/dev/$EXT2PART|" | cut -f 2 -d '|'`
HOMEDIR="/mnt/home" #"/mnt/data"
else
if [ ! "$REISERPART" = "" ];then
PHOME="$REISERPART"
HOMEFS="reiserfs"
HOMEDIR="/mnt/home"
else
#this is our last resort, introduce at 0.9.3...
if [ ! "$NTFSPART" = "" ];then
#ntfs write is dangerous, the pupxxx file must already exist...
mount -t ntfs -o rw /dev/$NTFSPART /mnt/home
if [ $? -eq 0 ];then #=0 success.
if [ -e /mnt/home/$NAMEPFILE ];then
echo
echo "WARNING WARNING: "
echo "An NTFS partition will be mounted on /mnt/home, but do NOT"
echo "create or modify files on it. Linux write support for NTFS is not"
echo "fully safe. File $NAMEPFILE is on the NTFS partition, but was created"
echo "from Windows, so is apparently safe to write to by loopback device,"
echo "as long as the file size is not changed."
echo
PHOME="$NTFSPART"
HOMEFS="ntfs"
HOMEDIR="/mnt/home"
else
echo -e "\\033[1;31m" #red text.
echo "NOTICE: "
echo "Puppy cannot find a suitable hard drive partition in which to create $NAMEPFILE,"
echo "used to hold your personal data and settings. However..."
echo "Your PC has NTFS partition /dev/$NTFSPART but $NAMEPFILE must be downloaded"
echo "to it beforehand, and placed in top directory. Linux NTFS write support is"
echo "dangerous but if $NAMEPFILE is placed while running Windows it should be ok."
echo "You can find a $NAMEPFILE.zip file at a Puppy download site. Download and"
echo "unzip it so that it is in location C:\\$NAMEPFILE, then boot the Puppy live-CD."
echo
echo -n "Anyway, you can continue to boot Puppy for now... just press ENTER key: "
echo -en "\\033[0;39m"
read zzxx
echo
PHOME=""
fi
else
PHOME=""
fi
umount /mnt/home #gets remounted below.
else
#failed to find anything...
PHOME=""
fi
#v0.9.6 add a final possibility for PHOME...
if [ "$PHOME" = "" ];then
echo -e "\\033[1;31m"
echo "Puppy cannot find a suitable partition for your personal data file."
echo -e "If you want to use a USB drive for this purpose, type \"sda1\" then"
echo "press ENTER key, else just press ENTER key to run Puppy totally in"
echo "ramdisk. In the latter case, no personal settings or data will be saved."
echo "The USB Flash or hard drive must have a MSDOS or VFAT partition."
echo "(this question will be asked everytime Puppy boots -- to make the USB drive"
echo -e " the default choice, you need to remaster isolinux.cfg with \"PHOME=sda1\")"
echo "(the USB partition is likely to be sda1, however if you know it is something"
echo " else such as sda2 or sdb1, then type that instead)"
echo
echo -en "Press ENTER key, or plugin USB drive then type \"sda1\" and ENTER: "
echo -en "\\033[0;39m"
read PHOME
if [ ! "$PHOME" = "" ];then
if [ $PSLEEP -eq 0 ];then
#non-0 value would have caused usb-storage driver to load in rc.modules.
echo
echo "usb-storage driver is now loading. There will be a pause of 25 seconds..."
echo "(if the USB device is to be made the permanent default home, as well as"
echo -e " setting \"PHOME=sda1\", also need to set \"PSLEEP=25\" in isolinux.cfg)"
modprobe usb-storage
sleep 25
fi
if [ ! "`probepart | grep "/dev/$PHOME"`" = "" ];then
HOMEFS="vfat"
HOMEDIR="/mnt/home"
else
echo "...sorry, cannot find /dev/$PHOME"
echo
echo -n "Press ENTER key to continue: "
read zzxx
PHOME=""
fi
fi
fi
fi
fi
fi
else
cat /tmp/fsparts.txt | grep "/dev/$PHOME|"
if [ $? -eq 0 ];then #=0 found.
HOMEFS=`cat /tmp/fsparts.txt | grep "/dev/$PHOME|" | cut -f 2 -d '|'`
HOMEDIR="/mnt/home"
#if it is msdos, should mount as vfat (to get long filenames)...
if [ "$HOMEFS" = "msdos" ];then
HOMEFS="vfat"
fi
else
#one thing that does fall thru to here is ide zip drive (ide-floppy.o loaded) as
#probepart doesn't show it (it is usually partition 4, example /dev/hdd4)...
#Puppy 0.9.3, need a last resort, use disktype...
HOMEDIR="/mnt/home"
PROBEPHOME="`disktype /dev/$PHOME 2>&1`"
echo "$PROBEPHOME" | grep "No such device"
if [ $? -eq 0 ];then
#failed to find the partition...
PHOME=""
HOMEDIR=""
HOMEFS=""
else
if [ "`echo "$PROBEHOME" | grep --extended-regexp "FAT12|FAT16|FAT32"`" ];then
HOMEFS="vfat"
else
if [ "`echo "$PROBEHOME" | grep --extended-regexp "Ext2"`" ];then
HOMEFS="ext2"
else
if [ "`echo "$PROBEHOME" | grep --extended-regexp "Ext3"`" ];then
HOMEFS="ext3"
else
#failed to find the partition...
PHOME=""
HOMEDIR=""
HOMEFS=""
fi
fi
fi
fi
fi
fi
if [ $PHOME ];then #ID428
PUPMNTPOINT="/root" #0.9.8
#now have PHOME... and HOMEFS... and HOMEDIR...
echo "The file is on $PHOME directory $HOMEDIR, fs type $HOMEFS"
mount -t $HOMEFS -o rw /dev/$PHOME $HOMEDIR
if [ $? -eq 0 ];then #=0 success. #ID432
#if file does not exist, will have to create it...
if [ ! -e $HOMEDIR/$NAMEPFILE ];then #ID434
#v0.8.3
#we should check to see that there is enough space on the partition...
PARTFREE=`df | grep "/dev/$PHOME" | tr -s " " | head -n 1 | cut -f 4 -d " "`
if [ ! $PARTFREE ];then
PARTFREE=0
fi
if [ $PARTFREE -gt 10240 ];then
PARTFREE=`expr $PARTFREE - 8192` #leave some slack space.
fi
if [ $SIZEPFILE -gt $PARTFREE ];then
SIZEPFILE=$PARTFREE
echo "File $NAMEPFILE has been resized to $PARTFREE Kbytes to fit partition."
fi
dd if=/dev/zero of=$HOMEDIR/$NAMEPFILE bs=1k count=$SIZEPFILE
#associate /dev/loop1 with the file, and password...
#(busybox losetup causes error with mkfs, use redhat/mandrake losetup...)
if [ "$PASSPFILE" = "none" ];then
losetup-FULL /dev/loop1 $HOMEDIR/$NAMEPFILE
else
echo "$PASSPFILE" | losetup-FULL -e xor /dev/loop1 $HOMEDIR/$NAMEPFILE
fi
mkfs -t $PROOTFS /dev/loop1 $SIZEPFILE
else #ID434
#0.9.8 want to minimise writes to usb flash...
#note, if swapon then have very big ramdisk capacity...
#is PHOME a usb partition?...
#v1.0.5 booting from internal CF flash card on IDE cable, will be hdx1, not sdx1,
#so test PSLEEP instead... (also see rc.modules special case PSLEEP=999)
#if [ ! "`echo "$PHOME" | grep --extended-regexp "sda|sdb|sdc|sdd"`" = "" ];then
if [ $PSLEEP -gt 0 ];then #see line220, PSLEEP not defined, gets set =0.
#what we will consider is mount pupxxx on /mnt/pupxxx by loopback, then copy contents to /root.
#we need to know that the tmpfs ramdisk has enough space.
#if not, just drop thru and pupxxx will get mounted directly on /root.
#RAMDISKFREE will also include any allocated swap...
#v1.0.7...
#RAMDISKFREE=`df | grep "rootfs" | tr -s " " | cut -f 4 -d " "`
RAMDISKFREE=`df | grep ' /$' | head -n 1 | tr -s " " | cut -f 4 -d " "`
RAMDISKFREE=`expr $RAMDISKFREE - 7000` #leave 7M
if [ $RAMDISKFREE -gt `du $HOMEDIR/$NAMEPFILE | cut -f 1` ];then
PUPMNTPOINT="/mnt/pupxxx"
echo "PUPMNTPOINT=$PUPMNTPOINT" > /tmp/pupxxxshutdown.txt
fi
fi
#associate /dev/loop1 with the file, and password...
if [ "$PASSPFILE" = "none" ];then
losetup-FULL /dev/loop1 $HOMEDIR/$NAMEPFILE
else
echo "$PASSPFILE" | losetup-FULL -e xor /dev/loop1 $HOMEDIR/$NAMEPFILE
fi
fi #ID434
#v1.0.4
#check that file size and volume size match (in case pupxxx is resized)...
#note, previously resized f.s. in /usr/sbin/resizepfile.sh.
if [ "$PROOTFS" = "ext2" ];then
PUPXXXCK="`disktype $HOMEDIR/$NAMEPFILE 2> /dev/null`"
if [ ! "`echo "$PUPXXXCK" | grep "Ext2"`" = "" ];then #precaution
PUPXXXRM=`echo -n "$PUPXXXCK" | grep "Regular file," | cut -f 1 -d '.' | tr -s ' ' | cut -f 4 -d ' ' | grep -v "[a-zA-Z]"`
PUPXXXFM=`echo -n "$PUPXXXCK" | grep "Volume size" | tr -s ' ' | cut -f 1 -d '.' | cut -f 4 -d ' ' | grep -v "[a-zA-Z]"`
if [ ! $PUPXXXRM ];then #precaution
PUPXXXRM=$SIZEPFILE
PUPXXXFM=$SIZEPFILE
fi
if [ ! $PUPXXXFM ];then #precaution
PUPXXXFM=$SIZEPFILE
PUPXXXRM=$SIZEPFILE
fi
if [ $PUPXXXRM -gt $PUPXXXFM ];then
#filesystem is smaller than file size...
echo "Resizing ext2 f.s. in $HOMEDIR/$NAMEPFILE to fill ${PUPXXXRM}M file..."
sync
resize2fs -pf $HOMEDIR/$NAMEPFILE;check_status $? #no size, will fill all of file.
sync
sleep 2 #so we can see result
fi
fi
fi
#now mount it on /root... 0.9.8 now $PUPMNTPOINT...
#fsck -Cpt $PROOTFS $HOMEDIR/$NAMEPFILE || sleep 10 #0.9.9 GuestToo
fsck -Cpt $PROOTFS $HOMEDIR/$NAMEPFILE #v1.0.2
case $? in
4) #errors were not fixed.
echo "Repairing filesystem..."
fsck -y -t $PROOTFS $HOMEDIR/$NAMEPFILE
sleep 10
;;
0) #okay.
;;
*)
sleep 10
;;
esac
mount -t $PROOTFS /dev/loop1 $PUPMNTPOINT
if [ $? -eq 0 ];then
#success!
echo "Successfully mounted /dev/$PHOME $HOMEDIR/$NAMEPFILE file on $PUPMNTPOINT"
if [ "$PUPMNTPOINT" = "/mnt/pupxxx" ];then
echo "Now copying the contents of $NAMEPFILE to /root in the ramdisk."
echo "This will eliminate writes to the USB drive, greatly extending its life."
echo "The contents of /root will be written back to $NAMEPFILE at the end"
echo "of the session, that is, when you close down."
echo "Please wait while the copy takes place..."
rm -fr /root #note, root should be empty.
cp -a $PUPMNTPOINT /root
sync
fi
HOMEPARTITION="$PHOME" #note, gets written to /tmp/homedevice, used pmount.
else
echo "Failed to mount /dev/$PHOME $HOMEDIR/$NAMEPFILE on $PUPMNTPOINT"
losetup-FULL -d /dev/loop1
PHOME=""
echo "Pausing for 20 seconds...";sleep 20
fi
fi #ID432
fi #ID428
fi #ID2303
modprobe -r sr_mod
modprobe -r ide-cd
#...these need to unload, as rc.local0 will reload them taking into account a ide cd
# drive that needs to be scsi-emulated (and ignored by ide-cd).
# as only a ide partition will be mounted above, this should be ok.
# if a real scsi partition is mounted above, then i think sr_mod will refuse
# to unload (will return "Device or resource busy" message).
# however, if usb partition mounted (which is scsi-emulated), then sr_mod will unload
# (the previously loaded usb-storage is enough for it).
#Note: v1.0.2 k2.6 needs a rethink, as scsi-emul not needed.
echo -n "$PFILE" > /tmp/bootpfile #v0.8.4 seems PFILE variable dies before Ash starts.
fi #ID103E
fi #ID076
if [ "$HOMEPARTITION" = "nothing" ];then
#this section was prior to v0.7.6...
# syslinux.cfg can specify a boot parameter to pass an environment
# variable, PHOME, which can be the users home device...
# otherwise, flash device will normally be sda1, but could be sdb1...
HOMEPARTITION="nothing"
mount -t $PROOTFS /dev/$PHOME /root 2> /dev/null #sloppy coding, as PHOME may not be defined.
if [ "$?" -eq 0 ];then
HOMEPARTITION="$PHOME"
else
#only try to mount a USB device if non-0 PSLEEP...
if [ $PSLEEP -ne 0 ];then
mount -t $PROOTFS /dev/sda1 /root
if [ "$?" -eq 0 ];then
HOMEPARTITION="sda1"
#sanity check...
if [ ! -e /root/image.gz ];then
HOMEPARTITION="nothing"
umount /root
fi
fi
if [ "$HOMEPARTITION" = "nothing" ];then
mount -t $PROOTFS /dev/sdb1 /root
if [ "$?" -eq 0 ];then
HOMEPARTITION="sdb1"
#sanity check...
if [ ! -e /root/image.gz ];then
HOMEPARTITION="nothing"
umount /root
fi
fi
fi
fi
fi
fi
#mkdir /usr 2> /dev/null #v1.0.5
mkdir /.usr_cram #v1.0.5
rmdir /usr 2> /dev/null #v1.0.5
ln -s /.usr_cram /usr #v1.0.5
FILEUC="no"
PUPPYVERSION="`cat /root0/.etc/puppyversion`"
SIZEUSRCRAM="`cat /root0/.etc/sizeusrcram`"
#need to mount compressed cramfs file usr_cram.fs onto /usr...
#/usr folder has been compressed as a cramfs file...
#(see also entry in /etc/fstab)
if [ -e /usr_cram.fs ];then #(this means that it was inside image.gz, so now in ramdisk).
echo "Mounting /usr_cram.fs cramfs file on /usr..."
losetup /dev/loop0 /usr_cram.fs
mount -r -t ${COMPRFS} /dev/loop0 /.usr_cram
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
FILEUC="yes"
else
#usr_cram.fs may not be inside image.gz...
#0.9.8 problem, may find an older usr_cram.fs...
if [ -e /root/usr_cram.fs ];then #(the case for Option-1 usb/zip installations)
FILEUC="/root"
if [ "`ls -l /root/usr_cram.fs | tr -s ' ' | cut -f 5 -d ' '`" = "$SIZEUSRCRAM" ];then
FILEUC="yes"
else
echo "/root/usr_cram.fs exists, but seems to be wrong version, rejecting."
fi
fi
if [ "$FILEUC" = "yes" ];then
echo "Mounting /root/usr_cram.fs cramfs file on /usr..."
losetup /dev/loop0 /root/usr_cram.fs
mount -r -t ${COMPRFS} -o noatime /dev/loop0 /.usr_cram
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
else
#0.9.8 problem, may find an older usr_cram.fs...
if [ -e $HOMEDIR/usr_cram.fs ];then #(usb/zip Option-2, h.d. Option-1 installations)
FILEUC="$HOMEDIR"
if [ "`ls -l $HOMEDIR/usr_cram.fs | tr -s ' ' | cut -f 5 -d ' '`" = "$SIZEUSRCRAM" ];then
FILEUC="yes"
else
echo "$HOMEDIR/usr_cram.fs exists, but seems to be wrong version, rejecting."
fi
fi
if [ "$FILEUC" = "yes" ];then
#found it, but only copy it into ramdisk if ramdisk f.s. is big enough...
#0.9.8 SIZEFILLK is now physical+swap allocated for tmpfs ramdisk, but I want to be
#conservative, only copy usr_cram.fs into ramdisk if enough physical ramdisk...
#if [ $SIZEFILLK -gt 61430 ];then #60M ramdisk will be 61440K.
if [ $SIZEPHYSICALFILLK -gt 63400 ];then #62M ramdisk will be 63488K.(refer /sbin/init)
#also, pupxxx may have been copied into /root, via /mnt/pupxxx, in case of usb boot,
#see above. so, do extra available space check...
#v1.0.7...
#RAMDISKFREE=`df | grep "rootfs" | tr -s " " | cut -f 4 -d " "`
RAMDISKFREE=`df | grep ' /$' | head -n 1 | tr -s " " | cut -f 4 -d " "`
RAMDISKFREE=`expr $RAMDISKFREE - 6000` #leave 6M (used 7M before, need bit less here for +ve result)
if [ $RAMDISKFREE -gt `du $HOMEDIR/usr_cram.fs | cut -f 1` ];then
echo "Copying usr_cram.fs from $HOMEDIR to /..."
cp $HOMEDIR/usr_cram.fs /usr_cram.fs #that is, it will now be in ramdisk.
sync
echo "Mounting /usr_cram.fs file on /usr..."
losetup /dev/loop0 /usr_cram.fs
mount -r -t ${COMPRFS} /dev/loop0 /.usr_cram
else
#not enough room in ramdisk.
echo "Mounting $HOMEDIR/usr_cram.fs file on /usr..."
losetup /dev/loop0 $HOMEDIR/usr_cram.fs
mount -r -t ${COMPRFS} -o noatime /dev/loop0 /.usr_cram
fi
else
#not enough room in ramdisk.
echo "Mounting $HOMEDIR/usr_cram.fs file on /usr..."
losetup /dev/loop0 $HOMEDIR/usr_cram.fs
mount -r -t ${COMPRFS} -o noatime /dev/loop0 /.usr_cram
fi
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
else
#our last resort...
echo "looking for usr_cram.fs on the CD..."
modprobe ide-cd #rc.local0 loads these, so doing it temporarily here.(also loads cdrom)
#modprobe sr_mod # ditto. (also loads ide-scsi) v1.0.2
#...probedisk works without these, but complains about missing /proc/scsi.
#...if mount ide cdrom below, it autoloads ide-cd if not done explicitly.
mount > /etc/mtab #as busybox doesn't have proper mtab (mkfs needs it).
ACTUALROOT="`df | grep "/root"`"
#if booting from the live-CD, it may be a separate file on the CD...
#TALLYCD="`probedisk 2>/dev/null | grep "cdrom" | cut -f 1 -d "|" | tr "\n" " "`"
#v1.0.2
#stupid 2.6 kernel... leave sr_mod out for now, try this way...
TALLYCD="`dmesg | grep -i "cd" | grep -i "atapi" | cut -b 1-4 | grep "hd[a-z]:" | cut -f 1 -d ':' | sort -u | tr "\n" " "`"
#note, this technique using dmesg need to have /dev/ appended below...
FLAGSRMOD="" #v1.0.4
for ONECD in $TALLYCD
do
ONECD="/dev/$ONECD" #v1.0.2
#disktype $ONECD 2>/dev/null | grep "SCHILLING" >/dev/null
#0.9.8 ...hmm, some people are reporting Puppy can't find usr_cram.fs on the CD.
# let's just look for a CD with string "ISO9660"...
CDMEDIAINFO="`disktype $ONECD 2>/dev/null`" #1.0.4
#v1.0.4 disktype does not work properly for vmware virtual cd drive...
if [ ! "`echo -n "$CDMEDIAINFO" | tail -n 1 | grep "Track 1:" | grep " 0 bytes"`" = "" ];then
#emergency fallback, try probepart. see note above about sr_mod...
modprobe sr_mod
FLAGSRMOD="loaded"
CDMEDIAINFO="`probepart | grep "$ONECD" | grep "iso9660"`"
fi
if [ ! "`echo -n "$CDMEDIAINFO" | grep -i "iso9660"`" = "" ];then
#found it, unless another CD is inserted!...
mount -t iso9660 $ONECD /mnt/cdrom > /dev/null 2>&1
if [ $? -eq 0 ];then #=0 success.
if [ -e /mnt/cdrom/usr_cram.fs ];then
if [ ! $SIZEFILLK -gt 63400 ];then #62M ramdisk will be 63488K.
if [ ! "$ACTUALROOT" = "" ];then
echo
echo "Copying usr_cram.fs from CD to /root..."
echo "Note, usr_cram.fs is only copied to /root the first time you boot"
echo "a new version of Puppy from CD. On subsequent boots the file will"
echo "already be in /root thus greatly speeding bootup time (this speedup"
echo "will only occur if there is a persistent home partition on /root)."
cp /mnt/cdrom/usr_cram.fs /root/usr_cram.fs
sync
echo "Mounting /root/usr_cram.fs file on /usr..."
losetup /dev/loop0 /root/usr_cram.fs
mount -r -t ${COMPRFS} /dev/loop0 /.usr_cram
umount /mnt/cdrom
else
echo
echo "PROBLEM!!! Puppy was unable to mount a persistent home storage"
echo "partition on /root, and the ramdisk is too small, so there is no"
echo "place to copy usr_cram.fs to."
echo "If no /usr folder, Puppy will boot but be crippled and there will"
echo "only be the basic commandline..."
echo "HOWEVER, Puppy does have a last resort in this situation, which"
echo "is to leave usr_cram.fs on the CD and to mount it from there onto"
echo "/usr. This means that the CD drive cannot be used for anything"
echo "else and Puppy will run much slower..."
echo
echo "Mounting /mnt/cdrom/usr_cram.fs file on /usr..."
losetup /dev/loop0 /mnt/cdrom/usr_cram.fs
mount -r -t ${COMPRFS} /dev/loop0 /.usr_cram
echo "Pausing for 30 seconds (so you can see this bad situation)..."
sleep 30
fi
else
echo
echo "The ramdisk is big enough to hold usr_cram.fs. So, Puppy will now"
echo "copy usr_cram.fs to / in the ramdisk, and will do so at every bootup."
echo "Thus, there will not be a speedup in subsequent boots, but actual running"
echo "will be slightly faster as all of /usr will be in ramdisk."
echo
echo "Copying usr_cram.fs from CD to /..."
cp /mnt/cdrom/usr_cram.fs /usr_cram.fs
sync
echo "Mounting /usr_cram.fs file on /usr..."
losetup /dev/loop0 /usr_cram.fs
mount -r -t ${COMPRFS} /dev/loop0 /.usr_cram
umount /mnt/cdrom
fi
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
FILEUC="yes" #0.9.8
break
fi
umount /mnt/cdrom
fi
fi
#failed to find usr_cram.fs.
done
#v1.0.2 modprobe -r sr_mod
if [ "$FLAGSRMOD" ];then #v1.0.4
modprobe -r sr_mod
fi
modprobe -r ide-cd
#...if ide cdrom is still mounted, ide-cd will refuse to unload.
# (which is a last-resort circumstance. normally want it to unload so that rc.local0
# can load it correctly to handle scsi-emulated ide cd drive).
#Note: v1.0.2 k2.6 does not need scsi-emulation.
#0.9.8 there is a final desperate try...
if [ ! "$FILEUC" = "no" ];then
if [ ! "$FILEUC" = "yes" ];then
echo
echo "$FILEUC/usr_cram.fs exists, but Puppy thinks that it is an old version."
echo "However, as Puppy cannot find another usr_cram.fs, no choice but to use it."
echo "Note, Puppy compares the size of usr_cram.fs file with value saved in"
echo "/etc/sizeusrcram file inside image.gz -- they should match."
echo -n "Press ENTER key to continue: "
read nnnn
echo "Mounting $FILEUC/usr_cram.fs file on /usr..."
losetup /dev/loop0 $FILEUC/usr_cram.fs
mount -r -t ${COMPRFS} -o noatime /dev/loop0 /.usr_cram
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
FILEUC="yes" #v1.0.1
fi
else
echo -e "\\033[1;31m"
echo "Puppy was unable to locate the file usr_cram.fs."
echo "This file is the entire /usr folder, as a compressed read-only f.s.,"
echo "and its absence means that X cannot be started, but you will at least"
echo "get the command prompt."
if [ $PHOME ];then
echo "One possible workaround is to copy usr_cram.fs to /dev/$PHOME then"
echo "reboot Puppy. That is one place Puppy will look during bootup."
fi
echo
echo -n "Press ENTER key to continue: "
echo -en "\\033[0;39m"
read mmnn
fi
fi
fi
fi
##0.9.8. v1.0.4 generalised
##allow for another read-only compressed file...
mkdir /opt
#OPTSQUASH="`ls $HOMEDIR/opt*.sfs 2> /dev/null`"
#LOOPCNT=5 #4 #3 v1.0.5 v1.0.6
#if [ ! "$OPTSQUASH" = "" ];then
# for ONESQUASH in $OPTSQUASH
# do
# DIRSQUASH="`basename "$ONESQUASH" | cut -f 1 -d '.' | sed -e 's/opt//g'`"
# mkdir /opt/$DIRSQUASH
# echo "Mounting $ONESQUASH file on /opt/$DIRSQUASH..."
# losetup-FULL /dev/loop$LOOPCNT $ONESQUASH
# mount -r -t squashfs -o noatime /dev/loop$LOOPCNT /opt/$DIRSQUASH
# LOOPCNT=`expr $LOOPCNT + 1`
# done
#fi
#v1.0.5...
USRDEVX=""
if [ ! "`ls $HOMEDIR/usr_devx.sfs 2> /dev/null`" = "" ];then
mkdir /.usr_devx
echo "Mounting $HOMEDIR/usr_devx.sfs file on /.usr_devx..."
losetup-FULL /dev/loop3 $HOMEDIR/usr_devx.sfs
mount -r -t squashfs -o noatime /dev/loop3 /.usr_devx
if [ $? -eq 0 ];then
USRDEVX=':/.usr_devx=ro'
fi
fi
USRMORE=""
if [ ! "`ls $HOMEDIR/usr_more.sfs 2> /dev/null`" = "" ];then
mkdir /.usr_more
echo "Mounting $HOMEDIR/usr_more.sfs file on /.usr_more..."
losetup-FULL /dev/loop4 $HOMEDIR/usr_more.sfs
mount -r -t squashfs -o noatime /dev/loop4 /.usr_more
if [ $? -eq 0 ];then
USRMORE=':/.usr_more=ro'
fi
fi
if [ "$HOMEPARTITION" != "nothing" ];then
echo "SUCCESS: ALL PERSONAL FILES WILL BE AUTO SAVED IN HOME DEVICE"
echo "This means that Puppy was able to mount a partition on /root."
if [ "$PROOTFS" = "umsdos" ];then
#sync the umsdos/msdos filesystems...
umssync /root
fi
#v1.0.2 Update files in /root...
rm -rf /root/tmp 2> /dev/null #v1.0.7
/etc/rc.d/rc.update
#some Puppy scripts use this (default value maybe overridden by boot param)...
echo -n "$SIZERAMDISKK" > /root/.etc/ramdisksize
echo -n "$SIZEFILLK" > /root/.etc/ramdiskfssize #size of f.s. in /dev/ram0,3
#save so scripts can access flash device...
echo -n $HOMEPARTITION > /tmp/homedevice
#...if this file doesn't exist, scripts will know device not available
#...also read by pmount script to prevent unmounting home device.
#v1.0.1 make /usr read-write...
else
echo -e "\\033[1;31m" #34=blue, 33=yellow, 32=green, 31=red, 35=purple, 36=aquablue, 38=black.
echo "CANNOT MOUNT HOME DEVICE: CANNOT SAVE PERSONAL FILES"
echo "This means that Puppy was unable to mount a persistent home partition"
echo "on /root. In the case of the live-CD, probably Puppy could not find"
echo "a suitable hard drive partition in which to create the home file."
echo "(v1.0.3+ also has a boot menu option to cause this situation!)"
echo "Puppy will still run, but nothing will be permanently saved."
echo -e "Pausing for 10 seconds... \\033[0;39m"
sleep 10
#copy everything from root0 to root...
#rootcopyfunc #see function above.
cp -a /root0/* /root/
cp -a /root0/.[a-zA-Z0-9]* /root/
#some Puppy scripts use this (default value maybe overridden by boot param)...
echo -n "$SIZERAMDISKK" > /root/.etc/ramdisksize
echo -n "$SIZEFILLK" > /root/.etc/ramdiskfssize #size of f.s. in /dev/ram0,3
fi
sync
#v1.0.6
#we come here with /usr a symlink to /.usr_cram
if [ "$FILEUC" = "yes" ];then #FILEUC="yes" if usr_cram.fs got mounted on /.usr_cram.
modprobe unionfs
if [ -h /usr ];then
rm -f /usr
fi
mkdir /usr 2> /dev/null
mount -t unionfs -o dirs=/root/.usr=rw${USRDEVX}${USRMORE}:/.usr_cram=ro none /usr;check_status $?
if [ -f /root/.index.html ];then #v1.0.1 v1.0.5
cp -f /root/.index.html /usr/share/doc/index.html #see rc.update script called above.
fi
fi
#echo -e "Puppy Linux\n`uname -s` `uname -r` [`uname -m` arch]\n\n" > /etc/issue
#echo "Scan for fonts. Part of fontconfig, references fonts.conf for"
#echo "font path, generates fonts.cache-1 in each font directory"
#fc-cache --verbose
#...have removed fontconfig files.
#echo "An experiment, to get dialup dyn ip assignment"
#echo "working with a firewall..."
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
#relink /etc from /root0/.etc to /root/.etc...
rm -f /etc
ln -s root/.etc /etc
#rm -rf /root0
#...note, will not succeed removing /root0/.etc, as rc.sysinit in use.
#...have done it in rc.local0
sync
# FILE rc.local0 IS NOW READ FROM YOUR MOUNTED HOME PARTITION...
# (assuming mounting succeeded above)
# I don't think we can use shell "." command to insert rc.local0
# here. we need to execute the newly mounted rc.local0...
# Also put a direct path...
exec /root/.etc/rc.d/rc.local0
# ...must be last entry in this file