[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Detecting a previous install



Peter Eisch wrote:
Does anyone have an insight for how to include a %pre script where I could
test for the existence of a specific directory on the target drive?

I would suggest that the user should think twice if there is anything on the drive, not just a file or directory. Our standard practice is to only kickstart completely new drives, so anything with an existing partition is bad news. You could make this die, or provide and opt out, as below (which keeps me from having to wipe test boxes before kicking). This works on EL-3 and EL-4beta:


%pre
# change to tty3 and check for partitions
chvt 3
exec < /dev/tty3 > /dev/tty3 2>/dev/tty3

# check
clear
sleep 2
echo "Checking for existing partitions...\n"

FDISK=`which fdisk`
if [ `$FDISK -l | grep "^/dev" | wc -l` -ne 0 ] ; then
sleep 1
echo "Whoa! This server has data partitions!!\n"
while true; do
echo "If you wish to continue with kickstart, type -> YES <- :\n"
read answer
case $answer in
YES ) echo "\nContinuing with kickstart...\n" ; sleep 3 ; break ;;
* ) echo "\nHuh? Let's try again...\n" ;;
esac
done
else
echo "Found no partitions - moving right along...\n" ; sleep 3
fi


# move back to tty1 and continue with install
chvt 1
exec < /dev/tty1 > /dev/tty1

--
Kind Regards,
Michael Shuler


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]