Re: moving kickstart forward
Andrew Simpson <[email protected]> Mon, 7 Mar 2016 17:30:49 -0500
| Newsgroups | gmane.linux.redhat.kickstart.general |
|---|---|
| Message-ID | <CAFzrdOz7_s0HbJhPQmmOifX1v-_xCh5J2boMpY-JXHoeBZyhVQ@mail.gmail.com> |
On this one, reference back to what I posted to Chris just a minute ago.
USB is tricky.
1. using USB to install everything? this requires setting up the usb
drive properly.
2. using USB to only host the kickstart file, with the ISO on dvd or a
network share is pretty easy though.
How to install from USB:
1. First thing to note is that you MUST make the iso bootable by usb.
#make sure the iso is bootable on USB devices
isohybrid ${filename}.iso
implantisomd5 ${filename}.iso
2. I'm attaching a script to push an iso to a usb drive. Sorry, I had to
do this on a windows machine. probably has been window-ized.
3. See my %pre section provided to Chris L a few posts back.
>
Andrew Simpson
On Mon, Mar 7, 2016 at 1:32 PM, Chris Lumens <[email protected]> wrote:
> > Per requirements our application is installed standalone via DVD.
> > %pre : we only do --log= . No custom stuff done here.
> > %post : we use --log= and this is where we do the custom software
> installation and configuration.
>
> What kind of custom installation are you doing that prevents using the
> repo command with extra stuff in the %packages section? Is there
> anything we could do to let this work for you?
>
> > I have tried using a USB stick but, KS or anaconda get lost on where the
> files are when going to %post. It would be nice if this work like the DVD
> install.
>
> Hm, could you give me more information on what's happening here?
> Thanks!
>
> - Chris
>
> _______________________________________________
> Kickstart-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/kickstart-list
>
_______________________________________________
Kickstart-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/kickstart-list
do_make_usb.sh
(application/x-sh, 5.5 KB)
#!/bin/bash
# AUTHOR: Modified by: Andrew Simpson
# ORGANIZATION:
# CREATED: 03/15/2015 03:26:13 PM UTC
# REVISION: --- 4.0:
#===============================================================================
# Copyright (C) 2012-2014 United States Government, as represented by the
# Secretary of Defense. All rights reserved.
# Exit immediately if anything exits with a non-zero status.
set -e
# Treat unset variables and parameters as an errors
set -u
#--- FUNCTION ----------------------------------------------------------------
# NAME: do_make_usb
# DESCRIPTION: Makes a bootable usb and copies the file
# REQUIERMENTS: Requires livecd-tools installed
# PARAMETERS:
# RETURNS:
#-------------------------------------------------------------------------------
do_make_usb ()
{
echo "Making bootable USB drive"
echo "Your USB device must be inserted and mounted now"
echo "You probably need to be root to do this: "
declare -A usbArray=()
for DEV in /sys/block/sd*
do
echo $DEV
if readlink $DEV |grep -q usb
then
DEV=`basename $DEV`
echo "$DEV is a USB device"
devModel=`cat /sys/block/$DEV/device/model | sed 's/\ /_/g'`
#devVendor=`cat /sys/block/$DEV/device/vendor |sed 's/\ /_/g'`
devName="${devModel}"
#_${DevVendor}"
#usbArray+=($DEV)
#usbArray[$DEV]="${devName}"
usbArray[${devName}]="${DEV}"
fi
done
#echo "LIST KEYS AND VALUES"
#echo ${usbArray[@]} #print keys
#echo ${!usbArray[@]} #print values
#echo ""
# Since we are prompting the user, let's not show a bunch of stuff
set +x
echo "Select the USB drive from the list (Choose the corresponding number):"
PS3="Selected USB device: "
select drive in ${!usbArray[@]} Quit
do
if [[ "$drive" == "Quit" ]]; then
break
fi
echo ""
echo "You selected $drive : ${usbArray[$drive]}"
echo "!!!!!!!This will overwrite your entire USB drive.!!!!!!!"
echo ""
PS3="Are you sure you want to continue???? "
select opt in yes no
do
case $opt in
"yes")
echo "Are you very sure?"
echo "Type: YES to continue "
read answer
if [[ "$answer" != "YES" ]];
then
echo "You did not choose YES! Exiting..."
exit
else
echo "Beginning overwrite of $drive"
#TODO: make this so that it lists all available isos and prompts for selection.
#livecd-iso-to-disk --reset-mbr --format latest.iso /dev/$drive
#can also use dd at this point.
# pv shows the percentage complete.
# Currently using livecd-iso-to-disk instead of dd.
if [ ! -e /usr/bin/livecd-iso-to-disk ]; then
echo "livecd tools not installed. exiting!!!!!"
exit 1
else
#get the full device
fullDevName="/dev/${usbArray[$drive]}"
fullDevPartName="${fullDevName}1"
# livecd-iso-to-disk --format --reset-mbr ../latest.iso /dev/${usbArray[$drive]}
#livecd has an exit in it that may cause the parent to die.
# so we dump this to a child script
# 1) no-formatting
# TODO: try to determine if formatting is already good for this, and don't
# re-format.
# TODO: provide a parameter to the script to change the format behavior
# NOTE: without the --format option, you have to tell the command to
# use the partition (i.e. /dev/sda1) instead of /dev/sda)
#echo "livecd-iso-to-disk ../latest.iso /dev/${usbArray[$drive]}1" > buildUSB.sh
# 2) formatting enabled everytime by default
echo "livecd-iso-to-disk --format --reset-mbr ../latest.iso /dev/${usbArray[$drive]}" > buildUSB.sh
bash ./buildUSB.sh || true
#livecd-iso-to-disk ../latest.iso /dev/${usbArray[$drive]}
# Need to copy the kickstart directory to the primary partition, since
# this puts only the ISO on the drive. Note: future versions of the utility
# do this for us.
tmpDIR=$(mktemp -d)
mount $fullDevPartName ${tmpDIR}
rsync -av disc/ks ${tmpDIR}
sleep 5
#umount -f ${tmpDIR}
#rmdir ${tmpDIR}
# Change the drive label. For ext2 systems:
e2label $fullDevPartName ecoreOS
drvLabel=`e2label $fullDevPartName`
echo "Updated Label: $drvLabel"
# If you use a dos format, use mlabel
# have to edit the syslinux lines now
val=`basename $fullDevPartName`
for file in $tmpDIR/syslinux/*.cfg; do
echo "sed editing $file"
#sed -i "/ks=cdrom/s/$/ repo=hd:\/dev\/$val\:\/ /g" $file
#sed -i "s/ks=cdrom:/ks=hd:\/dev\/$val\:/g" $file
sed -i "/ks=cdrom/s/$/ repo=hd:LABEL=$drvLabel:\/ /g" $file
sed -i "s/ks=cdrom:/ks=hd:LABEL=$drvLabel:/g" $file
done
#TODO: Fix 'boot from local drive option' when using USB to install
sleep 5
umount -f ${tmpDIR}
rmdir ${tmpDIR}
fi
#if [ ! -e /usr/bin/pv ]; then
# echo "You need to install pv. Pv shows dd's progress: yum install pv"
# echo "Using dd without status back:"
# dd if=${filename} of=/dev/$device bs=4096 conv=notrunc,noerror
#else
# pv -tpreb ${filename} | dd of=/dev/$device bs=4096 conv=notrunc,noerror
#fi
#echo "Action completed. Unmount and try out your new shiny usb thingy"
fi
break
;;
"no")
echo "Thanks for playing. bye!"
exit
;;
*) echo invalid option;;
esac
done
break
done
set -x
}