I have following simple script
Code: Select all
#! /bin/sh
LOGFILE=/tmp/log.$$
export LFS=/mnt/lfs
# No need to check this for errors
mount /dev/hda6 /mnt/lfs | tee $LOGFILE
check_err $? $LOGFILE
mkdir -p $LFS | tee $LOGFILE
check_err $? $LOGFILE
/usr/sbin/chroot "$LFS" /usr/bin/env -i HOME=/root \
TERM="$TERM"PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login +h | tee $LOGFILE
#
check_err()
#
check_err $? $LOGFILE
{
if [ -s $2 ]; then
echo "The previous command caused output. Do you want to continue?"
read ans
if [ "$ans" == "no" ] || [ "$ans" == "NO" ] || [ "$ans" == "n" ] || [ "$ans" == "N" ]; then
echo "Okay... bailing"
exit 1
fi
fi
if [ "$1" -eq "0" ]; then
echo "Command was succesful with no output... continuing"
return
else
echo "Error : $1"
exit $1
fi
}
TIA
B.R.
satimis