嵌入式软件工程师&&太极拳
全部博文(548)
分类: LINUX
2011-03-04 22:25:19
#!/bin/bash
function isocopy()
{
hdid=`df -h | grep /$ | awk '{print $1}' | awk -F"sda" '{print $2}'`
size=`df --block-size=102400000 | grep /$ | awk '{print $4}'`
if [ $size -lt 18 ]
then
echo "You have not enough space in / partition. Reference installation notic.";
exit;
else
echo "Trying download, please wait for few minutes"
mkdir /isoroot
wget -P/isoroot &> /dev/null
wget -P/isoroot &> /dev/null
wget -P/isoroot &> /dev/null
if [ ! -f "/isoroot/0.91.iso" ]
then
echo "Download error check your network.";
exit
else
filesize=`ls -l /isoroot/0.91.iso | awk '{print $5}'`
if [ $filesize -gt 695578600 ]
then
echo "download complete"
else
echo "download error"
exit
fi
fi
let hdid--
echo "title isoboot" >> /boot/grub/grub.conf
echo " root (hd0,$hdid)" >>/boot/grub/grub.conf
echo ' kernel /isoroot/uvmlinuz boot=casper iso-scan/filename=/isoroot/0.91.iso quiet splash ro locale=zh_CN.UTF-8' >> /boot/grub/grub.conf
echo " initrd /isoroot/uinitrd.gz" >> /boot/grub/grub.conf
sed -i s/hiddenmenu// /boot/grub/grub.conf
grub-install --recheck /dev/sda &> /dev/null
echo "Install complete please reboot your computer and try"
fi
}
echo "###########################################################"
echo "# #"
echo "# Installation notic #"
echo "# #"
echo "# This program would download iso image automatic. #"
echo "# Image would place in /isoroot directory. #"
echo "# Your / partition must be more than 2G free space. #"
echo "# Otherwise installtion would break off automatic. #"
echo "# After installation, reboot your computer. #"
echo "# Choose isoboot boot entry, enjoy learning online. #"
echo "# #"
echo "# #"
echo "# #"
echo "# #"
echo "# video server ip is: 10.1.0.1 #"
echo "# video server user is: vtest #"
echo "# video server password is: 123456 #"
echo "# #"
echo "# #"
echo "# Remind by: Terry Tsang #"
echo "# #"
echo "###########################################################"
echo
echo -n "what is video server ip? [input 10.1.0.1] "
read answer
if [ "$answer" != "10.1.0.1" ]
then
echo "Reference installation notic."
exit
fi
echo -n "what is video login username? [input vtest] "
read answer
if [ "$answer" != "vtest" ]
then
echo "Reference installation notic."
exit
fi
echo -n "what is video login password? [input 123456] "
read answer
if [ "$answer" != "123456" ]
then
echo "Reference installation notic."
exit
fi
isocopy