| 15 | beyerle@PS | 1 | #!/bin/bash
 | 
        
           |  |  | 2 | #
 | 
        
           |  |  | 3 | ###############################################################
 | 
        
           |  |  | 4 | #
 | 
        
           |  |  | 5 | # Installes the LiveCD on local harddisk
 | 
        
           |  |  | 6 | # 
 | 
        
           |  |  | 7 | # Boot LiveCD and run this script as root
 | 
        
           |  |  | 8 | #
 | 
        
           |  |  | 9 | # Urs Beyerle, PSI
 | 
        
           |  |  | 10 | #
 | 
        
           |  |  | 11 | ###############################################################
 | 
        
           |  |  | 12 |   | 
        
           |  |  | 13 |   | 
        
           |  |  | 14 | ###############################################################
 | 
        
           |  |  | 15 | # Definitions
 | 
        
           |  |  | 16 | ###############################################################
 | 
        
           |  |  | 17 |   | 
        
           | 32 | beyerle@PS | 18 | # set PATH
 | 
        
           |  |  | 19 | PATH="/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin"
 | 
        
           |  |  | 20 |   | 
        
           | 29 | beyerle@PS | 21 | # RPMs that are no longer needed and can break future udpates
 | 
        
           |  |  | 22 | RPMS_TO_REMOVE="kernel-module-squashfs \
 | 
        
           |  |  | 23 |                 kernel-module-unionfs \
 | 
        
           |  |  | 24 |                 unionfs \
 | 
        
           |  |  | 25 |                 squashfs"
 | 
        
           |  |  | 26 |   | 
        
           | 30 | beyerle@PS | 27 | # RPMs that can break future Scientific Linux updates
 | 
        
           | 29 | beyerle@PS | 28 | # because there are not part of Scientific Linux
 | 
        
           |  |  | 29 | RPMS_TO_REMOVE_SL="kernel-module-ntfs"
 | 
        
           |  |  | 30 |   | 
        
           | 30 | beyerle@PS | 31 | # RPMs that can break future PSI SL updates
 | 
        
           | 29 | beyerle@PS | 32 | # because there are not part of PSI Scientific Linux
 | 
        
           |  |  | 33 | RPMS_TO_REMOVE_PSI=""
 | 
        
           |  |  | 34 |   | 
        
           | 15 | beyerle@PS | 35 | # files which should be restored from .ori files
 | 
        
           |  |  | 36 | FILES_RESTORE="/etc/init.d/netfs \
 | 
        
           |  |  | 37 |            /etc/init.d/autofs \
 | 
        
           |  |  | 38 |            /etc/init.d/halt \
 | 
        
           |  |  | 39 |            /etc/init.d/network
 | 
        
           |  |  | 40 |            /etc/init.d/functions \
 | 
        
           |  |  | 41 |            /etc/rc.d/rc.sysinit \
 | 
        
           |  |  | 42 |            /etc/sysconfig/afs \
 | 
        
           |  |  | 43 |            /etc/motd \
 | 
        
           |  |  | 44 |            /etc/redhat-release \
 | 
        
           | 29 | beyerle@PS | 45 | 	   /etc/rc.d/rc.local"
 | 
        
           | 15 | beyerle@PS | 46 |   | 
        
           | 16 | beyerle@PS | 47 | LIVECD_INIT_SCRIPTS="runfirst \
 | 
        
           |  |  | 48 |                     runveryfirst \
 | 
        
           |  |  | 49 |                     runlast \
 | 
        
           |  |  | 50 |                     kudzu-auto"
 | 
        
           | 15 | beyerle@PS | 51 |   | 
        
           |  |  | 52 | # Main directories which should be not be copied
 | 
        
           | 16 | beyerle@PS | 53 | DIR_NOT_COPY="/proc \
 | 
        
           |  |  | 54 |               /dev \
 | 
        
           |  |  | 55 |               /livecd \
 | 
        
           |  |  | 56 |               /boot \
 | 
        
           |  |  | 57 |               /afs \
 | 
        
           |  |  | 58 |               /sys \
 | 
        
           |  |  | 59 |               /mnt \
 | 
        
           |  |  | 60 |               /media"
 | 
        
           | 15 | beyerle@PS | 61 |   | 
        
           |  |  | 62 | # Mount point of the new SL system
 | 
        
           |  |  | 63 | NEW=/mnt/harddisk
 | 
        
           |  |  | 64 |   | 
        
           | 21 | beyerle@PS | 65 | # Name of the script
 | 
        
           | 15 | beyerle@PS | 66 | SCRIPTNAME=$( basename $0 )
 | 
        
           |  |  | 67 |   | 
        
           | 16 | beyerle@PS | 68 |   | 
        
           |  |  | 69 |   | 
        
           | 21 | beyerle@PS | 70 |   | 
        
           | 15 | beyerle@PS | 71 | ###############################################################
 | 
        
           |  |  | 72 | # Functions
 | 
        
           |  |  | 73 | ###############################################################
 | 
        
           |  |  | 74 |   | 
        
           |  |  | 75 | function usage() {
 | 
        
           |  |  | 76 |   | 
        
           |  |  | 77 |    ## Usage
 | 
        
           |  |  | 78 |    # ----------------------------------------------------------
 | 
        
           |  |  | 79 |   | 
        
           |  |  | 80 |    cat <<EOF
 | 
        
           | 21 | beyerle@PS | 81 |   | 
        
           | 22 | beyerle@PS | 82 |   $SCRIPTNAME [OPTIONS] -mbr=[DEVICE] [PARTITION]
 | 
        
           | 15 | beyerle@PS | 83 |   | 
        
           | 26 | beyerle@PS | 84 |     Installes LiveCD on PARTITION and the bootloader grub into 
 | 
        
           |  |  | 85 |     the Master Boot Record (MBR) of DEVICE. The MBR will be 
 | 
        
           |  |  | 86 |     backed up to PARTITION.
 | 
        
           | 15 | beyerle@PS | 87 |   | 
        
           | 21 | beyerle@PS | 88 |   OPTIONS:
 | 
        
           | 15 | beyerle@PS | 89 |   | 
        
           | 26 | beyerle@PS | 90 |     -h   --help         Print this screen
 | 
        
           |  |  | 91 |     -swap=[partition]   Use [partition] as swap
 | 
        
           |  |  | 92 |     -win=[partition]    Your active Windows partition. If not given, 
 | 
        
           | 22 | beyerle@PS | 93 |                         $SCRIPTNAME tries to find it
 | 
        
           | 26 | beyerle@PS | 94 |     -nogrub             Do not install grub. You have to install 
 | 
        
           |  |  | 95 |                         manually a bootloader (not recommended)
 | 
        
           |  |  | 96 |     -floppy             Needed, if grub should be installed on floppy
 | 
        
           | 31 | beyerle@PS | 97 |                         In this case use -mbr=/dev/fd0 -floppy
 | 
        
           | 29 | beyerle@PS | 98 |     -norpmremove        Do not remove RPMs that break future updates 
 | 
        
           |  |  | 99 |                         (not recommended)
 | 
        
           | 26 | beyerle@PS | 100 |     -y                  Answer all questions with yes
 | 
        
           | 15 | beyerle@PS | 101 |   | 
        
           | 21 | beyerle@PS | 102 |   Example:
 | 
        
           |  |  | 103 |   | 
        
           | 22 | beyerle@PS | 104 |   $SCRIPTNAME -swap=/dev/sda3 -mbr=/dev/sda /dev/sda2
 | 
        
           | 21 | beyerle@PS | 105 |   | 
        
           |  |  | 106 |     Will install LiveCD on /dev/sda2 (= second partition on 
 | 
        
           |  |  | 107 |     first SATA disk). All data on /dev/sda2 will be deleted.
 | 
        
           |  |  | 108 |     /dev/sda3 has to be a Linux Swap partion. GRUB will be 
 | 
        
           |  |  | 109 |     installed in the MBR of /dev/sda (= first SATA disk).
 | 
        
           |  |  | 110 |   | 
        
           | 31 | beyerle@PS | 111 |   Remarks:
 | 
        
           |  |  | 112 |   | 
        
           |  |  | 113 |     To display your hard disk partitions, user 'fdisk -l'.
 | 
        
           |  |  | 114 |     Use fdisk, qtparted or parted to create an empty Linux
 | 
        
           |  |  | 115 |     partition.
 | 
        
           |  |  | 116 |   | 
        
           | 15 | beyerle@PS | 117 | EOF
 | 
        
           |  |  | 118 | }
 | 
        
           |  |  | 119 |   | 
        
           |  |  | 120 |   | 
        
           | 21 | beyerle@PS | 121 | function exit_now() {
 | 
        
           |  |  | 122 |   | 
        
           |  |  | 123 |     local exitcode=$1
 | 
        
           |  |  | 124 |     umount $INSTALL_PART 2>/dev/null
 | 
        
           |  |  | 125 |     exit $exitcode
 | 
        
           |  |  | 126 | }
 | 
        
           |  |  | 127 |   | 
        
           |  |  | 128 |   | 
        
           |  |  | 129 |   | 
        
           | 15 | beyerle@PS | 130 | ###############################################################
 | 
        
           |  |  | 131 | # Main
 | 
        
           |  |  | 132 | ###############################################################
 | 
        
           |  |  | 133 |   | 
        
           | 16 | beyerle@PS | 134 | ### are we root?
 | 
        
           |  |  | 135 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 136 | if [ "$( whoami )" != "root" ]; then
 | 
        
           | 31 | beyerle@PS | 137 |     echo; echo "Please run this script as root: 'su - -c $SCRIPTNAME'"; echo
 | 
        
           | 21 | beyerle@PS | 138 |     exit_now 1
 | 
        
           | 15 | beyerle@PS | 139 | fi
 | 
        
           |  |  | 140 |   | 
        
           | 16 | beyerle@PS | 141 |   | 
        
           | 15 | beyerle@PS | 142 | ### read options from command-line
 | 
        
           | 16 | beyerle@PS | 143 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 144 | while [ $# -gt 0 ]; do
 | 
        
           |  |  | 145 |   | 
        
           |  |  | 146 |     case "$1" in
 | 
        
           |  |  | 147 |        -h)
 | 
        
           | 21 | beyerle@PS | 148 |             usage; exit_now;;
 | 
        
           | 22 | beyerle@PS | 149 |   | 
        
           | 21 | beyerle@PS | 150 |        --help)
 | 
        
           |  |  | 151 |             usage; exit_now;;
 | 
        
           | 22 | beyerle@PS | 152 |   | 
        
           | 24 | beyerle@PS | 153 |        -swap*)
 | 
        
           | 22 | beyerle@PS | 154 |            if echo $1 | grep -q '=' ; then
 | 
        
           |  |  | 155 | 	       SWAP_PART=$( echo $1 | sed 's/^-swap=//' )
 | 
        
           |  |  | 156 | 	   else
 | 
        
           |  |  | 157 | 	       shift
 | 
        
           | 24 | beyerle@PS | 158 |                SWAP_PART=$1
 | 
        
           | 22 | beyerle@PS | 159 | 	   fi
 | 
        
           |  |  | 160 | 	   shift; continue;;
 | 
        
           |  |  | 161 |   | 
        
           | 24 | beyerle@PS | 162 |        -mbr*)
 | 
        
           | 22 | beyerle@PS | 163 |            if echo $1 | grep -q '=' ; then
 | 
        
           |  |  | 164 | 	       MBR_DEV=$( echo $1 | sed 's/^-mbr=//' )
 | 
        
           |  |  | 165 | 	   else
 | 
        
           |  |  | 166 | 	       shift
 | 
        
           | 24 | beyerle@PS | 167 |                MBR_DEV=$1
 | 
        
           | 22 | beyerle@PS | 168 | 	   fi
 | 
        
           |  |  | 169 | 	   shift; continue;;
 | 
        
           |  |  | 170 |   | 
        
           | 24 | beyerle@PS | 171 |        -win*)
 | 
        
           | 22 | beyerle@PS | 172 |            if echo $1 | grep -q '=' ; then
 | 
        
           |  |  | 173 | 	       WIN_PART=$( echo $1 | sed 's/^-win=//' )
 | 
        
           |  |  | 174 | 	   else
 | 
        
           |  |  | 175 | 	       shift
 | 
        
           | 24 | beyerle@PS | 176 |                WIN_PART=$1
 | 
        
           | 22 | beyerle@PS | 177 | 	   fi
 | 
        
           |  |  | 178 | 	   shift; continue;;
 | 
        
           |  |  | 179 |   | 
        
           | 16 | beyerle@PS | 180 |        -nogrub)
 | 
        
           |  |  | 181 |             NOGRUB=$1; shift; continue;;
 | 
        
           | 22 | beyerle@PS | 182 |   | 
        
           | 29 | beyerle@PS | 183 |        -norpmremove)
 | 
        
           |  |  | 184 |             NORPMREMOVE=$1; shift; continue;;
 | 
        
           |  |  | 185 |   | 
        
           | 18 | beyerle@PS | 186 |        -floppy)
 | 
        
           |  |  | 187 |             FLOPPY=$1; shift; continue;;
 | 
        
           | 22 | beyerle@PS | 188 |   | 
        
           | 15 | beyerle@PS | 189 |        -y)
 | 
        
           |  |  | 190 |             YES=$1; shift; continue;;
 | 
        
           |  |  | 191 |   | 
        
           |  |  | 192 |        *)
 | 
        
           |  |  | 193 |             INSTALL_PART=$1; break;;
 | 
        
           |  |  | 194 |     esac
 | 
        
           |  |  | 195 |   | 
        
           |  |  | 196 | done
 | 
        
           |  |  | 197 | echo
 | 
        
           |  |  | 198 |   | 
        
           | 16 | beyerle@PS | 199 |   | 
        
           | 28 | beyerle@PS | 200 | ### display fdisk -l
 | 
        
           |  |  | 201 | ### -----------------------------------------------------------
 | 
        
           |  |  | 202 | echo "Output of 'fdisk -l' ..."
 | 
        
           |  |  | 203 | fdisk -l
 | 
        
           |  |  | 204 | echo
 | 
        
           |  |  | 205 |   | 
        
           |  |  | 206 |   | 
        
           | 30 | beyerle@PS | 207 | ### test if $INSTALL_PART is defined
 | 
        
           | 22 | beyerle@PS | 208 | ### -----------------------------------------------------------
 | 
        
           |  |  | 209 | if [ ! $INSTALL_PART ]; then
 | 
        
           |  |  | 210 |     echo "No partition defined for installation"
 | 
        
           | 30 | beyerle@PS | 211 |     echo "Please see '$SCRIPTNAME -h'"; echo
 | 
        
           | 22 | beyerle@PS | 212 |     exit_now 1
 | 
        
           |  |  | 213 | fi
 | 
        
           |  |  | 214 |   | 
        
           |  |  | 215 |   | 
        
           | 15 | beyerle@PS | 216 | ### test if MBR_DEV is given
 | 
        
           | 16 | beyerle@PS | 217 | ### -----------------------------------------------------------
 | 
        
           |  |  | 218 | if [ ! $NOGRUB ]; then
 | 
        
           |  |  | 219 |     if [ ! $MBR_DEV ]; then
 | 
        
           | 18 | beyerle@PS | 220 | 	echo "No MBR device defined."
 | 
        
           | 30 | beyerle@PS | 221 | 	echo "Please see '$SCRIPTNAME -h'"; echo
 | 
        
           | 21 | beyerle@PS | 222 | 	exit_now 1
 | 
        
           | 16 | beyerle@PS | 223 |     fi
 | 
        
           | 15 | beyerle@PS | 224 | fi
 | 
        
           |  |  | 225 |   | 
        
           | 16 | beyerle@PS | 226 |   | 
        
           | 15 | beyerle@PS | 227 | ### test if $INSTALL_PART exists
 | 
        
           | 16 | beyerle@PS | 228 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 229 | fdisk -l | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
 | 
        
           |  |  | 230 | if [ "$?" != "0" ]; then
 | 
        
           | 28 | beyerle@PS | 231 |     echo "Partition $INSTALL_PART not found! See 'fdisk -l'"
 | 
        
           | 30 | beyerle@PS | 232 |     echo "Or you have to reboot first to make the partition table active"; echo
 | 
        
           | 21 | beyerle@PS | 233 |     exit_now 1
 | 
        
           | 15 | beyerle@PS | 234 | fi
 | 
        
           |  |  | 235 |   | 
        
           | 16 | beyerle@PS | 236 |   | 
        
           | 30 | beyerle@PS | 237 | ### test if $INSTALL_PART is a Linux partition
 | 
        
           | 16 | beyerle@PS | 238 | ### -----------------------------------------------------------
 | 
        
           | 30 | beyerle@PS | 239 | fdisk -l | grep "Linux$" | cut -d" " -f1 | grep -q "^${INSTALL_PART}$"
 | 
        
           |  |  | 240 | if [ "$?" != "0" ]; then
 | 
        
           |  |  | 241 |     echo "Partition $INSTALL_PART is not a Linux partition! (see 'fdisk -l')"
 | 
        
           |  |  | 242 |     echo "Use fdisk and/or qtparted to create a Linux partition!"
 | 
        
           |  |  | 243 |     echo "You have to reboot first to make the partition table active"; echo
 | 
        
           |  |  | 244 |     exit_now 1
 | 
        
           |  |  | 245 | fi
 | 
        
           | 15 | beyerle@PS | 246 |   | 
        
           |  |  | 247 |   | 
        
           | 30 | beyerle@PS | 248 | ### test if $SWAP_PART exists and is a Linux Swap partition
 | 
        
           | 16 | beyerle@PS | 249 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 250 | if [ $SWAP_PART ]; then
 | 
        
           |  |  | 251 |     fdisk -l | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
 | 
        
           |  |  | 252 |     if [ "$?" != "0" ]; then
 | 
        
           | 28 | beyerle@PS | 253 | 	echo "Swap partition $SWAP_PART not found! (see 'fdisk -l')"
 | 
        
           |  |  | 254 | 	echo "Or you have to reboot first to make the partition table active"; echo
 | 
        
           | 21 | beyerle@PS | 255 | 	exit_now 1
 | 
        
           | 15 | beyerle@PS | 256 |     fi
 | 
        
           | 30 | beyerle@PS | 257 |     fdisk -l | grep "Linux swap$" | cut -d" " -f1 | grep -q "^${SWAP_PART}$"
 | 
        
           | 15 | beyerle@PS | 258 |     if [ "$?" != "0" ]; then
 | 
        
           | 28 | beyerle@PS | 259 | 	echo "Partition $SWAP_PART is not a Linux swap partition! (see 'fdisk -l')"
 | 
        
           | 30 | beyerle@PS | 260 | 	echo "Use fdisk and/or qtparted to create a Linux Swap partition!"
 | 
        
           | 28 | beyerle@PS | 261 | 	echo "You have to reboot first to make the partition table active"; echo
 | 
        
           | 21 | beyerle@PS | 262 | 	exit_now 1
 | 
        
           | 15 | beyerle@PS | 263 |     fi
 | 
        
           |  |  | 264 | fi
 | 
        
           |  |  | 265 |   | 
        
           |  |  | 266 |   | 
        
           | 30 | beyerle@PS | 267 | ### set $INSTALL_DEV (eg. /dev/sda)
 | 
        
           | 16 | beyerle@PS | 268 | ### -----------------------------------------------------------
 | 
        
           | 30 | beyerle@PS | 269 | INSTALL_DEV=$( echo "$INSTALL_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
 | 
        
           |  |  | 270 | INSTALL_PART_NR=$( echo "$INSTALL_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
 | 
        
           |  |  | 271 |   | 
        
           |  |  | 272 |   | 
        
           |  |  | 273 | ### print warning
 | 
        
           |  |  | 274 | ### -----------------------------------------------------------
 | 
        
           | 26 | beyerle@PS | 275 | echo                     "------------------------------------------------------------"
 | 
        
           |  |  | 276 | echo                     "   LiveCD will be installed on partition $INSTALL_PART"
 | 
        
           | 15 | beyerle@PS | 277 | [ "$SWAP_PART" ] && echo " Partition $SWAP_PART will be used as swap partition."
 | 
        
           | 26 | beyerle@PS | 278 | [ ! $NOGRUB ]    && echo " GRUB will be installed in Master Boot Record of $MBR_DEV"
 | 
        
           |  |  | 279 | echo                     "       !! All data on $INSTALL_PART will be lost !!"
 | 
        
           |  |  | 280 | echo                     "------------------------------------------------------------"
 | 
        
           | 15 | beyerle@PS | 281 | echo
 | 
        
           | 16 | beyerle@PS | 282 |   | 
        
           | 15 | beyerle@PS | 283 |   | 
        
           | 26 | beyerle@PS | 284 | ### continue?
 | 
        
           | 16 | beyerle@PS | 285 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 286 | if [ ! $YES ]; then
 | 
        
           |  |  | 287 |     echo -n "Continue (y/N)? "
 | 
        
           | 18 | beyerle@PS | 288 |     read key
 | 
        
           | 15 | beyerle@PS | 289 |     echo
 | 
        
           | 21 | beyerle@PS | 290 |     [ "$key" != "y" ] && exit_now 0
 | 
        
           | 15 | beyerle@PS | 291 | fi
 | 
        
           |  |  | 292 |   | 
        
           |  |  | 293 |   | 
        
           | 26 | beyerle@PS | 294 | ### format $SWAP_PART
 | 
        
           | 21 | beyerle@PS | 295 | ### -----------------------------------------------------------
 | 
        
           | 26 | beyerle@PS | 296 | if [ $SWAP_PART ]; then
 | 
        
           |  |  | 297 |     echo "Make swap on $SWAP_PART ..."
 | 
        
           |  |  | 298 |     mkswap $SWAP_PART
 | 
        
           | 24 | beyerle@PS | 299 |     echo
 | 
        
           |  |  | 300 | fi
 | 
        
           | 21 | beyerle@PS | 301 |   | 
        
           |  |  | 302 |   | 
        
           | 15 | beyerle@PS | 303 | ### format $INSTALL_PART
 | 
        
           | 16 | beyerle@PS | 304 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 305 | echo -n "Format $INSTALL_PART, please wait ... " 
 | 
        
           | 21 | beyerle@PS | 306 | mkfs.ext3 -q $INSTALL_PART || exit_now 1
 | 
        
           | 15 | beyerle@PS | 307 | echo "done."; echo
 | 
        
           |  |  | 308 |   | 
        
           |  |  | 309 |   | 
        
           |  |  | 310 | ### mount $INSTALL_PART
 | 
        
           | 16 | beyerle@PS | 311 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 312 | echo -n "Try to mount $INSTALL_PART to $NEW ... "
 | 
        
           |  |  | 313 | mkdir -p $NEW
 | 
        
           | 21 | beyerle@PS | 314 | mount $INSTALL_PART $NEW || exit_now 1
 | 
        
           | 15 | beyerle@PS | 315 | echo "done."; echo
 | 
        
           |  |  | 316 |   | 
        
           |  |  | 317 |   | 
        
           |  |  | 318 | ### copy root dirs
 | 
        
           | 16 | beyerle@PS | 319 | ### -----------------------------------------------------------
 | 
        
           | 26 | beyerle@PS | 320 | echo "Copy Live System to $INSTALL_PART ..."
 | 
        
           | 15 | beyerle@PS | 321 | root_dirs=$( ls / )
 | 
        
           |  |  | 322 | for dir in $root_dirs; do
 | 
        
           |  |  | 323 |     # check if dir is not in $DIR_NOT_COPY
 | 
        
           |  |  | 324 |     do_not_copy=""
 | 
        
           |  |  | 325 |     for not_dir in $DIR_NOT_COPY; do
 | 
        
           |  |  | 326 | 	if [ "$not_dir" = "/$dir" ]; then 
 | 
        
           |  |  | 327 | 	    do_not_copy="yes"
 | 
        
           |  |  | 328 | 	    break
 | 
        
           |  |  | 329 | 	fi
 | 
        
           |  |  | 330 |     done
 | 
        
           |  |  | 331 |     # do not copy links
 | 
        
           |  |  | 332 |     [ -L /$dir ] && do_not_copy="yes"
 | 
        
           |  |  | 333 |   | 
        
           | 21 | beyerle@PS | 334 |     fail=""
 | 
        
           | 15 | beyerle@PS | 335 |     if [ ! $do_not_copy ]; then
 | 
        
           |  |  | 336 | 	echo -n "  * Copy  /$dir ... "
 | 
        
           | 21 | beyerle@PS | 337 | 	cp -a /$dir $NEW || fail=true
 | 
        
           | 15 | beyerle@PS | 338 | 	echo "done."
 | 
        
           |  |  | 339 |     fi
 | 
        
           |  |  | 340 | done
 | 
        
           |  |  | 341 | echo
 | 
        
           | 21 | beyerle@PS | 342 | if [ $fail ]; then
 | 
        
           |  |  | 343 |     echo "ERROR: Not everything was copied to $INSTALL_PART"
 | 
        
           |  |  | 344 |     exit_now 1
 | 
        
           |  |  | 345 | fi
 | 
        
           | 15 | beyerle@PS | 346 |   | 
        
           |  |  | 347 |   | 
        
           | 16 | beyerle@PS | 348 | ### move /usr/opt back to /opt
 | 
        
           |  |  | 349 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 350 | if [ -d $NEW/usr/opt ]; then
 | 
        
           |  |  | 351 |     echo -n "Move /opt back ... "
 | 
        
           |  |  | 352 |     mv $NEW/usr/opt $NEW/
 | 
        
           |  |  | 353 |     echo "done."; echo
 | 
        
           |  |  | 354 | fi
 | 
        
           |  |  | 355 |   | 
        
           |  |  | 356 |   | 
        
           |  |  | 357 | ### create dirs which were not copied
 | 
        
           | 16 | beyerle@PS | 358 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 359 | for dir in $DIR_NOT_COPY; do
 | 
        
           |  |  | 360 |     mkdir $NEW/$dir
 | 
        
           |  |  | 361 | done
 | 
        
           | 26 | beyerle@PS | 362 | # we do not need this directories
 | 
        
           |  |  | 363 | rmdir $NEW/livecd
 | 
        
           |  |  | 364 | # if not yet existing, create
 | 
        
           |  |  | 365 | mkdir -p $NEW/srv
 | 
        
           |  |  | 366 | mkdir -p $NEW/selinux
 | 
        
           | 15 | beyerle@PS | 367 |   | 
        
           |  |  | 368 |   | 
        
           |  |  | 369 | ### copy back original files
 | 
        
           | 16 | beyerle@PS | 370 | ### -----------------------------------------------------------
 | 
        
           | 15 | beyerle@PS | 371 | echo -n "Restore original files ... " 
 | 
        
           |  |  | 372 | for file in $FILES_RESTORE; do
 | 
        
           | 28 | beyerle@PS | 373 |     [ -r $NEW/${file}.ori ] && mv -f $NEW/${file}.ori $NEW/${file} 
 | 
        
           | 15 | beyerle@PS | 374 | done
 | 
        
           |  |  | 375 | echo "done."; echo
 | 
        
           |  |  | 376 |   | 
        
           |  |  | 377 |   | 
        
           | 16 | beyerle@PS | 378 | ### define kernel version
 | 
        
           |  |  | 379 | ### -----------------------------------------------------------
 | 
        
           |  |  | 380 | rpm --quiet -q kernel     && UP_installed=true
 | 
        
           |  |  | 381 | rpm --quiet -q kernel-smp && SMP_installed=true
 | 
        
           |  |  | 382 | [ $UP_installed ]  && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel 2>/dev/null )
 | 
        
           |  |  | 383 | [ $SMP_installed ] && KERNEL_VERSION=$( rpm -q --qf "%{V}-%{R}" kernel-smp  2>/dev/null )
 | 
        
           |  |  | 384 | if [ ! $KERNEL_VERSION ]; then
 | 
        
           |  |  | 385 |     echo "ERROR: Kernel version could not be determined - installation failed"; echo
 | 
        
           | 21 | beyerle@PS | 386 |     exit_now 1
 | 
        
           | 16 | beyerle@PS | 387 | fi    
 | 
        
           | 15 | beyerle@PS | 388 |   | 
        
           | 18 | beyerle@PS | 389 |   | 
        
           | 22 | beyerle@PS | 390 |   | 
        
           | 24 | beyerle@PS | 391 | if [ ! $NOGRUB ]; then
 | 
        
           | 15 | beyerle@PS | 392 |   | 
        
           | 26 | beyerle@PS | 393 |     ### Backup Master Boot Record MBR
 | 
        
           |  |  | 394 |     ### -----------------------------------------------------------
 | 
        
           |  |  | 395 |     if [ ! $NOGRUB ]; then
 | 
        
           |  |  | 396 | 	# do we have already a backup?
 | 
        
           |  |  | 397 | 	MBR_FILENAME="MBR$( echo $MBR_DEV | tr / _ ).bak"
 | 
        
           |  |  | 398 | 	if [ ! -e /tmp/$MBR_FILENAME ]; then
 | 
        
           |  |  | 399 | 	    echo "Backup Master Boot Record (MBR) of $MBR_DEV ..."
 | 
        
           |  |  | 400 | 	    dd if=$MBR_DEV of=/tmp/$MBR_FILENAME bs=512 count=1
 | 
        
           |  |  | 401 | 	fi
 | 
        
           |  |  | 402 | 	cp -a /tmp/$MBR_FILENAME $NEW/$MBR_FILENAME
 | 
        
           |  |  | 403 | 	echo "MBR saved as $MBR_FILENAME on $INSTALL_PART and on /tmp"
 | 
        
           |  |  | 404 | 	echo
 | 
        
           |  |  | 405 |     fi
 | 
        
           |  |  | 406 |   | 
        
           |  |  | 407 |   | 
        
           | 24 | beyerle@PS | 408 |     ### install grub
 | 
        
           |  |  | 409 |     ### -----------------------------------------------------------
 | 
        
           | 26 | beyerle@PS | 410 |     echo "Run grub-install ... "
 | 
        
           | 24 | beyerle@PS | 411 |     mkdir -p $NEW/boot/grub
 | 
        
           |  |  | 412 |     if [ $FLOPPY ]; then
 | 
        
           |  |  | 413 | 	grub-install --root-directory=$NEW $MBR_DEV
 | 
        
           |  |  | 414 |     else
 | 
        
           |  |  | 415 | 	grub-install --no-floppy --root-directory=$NEW $MBR_DEV
 | 
        
           |  |  | 416 |     fi
 | 
        
           |  |  | 417 |     echo "done."; echo
 | 
        
           | 15 | beyerle@PS | 418 |   | 
        
           |  |  | 419 |   | 
        
           | 24 | beyerle@PS | 420 |     ### check for device.map file 
 | 
        
           |  |  | 421 |     ### -----------------------------------------------------------
 | 
        
           |  |  | 422 |     DEVICE_MAP=$NEW/boot/grub/device.map
 | 
        
           |  |  | 423 |     if [ ! -e $NEW/boot/grub/device.map ]; then
 | 
        
           |  |  | 424 | 	echo "ERROR: $NEW/boot/grub/device.map not found"
 | 
        
           |  |  | 425 | 	exit_now 1
 | 
        
           |  |  | 426 |     fi
 | 
        
           | 15 | beyerle@PS | 427 |   | 
        
           | 22 | beyerle@PS | 428 |   | 
        
           | 24 | beyerle@PS | 429 |     ### convert dev syntax to grub syntax
 | 
        
           |  |  | 430 |     ### -----------------------------------------------------------
 | 
        
           |  |  | 431 |     GRUB_INSTALL_DEV=$( grep $INSTALL_DEV $DEVICE_MAP | awk '{ print $1 }' )
 | 
        
           |  |  | 432 |     GRUB_ROOT_PART=$( echo "$GRUB_INSTALL_DEV" | sed "s%)$%,`expr $INSTALL_PART_NR - 1`)%" )
 | 
        
           | 22 | beyerle@PS | 433 |   | 
        
           | 15 | beyerle@PS | 434 |   | 
        
           | 24 | beyerle@PS | 435 |     ### find active Windows partition
 | 
        
           |  |  | 436 |     ### -----------------------------------------------------------
 | 
        
           |  |  | 437 |     if [ ! $WIN_PART ]; then
 | 
        
           |  |  | 438 |         # try to find active Windows partition
 | 
        
           |  |  | 439 | 	WIN_PART=$( fdisk -l 2>/dev/null | awk '{ if ($2 == "*" && $7 ~ "NTFS") print $1 }' | head -1 )
 | 
        
           |  |  | 440 |     fi
 | 
        
           |  |  | 441 |   | 
        
           |  |  | 442 |     if [ $WIN_PART ]; then
 | 
        
           |  |  | 443 | 	WIN_installed=true
 | 
        
           |  |  | 444 | 	WIN_DISK=$( echo "$WIN_PART" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' )
 | 
        
           |  |  | 445 | 	WIN_PART_NR=$( echo "$WIN_PART" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' )
 | 
        
           |  |  | 446 |         # convert dev syntax to grub syntax
 | 
        
           |  |  | 447 | 	GRUB_WIN_DEV=$( grep $WIN_DISK $DEVICE_MAP | awk '{ print $1 }' )
 | 
        
           |  |  | 448 | 	GRUB_WIN_PART=$( echo "$GRUB_WIN_DEV" | sed "s%)$%,`expr $WIN_PART_NR - 1`)%" )
 | 
        
           |  |  | 449 |   | 
        
           |  |  | 450 |         # $GRUB_WIN_PART should be something like (hd0,0)
 | 
        
           |  |  | 451 | 	echo "Found active Windows partition ( $WIN_PART = $GRUB_WIN_PART )" 
 | 
        
           |  |  | 452 | 	echo "Will add entry for Windows in GRUB."
 | 
        
           |  |  | 453 | 	echo
 | 
        
           |  |  | 454 |     fi
 | 
        
           |  |  | 455 |   | 
        
           |  |  | 456 |   | 
        
           |  |  | 457 |     ### create grub.conf file
 | 
        
           |  |  | 458 |     ### -----------------------------------------------------------
 | 
        
           | 26 | beyerle@PS | 459 |     echo "Create grub.conf ..."
 | 
        
           | 24 | beyerle@PS | 460 |   | 
        
           | 28 | beyerle@PS | 461 |     TITLE="Linux"
 | 
        
           |  |  | 462 |     [ -e $NEW//etc/redhat-release ] && TITLE=$( cat $NEW/etc/redhat-release )
 | 
        
           |  |  | 463 |   | 
        
           | 24 | beyerle@PS | 464 |     cat > $NEW/boot/grub/grub.conf <<EOF
 | 
        
           | 15 | beyerle@PS | 465 | # grub.conf generated by $SCRIPTNAME
 | 
        
           |  |  | 466 | default=0
 | 
        
           |  |  | 467 | timeout=5
 | 
        
           |  |  | 468 | splashimage=$GRUB_ROOT_PART/boot/grub/splash.xpm.gz
 | 
        
           |  |  | 469 | #hiddenmenu
 | 
        
           | 16 | beyerle@PS | 470 | EOF
 | 
        
           |  |  | 471 |   | 
        
           | 24 | beyerle@PS | 472 |     if [ $UP_installed ]; then
 | 
        
           | 26 | beyerle@PS | 473 | 	echo "Add entry for UP kernel into grub.conf"
 | 
        
           | 24 | beyerle@PS | 474 | 	cat >> $NEW/boot/grub/grub.conf <<EOF
 | 
        
           | 28 | beyerle@PS | 475 | title $TITLE (${KERNEL_VERSION})
 | 
        
           | 15 | beyerle@PS | 476 |         root $GRUB_ROOT_PART
 | 
        
           |  |  | 477 | 	kernel /boot/vmlinuz-$KERNEL_VERSION ro root=$INSTALL_PART
 | 
        
           |  |  | 478 | 	initrd /boot/initrd-$KERNEL_VERSION.img
 | 
        
           | 16 | beyerle@PS | 479 | EOF
 | 
        
           | 24 | beyerle@PS | 480 |     fi
 | 
        
           | 16 | beyerle@PS | 481 |   | 
        
           | 24 | beyerle@PS | 482 |     if [ $SMP_installed ]; then
 | 
        
           | 26 | beyerle@PS | 483 | 	echo "Add entry for SMP kernel into grub.conf"
 | 
        
           | 24 | beyerle@PS | 484 | 	cat >> $NEW/boot/grub/grub.conf <<EOF
 | 
        
           | 28 | beyerle@PS | 485 | title $TITLE (${KERNEL_VERSION}smp)
 | 
        
           | 16 | beyerle@PS | 486 |         root $GRUB_ROOT_PART
 | 
        
           |  |  | 487 | 	kernel /boot/vmlinuz-${KERNEL_VERSION}smp ro root=$INSTALL_PART
 | 
        
           |  |  | 488 | 	initrd /boot/initrd-${KERNEL_VERSION}smp.img
 | 
        
           |  |  | 489 | EOF
 | 
        
           | 24 | beyerle@PS | 490 |     fi
 | 
        
           | 16 | beyerle@PS | 491 |   | 
        
           | 24 | beyerle@PS | 492 |     if [ $WIN_installed ]; then
 | 
        
           | 26 | beyerle@PS | 493 | 	echo "Add entry for Windows into grub.conf"
 | 
        
           | 24 | beyerle@PS | 494 | 	cat >> $NEW/boot/grub/grub.conf <<EOF
 | 
        
           | 15 | beyerle@PS | 495 | title Windows
 | 
        
           |  |  | 496 |         rootnoverify $GRUB_WIN_PART
 | 
        
           |  |  | 497 |         chainloader +1
 | 
        
           |  |  | 498 | EOF
 | 
        
           | 24 | beyerle@PS | 499 |     fi
 | 
        
           |  |  | 500 |   | 
        
           |  |  | 501 |     chmod 600 $NEW/boot/grub/grub.conf
 | 
        
           |  |  | 502 |     ln -s ../boot/grub/grub.conf $NEW/etc/grub.conf
 | 
        
           |  |  | 503 |     ln -s ./grub.conf $NEW/boot/grub/menu.lst
 | 
        
           |  |  | 504 |     echo "done."; echo
 | 
        
           |  |  | 505 |   | 
        
           | 16 | beyerle@PS | 506 | fi
 | 
        
           | 15 | beyerle@PS | 507 |   | 
        
           |  |  | 508 |   | 
        
           | 27 | beyerle@PS | 509 | ### install kernel and other files into /boot
 | 
        
           | 16 | beyerle@PS | 510 | ### -----------------------------------------------------------
 | 
        
           | 21 | beyerle@PS | 511 | echo "Install kernel(s) ..."
 | 
        
           | 15 | beyerle@PS | 512 |   | 
        
           | 16 | beyerle@PS | 513 | [ -e /boot/vmlinuz ]      && BOOT_DIR=/boot
 | 
        
           |  |  | 514 | [ -e /boot/boot/vmlinuz ] && BOOT_DIR=/boot/boot
 | 
        
           | 15 | beyerle@PS | 515 |   | 
        
           | 16 | beyerle@PS | 516 | if [ ! $BOOT_DIR ]; then
 | 
        
           |  |  | 517 |     echo "ERROR: No kernel found - installation failed"; echo
 | 
        
           | 21 | beyerle@PS | 518 |     exit_now 1
 | 
        
           | 16 | beyerle@PS | 519 | fi
 | 
        
           |  |  | 520 |   | 
        
           |  |  | 521 | cp -a $BOOT_DIR/vmlinuz            $NEW/boot/vmlinuz-${KERNEL_VERSION}
 | 
        
           |  |  | 522 | cp -a $BOOT_DIR/vmlinuzs           $NEW/boot/vmlinuz-${KERNEL_VERSION}smp  2>/dev/null
 | 
        
           |  |  | 523 | cp -a $BOOT_DIR/System.map-*       $NEW/boot/
 | 
        
           |  |  | 524 | cp -a $BOOT_DIR/config-*           $NEW/boot/
 | 
        
           | 26 | beyerle@PS | 525 | cp -a $BOOT_DIR/symvers-*.gz       $NEW/boot/        2>/dev/null
 | 
        
           | 16 | beyerle@PS | 526 | cp -a $BOOT_DIR/grub/splash.xpm.gz $NEW/boot/grub/
 | 
        
           | 26 | beyerle@PS | 527 | cp -a $BOOT_DIR/message.ja         $NEW/boot/        2>/dev/null
 | 
        
           |  |  | 528 | cp -a $BOOT_DIR/message            $NEW/boot/        2>/dev/null
 | 
        
           |  |  | 529 |   | 
        
           | 16 | beyerle@PS | 530 | echo "done."; echo
 | 
        
           |  |  | 531 |   | 
        
           |  |  | 532 |   | 
        
           | 21 | beyerle@PS | 533 | ### create /etc/fstab
 | 
        
           | 16 | beyerle@PS | 534 | ### -----------------------------------------------------------
 | 
        
           | 21 | beyerle@PS | 535 | cat > $NEW/etc/fstab <<EOF
 | 
        
           |  |  | 536 | $INSTALL_PART         /                    ext3    defaults        1 1
 | 
        
           |  |  | 537 | devpts            /dev/pts             devpts  gid=5,mode=620  0 0
 | 
        
           |  |  | 538 | tmpfs             /dev/shm             tmpfs   defaults        0 0
 | 
        
           |  |  | 539 | proc              /proc                proc    defaults        0 0
 | 
        
           |  |  | 540 | sysfs             /sys                 sysfs   defaults        0 0
 | 
        
           |  |  | 541 | EOF
 | 
        
           |  |  | 542 | if [ $SWAP_PART ]; then
 | 
        
           |  |  | 543 |     echo "$SWAP_PART         swap                 swap    defaults        0 0" >> $NEW/etc/fstab
 | 
        
           |  |  | 544 | fi
 | 
        
           |  |  | 545 |   | 
        
           |  |  | 546 |   | 
        
           |  |  | 547 | ### make initrd 
 | 
        
           |  |  | 548 | ### (needs $NEW/etc/fstab to find correct modules for root filesystem !!)
 | 
        
           |  |  | 549 | ### -----------------------------------------------------------
 | 
        
           |  |  | 550 | echo "Create initrd(s) ..."
 | 
        
           | 22 | beyerle@PS | 551 | # initrd should not be build on tmpfs (we take $NEW/tmp instead of /tmp)
 | 
        
           |  |  | 552 | sed -i "s|^TMPDIR=.*|TMPDIR=\"$NEW/tmp\"|" /usr/sbin/livecd-mkinitrd
 | 
        
           |  |  | 553 |   | 
        
           | 16 | beyerle@PS | 554 | if [ $UP_installed ]; then
 | 
        
           | 21 | beyerle@PS | 555 |     depmod -a ${KERNEL_VERSION}
 | 
        
           | 22 | beyerle@PS | 556 |     /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
 | 
        
           | 21 | beyerle@PS | 557 |                     $NEW//boot/initrd-${KERNEL_VERSION}.img ${KERNEL_VERSION}
 | 
        
           | 18 | beyerle@PS | 558 |     if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}.img ]; then
 | 
        
           |  |  | 559 | 	echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}.img"
 | 
        
           | 21 | beyerle@PS | 560 | 	exit_now 1
 | 
        
           | 18 | beyerle@PS | 561 |     fi
 | 
        
           | 16 | beyerle@PS | 562 | fi
 | 
        
           |  |  | 563 | if [ $SMP_installed ]; then
 | 
        
           | 21 | beyerle@PS | 564 |     depmod -a ${KERNEL_VERSION}smp
 | 
        
           | 22 | beyerle@PS | 565 |     /usr/sbin/livecd-mkinitrd --fstab=$NEW/etc/fstab \
 | 
        
           | 21 | beyerle@PS | 566 |                     $NEW/boot/initrd-${KERNEL_VERSION}smp.img ${KERNEL_VERSION}smp
 | 
        
           | 18 | beyerle@PS | 567 |     if [ ! -e $NEW/boot/initrd-${KERNEL_VERSION}smp.img ]; then
 | 
        
           |  |  | 568 | 	echo "ERROR: Failed to create $NEW/boot/initrd-${KERNEL_VERSION}smp.img"
 | 
        
           | 21 | beyerle@PS | 569 | 	exit_now 1
 | 
        
           | 18 | beyerle@PS | 570 |     fi
 | 
        
           | 16 | beyerle@PS | 571 | fi
 | 
        
           |  |  | 572 | echo "done."; echo
 | 
        
           |  |  | 573 |   | 
        
           |  |  | 574 |   | 
        
           | 15 | beyerle@PS | 575 | ### remove LiveCD init.d scripts
 | 
        
           | 16 | beyerle@PS | 576 | ### -----------------------------------------------------------
 | 
        
           |  |  | 577 | for file in $LIVECD_INIT_SCRIPTS; do
 | 
        
           |  |  | 578 |     rm -f $NEW/etc/init.d/$file
 | 
        
           |  |  | 579 |     for n in 0 1 2 3 4 5 6; do
 | 
        
           |  |  | 580 | 	rm -f $NEW/etc/rc.d/rc${n}.d/*$file
 | 
        
           |  |  | 581 |     done
 | 
        
           | 15 | beyerle@PS | 582 | done
 | 
        
           |  |  | 583 |   | 
        
           | 16 | beyerle@PS | 584 |   | 
        
           |  |  | 585 | ### restore cronjobs
 | 
        
           |  |  | 586 | ### -----------------------------------------------------------
 | 
        
           | 26 | beyerle@PS | 587 | mv $NEW/etc/cron_backup/sysstat $NEW/etc/cron.d/ 2>/dev/null
 | 
        
           |  |  | 588 | mv $NEW/etc/cron_backup/00-makewhatis.cron.weekly $NEW/etc/cron.weekly/00-makewhatis.cron 2>/dev/null
 | 
        
           |  |  | 589 | mv $NEW/etc/cron_backup/* $NEW/etc/cron.daily/
 | 
        
           | 16 | beyerle@PS | 590 |   | 
        
           |  |  | 591 |   | 
        
           | 29 | beyerle@PS | 592 | ### prepare chroot to $NEW
 | 
        
           |  |  | 593 | ### -----------------------------------------------------------
 | 
        
           |  |  | 594 | mount --bind /dev $NEW/dev
 | 
        
           |  |  | 595 | mount --bind /sys $NEW/sys
 | 
        
           |  |  | 596 | mount -t proc proc $NEW/proc
 | 
        
           |  |  | 597 |   | 
        
           |  |  | 598 |   | 
        
           | 18 | beyerle@PS | 599 | ### turn on kudzu again
 | 
        
           |  |  | 600 | ### -----------------------------------------------------------
 | 
        
           | 26 | beyerle@PS | 601 | chroot $NEW chkconfig kudzu on
 | 
        
           | 18 | beyerle@PS | 602 |   | 
        
           |  |  | 603 |   | 
        
           | 29 | beyerle@PS | 604 | ### remove RPMs that can break future updates  
 | 
        
           |  |  | 605 | ### -----------------------------------------------------------
 | 
        
           |  |  | 606 | if [ ! $NORPMREMOVE ]; then
 | 
        
           |  |  | 607 |     echo "Remove RPMs that may break future updates ..."
 | 
        
           |  |  | 608 |     chroot $NEW rpm -qa 2>/dev/null > /tmp/rpmlist
 | 
        
           |  |  | 609 |   | 
        
           |  |  | 610 |     # Scientific Linux RPMs
 | 
        
           |  |  | 611 |     RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_SL"
 | 
        
           |  |  | 612 |   | 
        
           |  |  | 613 |     # PSI Scientific Linux RPMs
 | 
        
           |  |  | 614 |     if [ -e /etc/sysconfig/cfengine ]; then
 | 
        
           |  |  | 615 | 	RPMSTOREMOVE="$RPMS_TO_REMOVE $RPMS_TO_REMOVE_PSI"
 | 
        
           |  |  | 616 |     fi
 | 
        
           |  |  | 617 |   | 
        
           |  |  | 618 |     for rpm in $RPMSTOREMOVE; do
 | 
        
           |  |  | 619 | 	rpms_remove=$( cat /tmp/rpmlist | grep "^$rpm" )
 | 
        
           |  |  | 620 | 	for rpm_remove in $rpms_remove; do	
 | 
        
           |  |  | 621 | 	    chroot $NEW rpm -e --nodeps $rpm_remove 2>/dev/null
 | 
        
           |  |  | 622 | 	    [ "$?" = "0" ] && echo "$rpm_remove removed"
 | 
        
           |  |  | 623 | 	done
 | 
        
           |  |  | 624 |     done
 | 
        
           |  |  | 625 |     echo "done."; echo
 | 
        
           |  |  | 626 | fi
 | 
        
           |  |  | 627 |   | 
        
           |  |  | 628 |   | 
        
           | 15 | beyerle@PS | 629 | ### umount $INSTALL_PART
 | 
        
           | 16 | beyerle@PS | 630 | ### -----------------------------------------------------------
 | 
        
           | 29 | beyerle@PS | 631 | umount $NEW/dev
 | 
        
           |  |  | 632 | umount $NEW/sys
 | 
        
           |  |  | 633 | umount $NEW/proc
 | 
        
           | 16 | beyerle@PS | 634 | umount $INSTALL_PART
 | 
        
           | 15 | beyerle@PS | 635 |   | 
        
           | 22 | beyerle@PS | 636 |   | 
        
           |  |  | 637 | ### print summary
 | 
        
           |  |  | 638 | ### -----------------------------------------------------------
 | 
        
           | 26 | beyerle@PS | 639 | echo                     "--------------------------------------------------------------"
 | 
        
           |  |  | 640 | echo                     "  LiveCD installed on partition $INSTALL_PART"
 | 
        
           |  |  | 641 | [ "$SWAP_PART" ] && echo "  Partition $SWAP_PART will be used as swap partition"
 | 
        
           | 22 | beyerle@PS | 642 | echo
 | 
        
           | 28 | beyerle@PS | 643 | [ ! $NOGRUB ]    && echo "  GRUB installed in Master Boot Record (MBR) of $MBR_DEV"
 | 
        
           |  |  | 644 | [ ! $NOGRUB ]    && echo "  MBR saved as $MBR_FILENAME on $INSTALL_PART and in /tmp"
 | 
        
           | 26 | beyerle@PS | 645 | [ ! $NOGRUB ]    && echo "  If you have to restore MBR, execute under Linux:"
 | 
        
           |  |  | 646 | [ ! $NOGRUB ]    && echo "  # dd if=$MBR_FILENAME of=$MBR_DEV bs=512 count=1"
 | 
        
           |  |  | 647 | echo 
 | 
        
           |  |  | 648 | [ $WIN_PART ]    && echo "  Entry created in grub.conf for Windows partition $WIN_PART"
 | 
        
           |  |  | 649 | echo                     "--------------------------------------------------------------"
 | 
        
           |  |  | 650 | echo                     "End of $SCRIPTNAME"
 | 
        
           |  |  | 651 | echo
 |