home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- ####################################
- #Name : base_configure
- #
- #Description: To install a base linux system
- #
- #Copyright (C) 1999 Corel Corporation
- #
- # EXHIBIT A -Corel Public License.
- #
- # The contents of this file are subject to the Corel Public License
- # Version 1.0 (the "License"); you may not use this file except in
- # compliance with the License. You may obtain a copy of the License at
- # linux.corel.com/linuxproducts/corellinux/license.htm.
- # Software distributed under the License is distributed on an "AS IS"
- # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- # License for the specific language governing rights and limitations
- # under the License.
- # The Original Code is base_configure.
- # The Initial Developer of the Original Code is Corel Corporation.
- # Portions created by Corel are Copyright (C) 1999 All Rights Reserved.
- # Contributor(s): ______________________________________.
- ##############################################################
-
-
- #
- # Find the root device to install on as was chosen by the
- # user in the setup UI and saved in /etc/harddrive.inf
- #
- NUM_PARTITIONS=$( etcdev -f /etc/harddrive.inf -N )
- x=1
- xx=0 # counter for the custom mount points
- if [ ! -z "$NUM_PARTITIONS" ]; then
- while [ "$x" -le "$NUM_PARTITIONS" ]
- do
- DEV=$( etcdev -f /etc/harddrive.inf -n $x )
- x=$(($x+1)) # increment $x through each pass
- MOUNTYPE=$( etcdev -f /etc/harddrive.inf -c $DEV -t mount_type -G )
- TYPE=$( etcdev -f /etc/harddrive.inf -c $DEV -t type -G )
- MNTPNT=$( etcdev -f /etc/harddrive.inf -c $DEV -t mount_point -G )
- if [ "$MOUNTYPE" = "root" ]
- then
- ROOT=$DEV
- fi
- if [ "$TYPE" = "0x82" ]
- then
- export SWAP=$DEV
- fi
-
- # Add the devices that need to be mounted in /target, to an array
- if [ "$TYPE" = "0x83" ] && [ $( echo $MNTPNT | grep '^/' ) ]
- then
- MOUNTS[$xx]=$DEV
- xx=$(($xx+1))
- fi
- done
- else
- echo "Can't get NUM_PARTITIONS!";
- fi
-
- #
- # Mount target installation drive and activate swap partition
- #
- if [ ! -z $ROOT ]; then
- if [ ! -z $SWAP ] ; then
- grep -w $SWAP /proc/swaps > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- /instmnt/live/sbin/swapon $SWAP
- fi
- fi
- /instmnt/live/bin/mount -t ext2 $ROOT /target
- else
- echo "Can't mount to /target!"
- exit
- fi
-
- # Mount the other ext2 partitions before installing base
- for i in "${MOUNTS[@]}"; do
- MNTPNT=$( etcdev -f /etc/harddrive.inf -c $i -t mount_point -G )
- mkdir /target$MNTPNT
- mount -t ext2 $i /target$MNTPNT
- done
-
- #
- # Install base system to the /target drive
- #
- cd /target
- bzip2 -dc /instmnt/live/target.bz2 | cpio -id > /dev/null 2>&1
-
- cd /target
- /bin/chroot /target ln -s boot/vmlinuz-2.2.* vmlinuz-debug
- /bin/chroot /target ln -s boot/vmlinuz-2.2.* vmlinuz
-
- sleep 1
- sync
- sync
-
- #
- # Copy devices harddrive.inf to the new target drive
- #
- cp /etc/devices /target/etc/
- cp /etc/harddrive.inf /target/etc/
-
- # Create /etc/lilo.conf, /etc/lilop.conf and /etc/fstab and runs lilo
- # Do above unless there is something attached to /dev/loop1
- # In that case we are running loop device install
- skipfooze=`losetup /dev/loop1`
- if [ "$skipfooze" == "" ]
- then
- /bin/chroot /target /sbin/fooze
- else
- /bin/chroot /target /sbin/fooze -F
- fi
-
- # Setup the symlinks for the mouse and cdrom devices
- cp -a /dev/mouse /target/dev
-
- #
- # Setup sound on users system
- #
- # copy over the no sound temp file if user selects to not configure sound.
- cp /tmp/no_sound /target/tmp/no_sound > /dev/null 2>&1
- # copy over the category file so that we know what version {deluxe, standard...} we're installing.
- cp /var/lib/corel_setup/category /target/var/lib/corel_setup
- # configure sound or not(test is in sound_setup script).
- /bin/chroot /target /sbin/sound_setup
-
- #
- # Setup X configuration utilities.
- #
- # chmod ...xconf family
- /bin/chroot /target /bin/chmod 4755 /sbin/{testxconf,setxconf,buildxconf}
-
- #
- # Need to mount the cdrom from the chroot environment
- #
- /bin/losetup /dev/loop0 $CDROM_DEV
- cd /target
- # Do not use /mnt or /cdrom as mount points some packages use these during installation
- /bin/chroot /target mount dev/loop0 /tmp/cdrom
- /bin/chroot /target mount -t proc /proc /proc
-
-
-
-
-
-