#!/bin/bash #Copyright 1999-2000 Jeff Dike and William #Stearns . GPL'd; see the GPL for more info. #FIXME - public key name uses (host hostname) for ssh. #FIXME - need ifconfig eth0 arp/ifconfig eth0 hw ether anymore? DIST=${1:-rh62} # This is the file containing the filesystem. You probably shouldn't change # it since the kernel has this name hard-wired. FSFILE=${FSFILE:-root_fs} # This is a temporary mount point which will be used to mount the new # filesystem while it's being built. MNTDIR=${MNTDIR:-mnt} # Change this if your distribution is located someplace else if [ -z "$RPMDIR" ]; then RPMDIR=/usr/src/${DIST}source fi #This needs to be a (dist-specific) file in a writable directory. It will #be created automatically if it doesn't exit. if [ -z "$RPMPROVIDES" ]; then RPMPROVIDES=`pwd`/${DIST}.provides fi #You have three ways to specify the size of the root filesystem. The #actual size will be the largest of any you specify, or 100M if you #don't specify any. #FSMEGS: an actual size in Megs of the filesystem. #FSFREEPCT: In addition to the amount of space used, this percentage over #the used space must be free. If 100M is used by the dist and FSFREEPCT #is 15, you'll have a root filesystem of at least 115M. #FSFREEMEGS: In addition to the amount of space used, this absolute number #of megabytes must be free. Again, if 100M used by dist and FSFREEMEGS #is 30, the root filesystem will be at least 130M. #I'd suggest setting FSFREEPCT to 20 (or something between 30 and 100 if you #know you'll be adding a lot of stuff) and leaving the rest unset. #FSMEGS="100" #FSFREEPCT="15" #FSFREEMEGS="30" FSMEGS=${FSMEGS:-300} FSFREEPCT=${FSFREEPCT:-35} RPMS=" $RPMS bdflush- dev- mount- SysVinit- net-tools- quota- findutils- tcp_wrappers- \ bind-utils- devfsd- iptables- sysklogd- vixie-cron- binutils- \ util-linux- gzip- iputils- " #Base, uml-net-tools- not needed any more. RPMS=" $RPMS lynx- mc- tcpdump- strace- traceroute- less- man- info- passwd- \ diffutils- console-tools- rpm- vim-minimal- vim- vim-enhanced- telnet- netkit-ftp- \ ftp- openssh-clients- ssh- ircii- " #Client RPMS=" $RPMS cpp- egcs- gcc- " #Development #Common Servers RPMS=" $RPMS xinetd- inetd- netkit-base-" #Inetd RPMS=" $RPMS apache- " #Apache/httpd RPMS=" $RPMS bind- caching-nameserver- " #Bind/named RPMS=" $RPMS imap- sendmail- " #Email server RPMS=" $RPMS inn- " #News Server RPMS=" $RPMS linuxconf- " #Linuxconf web configuration - has to be enabled. RPMS=" $RPMS pidentd- " #Ident server RPMS=" $RPMS portmap- " RPMS=" $RPMS squid- " RPMS=" $RPMS samba- " RPMS=" $RPMS telnet-server- netkit-telnet- openssh-server- ssh-server- " #Telnet/ssh RPMS=" $RPMS ucd-snmp- " RPMS=" $RPMS wu-ftpd- anonftp- " #FTP #Common X RPMS=" $RPMS fvwm2- " #fvwm2 RPMS=" $RPMS enlightenment- " #enlightenment RPMS=" $RPMS chkfontpath- XFree86-75dpi-fonts- XFree86-100dpi-fonts- \ XFree86-Xnest- xsysinfo- xosview- XFree86-tools- X11R6-contrib- " #X Client RPMS=" $RPMS gnome-core- " #gnome RPMS=" $RPMS gdm- " #gdm case $DIST in rh62|im62) #Redhat 6.2, Immunix 6.2 # RPMS=" readline- $RPMS " # RPMS=" $RPMS **perl- " #Client : ;; ca24) #Caldera OpenLinux 2.4 # RPMS=" setup- termcap- tcsh-#sed-#sh-utils-#fileutils- grep- \ # gawk- textutils- procps- modutils- ext2fs- popt- crontabs- \ # logrotate- psmisc- which- slang- readline- bzip2- mailcap- \ # $RPMS pam-apps- OpenLinux- adduser- shadow-misc- bool- " # RPMS=" $RPMS gpm- libstdc++- " #Client # RPMS=" $RPMS XFree86-config- XFree86-fontserver- utempter- $RPMDIR/XFree86-3.3.6-3.i386.rpm **xpm- " #X # RPMS=" $RPMS **xscreensaver- " #gnome : ;; co51) #Conectiva 5.1 # #initscripts fails to Require: gettext # RPMS=" setup- filesystem- basesystem- gettext- popt- logrotate- \ # which- slang- sh-utils- $RPMS " # RPMS=" $RPMS gpm- indexhtml- " #Client # RPMS=" $RPMS XFree86-xfs- Mesa- $RPMDIR/XFree86-3.3.6-15cl.i386.rpm **xpm- " #X : ;; co60) #Conectiva 6.0 : ;; co70) #Conectiva 7.0 : ;; md71) #Mandrake 7.1 # RPMS=" filesystem- gdbm- perl- newt- ntsysv- tmpwatch- crontabs- etcskel- \ # getty_ps- hdparm- losetup- procmail- rootfiles- sash- ash- setserial- stat- rmt- tar- time- \ # lilo- grub- mkinitrd- cpio- mkbootdisk- isapnptools- basesystem- mailcap- $RPMS " # RPMS=" $RPMS indexhtml- " #Client # RPMS=" $RPMS Mesa-common- svgalib- Mesa- " #X : ;; md80) #Mandrake 8.0 RPMS=" db1- $RPMS " ;; md81) #Mandrake 8.1 RPMS=" db1- $RPMS " ;; rh70) #RedHat 7.0 # RPMS=" slang- $RPMS " : ;; rh71) # RPMS=" $RPMS " : ;; rh72) # RPMS=" $RPMS " : ;; su70) : ;; *) echo Unknown distribution $DIST exit ;; esac # $RPMDIR/gzip-1.2.4a-2.i586.rpm if source dir has two gzip rpms #I think we have to pass on lpr. Skipping cvs/rcs, postgresql, rsh, #rsync, rwall, rwho, talks, tftp, times, uucp, yp, syslog port if [ ! -f ./functions ]; then echo Missing ./functions, exiting. >/dev/stderr exit 1 fi . ./functions #addline() #Params: $1 File that needs the additional line, $2 line to add. #bitstomask() #broadcastof() #delline() #Params: $1 File that needs the line removed, $2 line to remove (may be a partial line). #networkof() #rpm_params() #rpm_file() #substline() #Params: $1 File that needs the additional line, $2 string to look for, $3 string with which it should be replaced. #and others... if [ `whoami` = root ]; then SUDO="" else SUDO=`which sudo` [ $? -ne 0 ] && echo \ You need to have sudo installed or you need to run this script as root && \ SUDO=`get_data "Your local copy of sudo (hit return to exit)" "" \ verify_sudo` [ "$SUDO" = "" ] && exit 1 fi RPMS=" $RPMS " if ! echo "$RPMS" | grep -q "[# /]bash-[# 1-9]" ; then echo Adding missing bash to the list. RPMS=" bash- $RPMS " fi if ! echo "$RPMS" | grep -q "[# /]glibc-[# 1-9]" ; then #Yes, I know there are distributions w/o glibc. Case later. echo Adding missing glibc to the list. RPMS=" glibc- $RPMS " fi echo Add rpm dependencies. if [ -d rpmdeptree ]; then $SUDO rm -rf ./rpmdeptree elif [ -e rpmdeptree ]; then echo rpmdeptree exists, ugh, exiting. exit 1 fi $SUDO mkdir rpmdeptree #Warn that a kernel param/modload param needed for >4M ramdisks. #append ramdisk_size=13288 #options rd rd_size=13288 #or set in kernel configuration. #to /etc/conf.modules (yes, at boot uses "ramdisk_size" and module #uses "rd_size" -- sigh) But it does indeed work -- e.g: $SUDO umount -f rpmdeptree 2>/dev/null #$SUDO mke2fs -m0 /dev/ram0 #$SUDO mount -t ext2 /dev/ram0 rpmdeptree #Use tmpfs instead to avoid size problems entirely $SUDO mount -t tmpfs tmpfs rpmdeptree/ if [ "`df rpmdeptree | grep rpmdeptree | awk '{print $4}'`" -lt 13000 ]; then echo Your ramdisks are too small. Please make them larger by adding echo append = \"ramdisk_size=16384\" echo at the top of /etc/lilo.conf , rerunning \"lilo\", adding echo options rd rd_size=16384 echo to /etc/modules.conf or /etc/conf.modules, and rebooting. echo The build will continue, but it will be slower because the echo dependencies need to be checked on your physical drive. echo Press enter to continue. read JUNK $SUDO umount rpmdeptree fi cd rpmdeptree CURRENTDIR=`pwd` RPMS="`rpm_add_deps $RPMS`" cd .. if [ -d rpmdeptree ]; then $SUDO rm -rf ./rpmdeptree/* else echo rpmdeptree isn\'t a directory, ugh. exiting. exit 1 fi $SUDO umount rpmdeptree 2>/dev/null echo Finished adding dependencies NUMRPMS=0 TOTALSPACE=0 for ONERPM in `echo $RPMS | sed -e 's/#/ /g'` ; do NUMRPMS=$[ $NUMRPMS + 1 ] TOTALSPACE=$[ $TOTALSPACE + `rpm --queryformat '%{SIZE}' -qp $ONERPM` ] done echo -n There are $TOTALSPACE bytes \( TOTALSPACE=$[ $TOTALSPACE / 1024 / 1024 ] #Convert TOTALSPACE to Megabytes echo $TOTALSPACE M\) of space used by $NUMRPMS rpms. SIZES="100" if [ -n "$FSMEGS" ]; then echo FS needs to be at least $FSMEGS. SIZES="$SIZES $FSMEGS" fi if [ -n "$FSFREEPCT" ]; then echo FS needs to have at least $FSFREEPCT percent free additional free space= $[ ( $TOTALSPACE * (100 + $FSFREEPCT + 5)) / 100 ] M. SIZES="$SIZES $[ ( $TOTALSPACE * (100 + $FSFREEPCT + 5)) / 100 ]" #5% here and below accounts for root-owned space. fi if [ -n "$FSFREEMEGS" ]; then echo FS needs to have at least $FSFREEMEGS free additional free space. SIZES="$SIZES $[ $FSFREEMEGS * 1.05 ]" fi ACTUALFSSIZE=`max $SIZES` echo Using $ACTUALFSSIZE for the root filesystem. if [ -d $FSFILE ] then MNTDIR=$FSFILE else MNTDIR=mnt if [ ! -b $FSFILE ]; then if [ -f $FSFILE ] || [ -f $FSFILE.old ]; then echo Moving old root filesystem out of the way... if [ -f $FSFILE.old ]; then rm -f $FSFILE.old ; fi if [ -f $FSFILE ]; then mv -f $FSFILE $FSFILE.old ; fi fi echo Creating \"$FSFILE\" as an empty file... dd if=/dev/zero of=$FSFILE bs=$((1024 * 1024)) count=0 seek=$ACTUALFSSIZE || exit 1 #Make a completely sparse file to start with; use "count=$ACTUALFSSIZE", no seek if you'd rather not. fi [ "$SUDO" != "" ] && \ echo Privileged operation - you may need to type your root password at sudo echo Making a file system in it... $SUDO mke2fs -F $FSFILE || exit 1 echo Mounting it on $MNTDIR [ ! -d $MNTDIR ] && mkdir $MNTDIR [ ! -b $FSFILE ] && LOOP="-o loop" $SUDO umount $MNTDIR >/dev/null 2>&1 || /bin/true $SUDO mount $LOOP $FSFILE $MNTDIR || exit 1 fi cd $MNTDIR if [ `ls -A1 $RPMDIR/*.cgz 2>/dev/null | wc -l` -gt 0 ]; then echo Opening up Base files. #Caldera's fsstnd.cgz and skeleton.cgz for ONEBASE in $RPMDIR/*.cgz ; do cat $ONEBASE | gunzip - | $SUDO cpio -idm --no-absolute-filenames done fi $SUDO mkdir -p var/lib/rpm/ || exit 1 $SUDO mkdir -p var/tmp/ || exit 1 $SUDO mkdir -p dev || exit 1 $SUDO mknod -m 666 dev/null c 1 3 #What nitwit redirects to /dev/null in the _preinstall_ script for dev-? ;-) $SUDO mkdir -p etc/ case "$DIST" in ca*) addline etc/passwd "root:x:0:0:root:/root:/bin/bash" addline etc/passwd "bin:x:1:1:bin:/bin:" addline etc/passwd "daemon:x:2:2:daemon:/sbin:" addline etc/passwd "adm:x:3:4:adm:/var/adm:" addline etc/passwd "lp:x:4:7:lp:/var/spool/lpd:" addline etc/passwd "sync:x:5:0:sync:/sbin:/bin/sync" addline etc/passwd "shutdown:x:6:11:shutdown::/sbin/shutdown" addline etc/passwd "halt:x:7:0:halt:/sbin:/sbin/halt" addline etc/passwd "mail:x:8:12:mail:/var/spool/mail:" addline etc/passwd "news:x:9:13:news:/var/spool/news:" addline etc/passwd "uucp:x:10:14:uucp:/var/spool/uucp:" addline etc/passwd "operator:x:11:0:operator:/root:" addline etc/passwd "games:x:12:100:games:/usr/games:" addline etc/passwd "gopher:x:13:30:man:/usr/lib/gopher-data:" addline etc/passwd "ftp:x:14:50:FTP user:/home/ftp:" addline etc/passwd "man:x:15:15:Manuals Owner:/:" addline etc/passwd "majordom:x:16:16:Majordomo:/:/bin/false" addline etc/passwd "postgres:x:17:17:Postgres User:/home/postgres:/bin/bash" addline etc/passwd "mysql:x:18:18:MySQL User:/var/lib/mysql:/bin/false" addline etc/passwd "bind:x:19:19:BIND Server Pseudo User:/:/bin/false" addline etc/passwd "httpd:x:55:55:HTTP User:/:/bin/false" addline etc/passwd "nobody:x:65534:65534:Nobody:/:/bin/false" addline etc/passwd "col:x:100:100:Caldera OpenLinux User:/home/col:/bin/bash" addline etc/group "root::0:root" addline etc/group "bin::1:root,bin,daemon" addline etc/group "daemon::2:root,bin,daemon" addline etc/group "sys::3:root,bin,adm" addline etc/group "adm::4:root,adm,daemon" addline etc/group "tty::5:" addline etc/group "disk::6:root" addline etc/group "lp::7:daemon,lp" addline etc/group "mem::8:" addline etc/group "kmem::9:" addline etc/group "wheel::10:root" addline etc/group "operator::11:" addline etc/group "mail::12:mail" addline etc/group "news::13:news" addline etc/group "uucp::14:uucp" addline etc/group "man::15:" addline etc/group "majordom::16:" addline etc/group "database::17:" addline etc/group "mysql::18:" addline etc/group "bind::19:" addline etc/group "games::20:" addline etc/group "gopher::30:" addline etc/group "dip::40:" addline etc/group "utmp::45:" addline etc/group "ftp::50:" addline etc/group "http::55:" addline etc/group "users::100:" addline etc/group "nobody::65534:" addline etc/group "gdm::87:" ;; co60) #Just enough to do the install. addline etc/group "daemon::2:root,bin,daemon" addline etc/group "sys::3:root,bin,adm" addline etc/group "tty::5:" addline etc/group "disk::6:root" addline etc/group "lp::7:daemon,lp" addline etc/group "kmem::9:" addline etc/group "mail::12:mail" addline etc/group "news::13:news" addline etc/group "uucp::14:uucp" addline etc/group "man::15:" addline etc/group "floppy::19:" addline etc/group "utmp:x:22:" addline etc/group "cdrom::24:" addline etc/group "audio::29:" addline etc/group "nobody::65534:" addline etc/passwd "root::0:0:root:/root:/bin/bash" addline etc/passwd "lp:*:4:7:lp:/var/spool/lpd:" $SUDO mkdir --mode=755 -p lib $SUDO mkdir --mode=755 -p usr/lib $SUDO mkdir --mode=755 -p var/log $SUDO mkdir --mode=1777 -p tmp ;; co70) #Just enough to do the install. addline etc/group "daemon::2:root,bin,daemon" addline etc/group "sys::3:root,bin,adm" addline etc/group "tty::5:" addline etc/group "disk::6:root" addline etc/group "lp::7:daemon,lp" addline etc/group "kmem::9:" addline etc/group "mail::12:mail" addline etc/group "news::13:news" addline etc/group "uucp::14:uucp" addline etc/group "man::15:" addline etc/group "floppy::19:" addline etc/group "utmp:x:22:" addline etc/group "cdrom::24:" addline etc/group "audio::29:" addline etc/group "nobody::65534:" addline etc/passwd "root::0:0:root:/root:/bin/bash" addline etc/passwd "lp:*:4:7:lp:/var/spool/lpd:" $SUDO mkdir --mode=755 -p lib $SUDO mkdir --mode=755 -p usr/lib $SUDO mkdir --mode=755 -p var/log $SUDO mkdir --mode=1777 -p tmp ;; md80) addline etc/group "daemon:x:2:root,bin,daemon" addline etc/group "sys:x:3:root,bin,adm" addline etc/group "tty:x:5:" addline etc/group "disk:x:6:root" addline etc/group "lp:x:7:daemon,lp" addline etc/group "kmem:x:9:" addline etc/group "uucp:x:14:uucp" addline etc/group "cdwriter:x:80:" addline etc/group "audio:x:81:" addline etc/group "x10:x:82:" addline etc/group "utmp:x:406:" $SUDO mkdir --mode=700 -p root/ $SUDO mkdir --mode=1777 -p tmp/ $SUDO mkdir --mode=555 -p proc/ : ;; md81) addline etc/group "daemon:x:2:root,bin,daemon" addline etc/group "sys:x:3:root,bin,adm" addline etc/group "tty:x:5:" addline etc/group "disk:x:6:root" addline etc/group "lp:x:7:daemon,lp" addline etc/group "kmem:x:9:" addline etc/group "uucp:x:14:uucp" addline etc/group "cdwriter:x:80:" addline etc/group "audio:x:81:" addline etc/group "x10:x:82:" addline etc/group "utmp:x:406:" $SUDO mkdir --mode=700 -p root/ $SUDO mkdir --mode=1777 -p tmp/ $SUDO mkdir --mode=555 -p proc/ : ;; esac echo Install the rpms... CURRENTDIR=`pwd` for rpm in $RPMS ; do ShortRpm=${rpm%-*} #Drop from last dash on, i.e. the rpm build num and later ShortRpm=${ShortRpm##*/} #Drop path info echo -n $ShortRpm... #package (and distribution) specific changes before package installed case $DIST/$ShortRpm in rh70/dev-*) echo addline etc/group 'floppy:x:19:' #$SUDO /usr/sbin/groupadd -g 19 -r -f floppy > /dev/null #Use this instead? ;; co60/setup-*|co70/setup-*|md80/setup-*|md81/setup-*) rm -f etc/group #the setup package will add the complete etc/group... rm -f etc/passwd #...and passwd ;; esac case $ShortRpm in openssh-server-*) #Set hostname to the hostname of the uml system just long enough to set the host key comment. HostHostname=`hostname` hostname uml #Perhaps the distribution hostname later. ;; esac #Actually install the package(s) if echo "$rpm" | grep -q '#' 2>/dev/null ; then echo -n \(2+\) $SUDO rpm -i --root $CURRENTDIR `rpm_params $DIST $rpm` --noscripts --notriggers `rpm_file $rpm` #--nodeps is set where needed by rpm_params $SUDO rpm -i --root $CURRENTDIR `rpm_params $DIST $rpm` --replacepkgs `rpm_file $rpm` #--nodeps is set where needed by rpm_params else $SUDO rpm -i --root $CURRENTDIR `rpm_params $DIST $rpm` `rpm_file $rpm` #--nodeps is set where needed by rpm_params fi #package (and distribution) specific changes after package installed case $DIST/$ShortRpm in md71/msec-*|md80/msec-*|md81/msec-*) export SECURE_LEVEL=1 #Mandrake: lie that it has been set. #$SUDO chroot . usr/sbin/msec 1 #Mandrake: 'Couldn't find used secure level, You should correct this problem by running /usr/sbin/msec' in other post scripts. ;; esac case $ShortRpm in openssh-server-*) #Reset hostname to the host hostname. hostname $HostHostname ;; esac done echo Done! echo Copying bin/true over sbin/hwclock... $SUDO cp bin/true sbin/hwclock #Ummm, is this really necessary? Yup, until I figure out how the pam stuff works. if [ -f etc/pam.d/gdm ]; then $SUDO mv etc/pam.d/gdm tmp/gdm #Need to keep pam/gdm $SUDO rm etc/pam.d/* $SUDO mv tmp/gdm etc/pam.d/gdm else $SUDO rm etc/pam.d/* fi echo Making one line changes to configuration files.. addline etc/fstab "/dev/ubd/0 / ext2 defaults 1 1" addline etc/fstab "/proc /proc proc defaults" addline etc/fstab "devpts /dev/pts devpts mode=0622 0 0" addline etc/fstab "/dev/ubd/1 none swap sw" addline etc/hosts "127.0.0.1 localhost" delline etc/inittab "1:2345:respawn:/sbin/mingetty tty1" delline etc/inittab "2:2345:respawn:/sbin/mingetty tty2" delline etc/inittab "3:2345:respawn:/sbin/mingetty tty3" delline etc/inittab "4:2345:respawn:/sbin/mingetty tty4" delline etc/inittab "5:2345:respawn:/sbin/mingetty tty5" delline etc/inittab "6:2345:respawn:/sbin/mingetty tty6" addline etc/inittab "0:2345:respawn:/sbin/mingetty ttys/0" addline etc/inittab "1:2345:respawn:/sbin/mingetty ttys/1" addline etc/inittab "2:2345:respawn:/sbin/mingetty ttys/2" addline etc/inittab "c:2345:respawn:/sbin/mingetty serial/0" #addline etc/issue "Welcome to the user-mode kernel." addline etc/issue "Unauthorized access to this system is strictly prohibited." addline etc/issue.net "Unauthorized access to this system is strictly prohibited." if [ -f etc/pam.d/ftp ]; then delline etc/pam.d/ftp "auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed" delline etc/pam.d/ftp "auth required /lib/security/pam_pwdb.so shadow nullok" delline etc/pam.d/ftp "auth required /lib/security/pam_shells.so" delline etc/pam.d/ftp "account required /lib/security/pam_pwdb.so" delline etc/pam.d/ftp "session required /lib/security/pam_pwdb.so" fi addline etc/pam.d/ftp "#%PAM-1.0" addline etc/pam.d/ftp "auth required pam_unix_auth.so" addline etc/pam.d/ftp "account required pam_unix_acct.so" addline etc/pam.d/ftp "password required pam_unix_passwd.so" addline etc/pam.d/ftp "session required pam_unix_session.so" if [ -f etc/pam.d/other ]; then delline etc/pam.d/other "auth required /lib/security/pam_deny.so" delline etc/pam.d/other "account required /lib/security/pam_deny.so" delline etc/pam.d/other "password required /lib/security/pam_deny.so" delline etc/pam.d/other "session required /lib/security/pam_deny.so" fi addline etc/pam.d/other "#%PAM-1.0" addline etc/pam.d/other "auth required pam_unix_auth.so" addline etc/pam.d/other "account required pam_unix_acct.so" addline etc/pam.d/other "password required pam_unix_passwd.so" addline etc/pam.d/other "session required pam_unix_session.so" substline etc/rc.d/rc.local "\(^[^#].*\)" "#\1" #Translation: add a # in front of all lines that don't have one. #The following two lines are not needed with the new (6/2001) networking, at least the ethertap version. #addline etc/rc.d/rc.sysinit "/sbin/ifconfig eth0 arp" #addline etc/rc.d/rc.sysinit "/sbin/um_eth_net_set eth0 100" #default addline etc/securetty "cua0" addline etc/securetty "tty0" addline etc/securetty "ttys/0" addline etc/securetty "ttys/1" addline etc/securetty "ttys/2" addline etc/sysconfig/keyboard "KEYTABLE=" addline etc/sysconfig/network "NETWORKING=yes" addline etc/sysconfig/network "FORWARD_IPV4=false" addline etc/sysconfig/network-scripts/ifcfg-eth0 "DEVICE=eth0" addline etc/sysconfig/network-scripts/ifcfg-eth0 "ONBOOT=YES" $SUDO mkdir --parents home/httpd/html $SUDO mkdir --parents dev/ubd echo -n Making /dev/ubd/ for MINOR in `seq 0 7` ; do echo -n $MINOR... $SUDO mknod --mode=660 dev/ubd/$MINOR b 98 $MINOR $SUDO chown root.disk dev/ubd/$MINOR done echo Done! echo Adding accounts and passwords. for ONEUSER in root user guest ; do if [ "$ONEUSER" = "root" ]; then HOMEDIR="root" else HOMEDIR="home/$ONEUSER" $SUDO chroot . adduser $ONEUSER fi $SUDO mkdir $HOMEDIR/.ssh $SUDO chmod 700 $HOMEDIR/.ssh $SUDO touch $HOMEDIR/.ssh/authorized_keys $SUDO chmod 600 $HOMEDIR/.ssh/authorized_keys $SUDO touch $HOMEDIR/.Xclients $SUDO chmod 755 $HOMEDIR/.Xclients addline $HOMEDIR/.Xclients '#!/bin/bash' addline $HOMEDIR/.Xclients 'xterm &' if [ -f usr/bin/panel ]; then addline $HOMEDIR/.Xclients 'panel &' fi if [ -f usr/bin/enlightenment ]; then addline $HOMEDIR/.Xclients 'exec enlightenment' elif [ -f usr/X11R6/bin/fvwm2 ]; then addline $HOMEDIR/.Xclients 'exec fvwm' elif [ -f usr/X11R6/bin/twm ]; then addline $HOMEDIR/.Xclients 'exec twm' fi $SUDO chroot . chown $ONEUSER.$ONEUSER $HOMEDIR/.ssh $HOMEDIR/.ssh/authorized_keys $HOMEDIR/.Xclients done #How to set them manually. #echo spleenmaster | $SUDO chroot . usr/bin/passwd --stdin root #echo corbathegreek | $SUDO chroot . usr/bin/passwd --stdin user #echo chompinatthesavoy | $SUDO chroot . usr/bin/passwd --stdin guest for ONEUSER in root user guest ; do #Tough passwords ;-), but... echo $ONEUSER | $SUDO chroot . usr/bin/passwd --stdin $ONEUSER done $SUDO chroot . pwconv for ONEUSER in root user guest ; do #... make them set new ones on login. $SUDO chroot . chage -d 1 $ONEUSER ; $SUDO chroot . chage -M 180 $ONEUSER done #Make the /lib/modules/2.9.77/ directory before the depmod section so it's there when depmod needs it. #Do not make into one line; the backslash-newline at the end of the first line is needed to separate the two lines in rc.sysinit. substline etc/rc.d/rc.sysinit '\(.*\-x /sbin/depmod.*\)' 'if [ ! -d /lib/modules/`/bin/uname -r` ]; then /bin/mkdir /lib/modules/`/bin/uname -r` ; fi\ \1' if [ -f etc/rc.d/init.d/httpd ]; then addline home/httpd/html/index.html "WelcomeI thought I'd put something here!" fi if [ -f etc/rc.d/init.d/innd ]; then if [ ! -d usr/lib/news ]; then $SUDO mkdir usr/lib/news fi #$SUDO chown news.news usr/lib/news #? addline etc/services "actived 1119/udp" fi if [ -f usr/X11R6/bin/Xnest ]; then cd etc/X11 $SUDO ln -sf ../../usr/X11R6/bin/Xnest X cd ../.. fi if [ -f etc/X11/gdm/gdm.conf ]; then substline etc/X11/gdm/gdm.conf '0=/usr/bin/X11/X' '0=/usr/bin/X11/Xnest -display xdisplay:0' fi if [ -f etc/X11/prefdm ]; then substline etc/X11/prefdm 'fexit 1' 'exit 1' fi echo Set some basic networking information. The SysV init script will replace these values if called with a \"reload\" parameter. #FIXME - Macaddr no longer used case $DIST in ca24) UMLIP="192.168.0.101" HOSTNAME="caldera24.goober.org" MACADDR="FE:FD:C0:A8:0:65" ;; co51) UMLIP="192.168.0.111" HOSTNAME="connectiva51.goober.org" MACADDR="FE:FD:C0:A8:0:6F" ;; co60) UMLIP="192.168.0.112" HOSTNAME="connectiva60.goober.org" MACADDR="FE:FD:C0:A8:0:70" ;; co70) UMLIP="192.168.0.113" HOSTNAME="connectiva70.goober.org" MACADDR="FE:FD:C0:A8:0:71" ;; im62) UMLIP="192.168.0.121" HOSTNAME="immunix62.goober.org" MACADDR="FE:FD:C0:A8:0:79" ;; md71) UMLIP="192.168.0.131" HOSTNAME="mandrake71.goober.org" MACADDR="FE:FD:C0:A8:0:83" ;; md80) UMLIP="192.168.0.132" HOSTNAME="mandrake80.goober.org" MACADDR="FE:FD:C0:A8:0:84" ;; md81) UMLIP="192.168.0.133" HOSTNAME="mandrake81.goober.org" MACADDR="FE:FD:C0:A8:0:85" ;; rh62) UMLIP="192.168.0.141" HOSTNAME="redhat62.goober.org" MACADDR="FE:FD:C0:A8:0:8D" ;; rh70) UMLIP="192.168.0.142" HOSTNAME="redhat70.goober.org" MACADDR="FE:FD:C0:A8:0:8E" ;; rh71) UMLIP="192.168.0.143" HOSTNAME="redhat71.goober.org" MACADDR="FE:FD:C0:A8:0:8F" ;; rh72) UMLIP="192.168.0.144" HOSTNAME="redhat72.goober.org" MACADDR="FE:FD:C0:A8:0:90" ;; *) UMLIP="192.168.0.250" HOSTNAME="uml-test.goober.org" MACADDR="FE:FD:C0:A8:0:FA" ;; esac GATEWAYIP="192.168.0.254" NETMASK="255.255.255.0" #addline etc/hosts "$UMLIP $HOSTNAME" addline etc/hosts "192.168.0.101 caldera24 caldera24.goober.org" addline etc/hosts "192.168.0.111 conectiva51 connectiva51.goober.org" addline etc/hosts "192.168.0.112 conectiva60 connectiva60.goober.org" addline etc/hosts "192.168.0.113 conectiva70 connectiva70.goober.org" addline etc/hosts "192.168.0.121 immunix62 immunix62.goober.org" addline etc/hosts "192.168.0.131 mandrake71 mandrake71.goober.org" addline etc/hosts "192.168.0.132 mandrake80 mandrake80.goober.org" addline etc/hosts "192.168.0.133 mandrake81 mandrake81.goober.org" addline etc/hosts "192.168.0.141 redhat62 redhat62.goober.org" addline etc/hosts "192.168.0.142 redhat70 redhat70.goober.org" addline etc/hosts "192.168.0.143 redhat71 redhat71.goober.org" addline etc/hosts "192.168.0.250 uml-test uml-test.goober.org" addline etc/hosts "$GATEWAYIP router xdisplay" #addline etc/rc.d/rc.sysinit "/sbin/ifconfig eth0 hw ether $MACADDR" addline etc/resolv.conf "nameserver $GATEWAYIP" addline etc/sysconfig/network "HOSTNAME=$HOSTNAME" addline etc/sysconfig/network-scripts/ifcfg-eth0 "IPADDR=$UMLIP" addline etc/sysconfig/network-scripts/ifcfg-eth0 "GATEWAY=$GATEWAYIP" addline etc/sysconfig/network-scripts/ifcfg-eth0 "NETMASK=$NETMASK" addline etc/sysconfig/network-scripts/ifcfg-eth0 "NETWORK=`networkof $UMLIP $NETMASK`" addline etc/sysconfig/network-scripts/ifcfg-eth0 "BROADCAST=`broadcastof $UMLIP $NETMASK`" addline etc/sysconfig/static-routes "any host $GATEWAYIP dev eth0" addline etc/sysconfig/static-routes "any net 0.0.0.0 netmask 0.0.0.0 gw $GATEWAYIP" if [ -f etc/squid/squid.conf ]; then addline etc/squid/squid.conf "acl localnet src $GATEWAYIP" delline etc/squid/squid.conf "http_access deny all" addline etc/squid/squid.conf "http_access allow localnet" addline etc/squid/squid.conf "http_access deny all" #Order is important... addline etc/services "squid 3128/tcp" addline etc/services "squid-snmp 3401/udp" fi if [ -f etc/sendmail.cf ]; then addline etc/services "sendmail-aux 587/tcp" #SSL? fi #UML uses a different console. substline etc/rc.d/rc.sysinit ' /dev/tty0 ' ' /dev/ttys/0 ' substline etc/rc.d/init.d/keytable ' /dev/tty0' ' /dev/ttys/0' #Earlier initscripts miss a "]": substline etc/rc.d/init.d/network '${gateway##\[0-9}' '${gateway##\[0-9\]}' #Initscripts 5.39 seems to have the "${bogus}" = "gw" test wrong; I think it should be ! "${bogus}" = "gw". substline etc/rc.d/init.d/network '\[ "${bogus' '\[ ! "${bogus' echo -n "Enabling services: " for SERVICE in httpd identd inetd innd named portmap sendmail smb snmpd ssh squid ; do if [ -f etc/rc.d/init.d/$SERVICE ]; then echo -n "$SERVICE..." if [ -f sbin/chkconfig ]; then $SUDO chroot . chkconfig $SERVICE on else echo This distribution doesn\'t have chkconfig - you\'ll have to initialize $SERVICE by hand. fi fi done echo Done! echo Removing other locales... if cd usr/share/locale ; then for ONELANG in * ; do if [ -d "$ONELANG" ]; then if [ "$ONELANG" != "en_US" ]; then echo -n "$ONELANG"... $SUDO rm -rf "$ONELANG" fi fi done echo Done! cd ../../.. else echo Unable to change to usr/share/locale fi #echo Zeroing out the rest of the filesystem... #$SUDO dd if=dev/zero of=tmp/allzeros bs=1024 2>/dev/null #$SUDO rm -f tmp/allzeros df . cd .. [ ! -d $FSFILE ] && $SUDO umount $MNTDIR || exit 1 #echo Making sparse... #cp -pf --sparse=always $FSFILE $FSFILE.sparse #mv -f $FSFILE.sparse $FSFILE echo All set!