1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
#!/bin/sh
set -e
timestamp=`date +"%y%m%d%H%M%S"`
YARDBIN="/usr/share/yard"
YARDBINBACK="/usr/share/yard.off"
YARDETC="/etc/yard"
YARDETCBACK="/etc/yard$timestamp"
YARDLOG="/var/log/yard"
YARDCONFLOG="$YARDLOG/yard.inst.log"
YARDDOC="/usr/share/doc/yard"
YARDFIRST="/sbin/make_root_fs"
goahead=0
die () {
tail -n 5 $YARDCONFLOG
rm $YARDCONFLOG
# Okay, remove my new binaries
/var/lib/dpkg/info/yard.postrm remove
# Are there old binaries? Move 'em back
if [ -e $YARDBINBACK ]; then
mv $YARDBINBACK $YARDBIN
fi
# In case we already have made a configuration, remove it!
if [ -e $YARDETCBACK ]; then
rm -rf $YARDETC
mv $YARDETCBACK $YARDETC
fi
echo "Sorry an error occurd while bulding yard binaries"
echo "Please see $YARDCONFLOG for more details"
echo
echo "Press return to continue"
read dummy
goahead=1
}
if [ -e $YARDFIRST ]; then
if [ -z "`grep 'not really YARD' $YARDFIRST`" ]; then
echo "YARD is already configured!"
exit 0
fi
fi
VERSION=`uname -r`
(expr "$VERSION" \< "2.0.0" >/dev/null)
cd $YARDBIN
if [ -L /vmlinuz ]; then
kernelfile=`file /vmlinuz | cut -f5 -d" "`
kernelfile="/$kernelfile"
if [ "$VERSION" != "`file -b -m kernel.magic $kernelfile`" ]; then
echo "Your /vmlinz points to a kernel which is no kernel or has a different version"
echo "than uname -r reports."
echo
echo "You probably changed that yourself. Please correct that and run"
echo "/usr/share/yard/conf_yard again to finally configure YARD "
echo "automatically. If you're in the process of upgrading your kernel"
echo "please reboot and start /usr/share/yard/conf_yard again."
echo "See also the docs for more details."
echo
echo "Press return to continue"
read dummy
goahead=1
fi
fi
if [ "$goahead" -eq "0" ]; then
if [ ! -d "/lib/modules/$VERSION" ]; then
echo "Sorry, the corresponding modules directory to your $VERSION kernel doesn't"
echo "exist. If you are in the process of upgrading your kernel please reboot"
echo "and configure yard by calling /usr/share/yard/conf_yard again."
echo "Otherwise please rename your modules directory to /lib/modules/$VERSION"
echo "and start the final configuration of yard again."
echo "See docs for more details."
echo
echo "Press return to continue"
read dummy
goahead=1
fi
fi
if [ "$goahead" -eq "0" ]; then
# Save old yard settings
if [ -e $YARDETC ]; then
if [ -n "`ls $YARDETC`" ]; then
cp -r $YARDETC $YARDETCBACK
cd $YARDETC
rm -rf *
fi
fi
cd $YARDBIN
#trap 'cat $YARDCONFLOG' INT SIGTERM SIGILL
# run yard initalization
>$YARDCONFLOG
(perl configure >> $YARDCONFLOG 2>>$YARDCONFLOG)
if [ $? -ne "0" ]; then
die
else
(make all >> $YARDCONFLOG 2>>$YARDCONFLOG)
if [ $? -ne "0" ]; then
die
else
make install >> $YARDCONFLOG 2>>$YARDCONFLOG
if [ $? -ne "0" ]; then
die
fi
fi
fi
if [ "$goahead" -eq "0" ]; then
# add loaded modules to configuration
lsmod | cut -f 1 -d" " | \
xargs -n 1 -i@ find /lib/modules/$VERSION -name @.o >> /etc/yard/Bootdisk_Contents
# move docs to $YARDDOC
rm -f $YARDDOC/*Makefile*
rm -f $YARDDOC/.cvsignore
# remove old yard binaries when all went well
if [ -e $YARDBINBACK ]; then
rm -rf $YARDBINBACK
fi
# Restore old yard settings
if [ -e $YARDETCBACK ]; then
echo
echo "The previous configuration in $YARDETC has been moved to $YARDETCBACK!"
else
echo
echo "The configuration has gone to $YARDETC. See $YARDDOC for documentation."
fi
# remove the old binary (could have been made when last installation was unsuccessful)
if [ -f /sbin/make_root_fs.old ]; then
rm -f /sbin/make_root_fs.old
fi
fi
fi
|