#!/bin/ksh # # Red Hat 6.x Installer for lxrun # # Copyright (C) 1999 Steven Ginzburg. # All rights reserved. # # This software is provided "as is" without express or implied warranty. # # # Changelog: # --------- # Oct 27 1999 SG - Initial Revision (OSR5 only). # Oct 29 1999 SG - Adjusted things to work with Solaris. # Added sh-utils, fileutils to PACKAGES list. # Nov 10 1999 SG - Clean-ups and fixes suggested by John Polstra. # Added several new PACKAGES. # Dec 16 1999 RD - UnixWare 7 port # Dec 16 1999 JP - Fixed an inaccuracy in final instructions # Dec 26 1999 SG - More minor clean-ups # # SG = Steven Ginzburg # RD = Ranjit Deshpande # JP = John Polstra function abort { echo $@ exit 255 } case `uname -s` in SCO_SV) # OpenServer 5.0.x # Default CD-ROM device DEFCD=/dev/cd0 # Libraries required by lxrun LXRUN_LIBS="/usr/lib/libc.so.1 /usr/lib/libsocket.so.1 /usr/lib/libnsl.so" # mount/umount commands MOUNT=/etc/mount UMOUNT=/etc/umount # Get user ID uid=`id -u` # Default PATHMAP location PATHMAP_DIR= # root directory of LINUX_ROOT PATHMAP_FULL="\$root/PATHMAP" # full path to PATHMAP ;; UnixWare) # UnixWare 7.x # Default CD-ROM device DEFCD=/dev/cdrom/cdrom1 # Libraries required by lxrun LXRUN_LIBS="/usr/lib/libc.so.1 /usr/lib/libsocket.so.1 /usr/lib/libnsl.so" # mount/umount commands MOUNT="/sbin/mount -F cdfs -r " UMOUNT=/sbin/umount # Get user ID uid=`id -u` # Default PATHMAP location PATHMAP_DIR= # root directory of LINUX_ROOT PATHMAP_FULL="\$root/PATHMAP" # full path to PATHMAP ;; UNIX_SV) # UnixWare 2.x abort "This utility has not been ported to UnixWare 2 yet." ;; SunOS) # Solaris # Default CD-ROM device DEFCD=/vol/dev/dsk/c1t0d0/cdrom # Libraries required by lxrun LXRUN_LIBS="/usr/lib/libmapmalloc.so.1 /usr/lib/libc.so.1 /usr/lib/libnsl.so.1 /usr/lib/libsocket.so.1 /usr/lib/libdl.so.1 /usr/lib/libmp.so.2 /usr/lib/ld.so.1 /usr/lib/libthread.so.1 /usr/lib/librt.so.1 /usr/lib/libaio.so.1 /usr/lib/libmd5.so.1" # mount/umount commands MOUNT="/usr/sbin/mount -r -F hsfs" UMOUNT="/usr/sbin/umount" echo "\nWARNING: You are running Solaris. Please make sure that vold is disabled.\n" # Get user ID uid=`id | awk '{ print $1 }' | tr -cd 0-9` # Default PATHMAP location PATHMAP_DIR=usr/local/lxrun # Dir relative to $root PATHMAP_FULL=/usr/local/lxrun/PATHMAP # Full path ;; *) abort "You are running an unknown system! Aborting." ;; esac DEFROOT=/lx TEMP_MNT=/tmp/lx$$ LOG=/tmp/lxlog.$$ RPMINST="--ignoreos --ignorearch --nodeps -i" PACKAGES="setup filesystem basesystem ld.so ldconfig glibc termcap mktemp libtermcap bash glib libstdc++ info grep XFree86-libs libpng ncurses ncurses3 gtk+ glib10 gtk+10 libjpeg libtiff libgr libungif libghttp libxml gimp-libgimp fileutils sh-utils diffutils textutils gawk rpm Xaw3d libc compat-glibc xpm gdbm sed less tar ed findutils" # ask "question" var default function ask { echo "\n$1 [$3]? \c" read tmp if [ "$tmp" = "" ]; then tmp=$3 fi eval "$2=\"$tmp\"" } function doit { echo "\t$@" eval $@ tmp=$? if [ $tmp != 0 ]; then echo "ERROR: Exit value $tmp...ABORTING." exit $tmp fi } function doit_quietly { echo \$ $@ >> $LOG eval $@ >> $LOG 2>&1 if [ $? != 0 ]; then echo "POSSIBLE ERROR" else echo "OK" fi } function create_PATHMAP { # /usr/X11R6/lib/X11/locale /usr/lib/X11/locale cat < $1 + - /lib + /usr + /bin + /etc + /var + //var + /sbin + /opt + ! } intr=`stty -a | grep intr | sed -e 's/.*intr = //' | sed -e 's/;.*//'` cat < $root/etc/mtab" doit mkdir -p $root/usr/X11R6/lib/X11 echo "Creating install mount point under $root..." doit mkdir $root/mnt_inst echo "Remounting the CD under $root..." doit $MOUNT $cdnode $root/mnt_inst RUNRPM="/mnt_inst/$redhat/instimage/usr/bin/rpm" echo "Initializing rpm database..." doit $LXRUN $RUNRPM --initdb echo "Installing packages..." for i in $PACKAGES do rpm=`basename $root/mnt_inst/$rpmdir/$i-[0-9]*.rpm` echo "\t$rpm...\c" if [ ! -r $root/mnt_inst/$rpmdir/$rpm ]; then echo "MISSING" else doit_quietly $LXRUN $RUNRPM $RPMINST /mnt_inst/$rpmdir/$rpm fi done echo "Unmounting the CD..." doit $UMOUNT $cdnode echo "Cleaning up Linux environment..." doit rmdir $root/mnt_inst doit rm -rf $root/modules for i in $LXRUN_LIBS do doit rm -f $root$i done ### ### # $root/usr/lib/libnsl.so was deleted if it was in $LXRUN_LIBS # so we must replace it with a link to the Linux libnsl.so.1 if [ ! -e $root/usr/lib/libnsl.so ]; then doit ln -s ../../lib/libnsl.so.1 $root/usr/lib/libnsl.so fi ### ### doit rm -f $root/lxrun $root/$PATHMAP_DIR/PATHMAP echo "Creating PATHMAP file..." PATHMAP=`eval echo $PATHMAP_FULL` if [ -e "$PATHMAP" ]; then ask "$PATHMAP already exists. Overwrite" tmp n else tmp=y fi case $tmp in y|Y|yes|YES|Yes) echo "\t[$PATHMAP]" create_PATHMAP $PATHMAP ;; *) echo "\t[skipping PATHMAP creation]" ;; esac echo "Done!" cat <