⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quickinst

📁 LINUX lilo-22.7 源代码。
💻
📖 第 1 页 / 共 2 页
字号:
#!/bin/sh<<@LILO QUICK INSTALLATION	                      Version 22.5 of 15-Dec-2003-----------------------                       ---------------------------This installation script installs LILO and generates the configuration file/etc/lilo.conf. It uses safe defaults for most configuration options.Please read the documentation (preferably the more complete LaTeX version,doc.tex) before making changes to the configuration generated by QuickInst.To run QuickInst, simply type./QuickInstIf the normally used root partition is mounted below root (e.g. duringsystem installation), set the environment variable ROOT to the name of thedirectory on which the root partition is mounted and run QuickInst, e.g.ROOT=/root ./QuickInstA subshell can be spawned at each prompt. Type  !  to get an interactiveshell that has to be left with  exit . Type  !command args ...  to executea command and immediately return to QuickInst.QuickInst can only be used to install LILO on IDE (AT-BUS) or SCSI harddisks. The LILO version must be 22 or later, the kernel should be 2.0.4or later. Owners of some disk adapters may have to create a DISK section(see section "Disk geometry" in the accompanying documentation) to describethe disk geometry.WARNING: QuickInst may get confused if you're running it in a directory	 that contains a mixture of old and new LILO distributions. To be	 safe, always extract new LILO distributions in their own, new	 directory.------------- End of description. What follows is program code. -------------@CFG_SUFFIX=/etcCFG_DIR=$ROOT$CFG_SUFFIXCFG_FILE=$CFG_DIR/lilo.confBOOT_SUFFIX=/bootBOOT_DIR=$ROOT$BOOT_SUFFIXSBIN_DIR=$ROOT/sbinlocate(){    var=$1    while shift && [ ! -z "$1" ]; do	for p in `echo $PATH | sed 's/:/ /g'`; do	    if [ -x $p/$1 ]; then		eval $var=$p/$1		return 0	    fi	done    done    return 1}probe(){    [ ! -z "`dd if=$1 bs=1 count=1 2>/dev/null | tr '\0' x`" ]    return}bootflag(){    [ "XY" = "`(dd of=/dev/null bs=510 count=1; dd bs=2 count=1 |      tr -c '\125\252' . | tr '\125\252' XY) <$1 2>/dev/null`" ]    return}krnltype(){    if [ "YX" = "`(dd bs=2 count=1 | tr -c '\001\013' . | tr '\001\013' XY) \      <$1 2>/dev/null`" ]; then	echo compound    else	echo image    fi}get(){    while true; do	echo -n "$1 "	if [ -z "$3" ]; then	    echo -n "(no default) "	else	    echo -n "[$3] "	fi	read line	line="`echo "$line" | sed 's/^ *\([^ ]\(\|.*[^ ]\)\) *$/\1/'`"	if [ -z "$line" ]; then	    if [ -z "$3" ]; then		echo "No default, please specify a value."		continue	    fi	    line=$3	fi	if [ "x$line" = "x!" ]; then	    cat <<EOFStarting a sub-shell. Type  exit  to return.EOF	    ${SHELL:-sh}	    echo	    continue	fi	if echo "$line" | grep '^!' >/dev/null; then	    sh -c "`echo \"$line\" | sed 's/^!//'`"	else	    eval $2="$line"	    break	fi    done}yesno(){    while true; do	get "$1" line $2	if echo "$line" | egrep -i '^y(|e(|s))$' >/dev/null; then	    return 0	fi	if echo "$line" | egrep -i '^no?$' >/dev/null; then	    return 1	fi	echo "YES or NO, please."    done}askinitrd(){    idef=""    for nn in /initrd /boot/initrd $ROOT/initrd $ROOT/boot/initrd; do	if [ -f $ROOT/$nn ]; then	    idef=$nn	    break	fi    done    if yesno "Does this kernel need an inital ramdisk?" no; then	    get "Initial ramdisk" initrd "$idef"	    if [ -f $initrd ]; then		echo "  initrd = $initrd" >>$CFG_FILE.tmp		return 0	    else		echo "$initrd  does not exist."		echo "You must specify an absolute path"		echo "#  initrd = $initrd    # file not found" >>$CFG_FILE.tmp		return 1	    fi    fi}###################################################### start of the actual script#####################################################echoif [ $ROOT/etc/lilo = `pwd` ]; then    cat <<EOFYou can't run QuickInst in /etc/lilo ! Please cd to the directory thatcontains your LILO source files and try again.EOF    exit 1fiif id | grep 'uid=0(' >/dev/null; then : ; else    echo "You probably have to be root to install LILO."    echo    if yesno "Try to install LILO anyway ?" no; then : ; else	echo	exit 1    fi    echofibadlib=""if [ "`echo 'X(Y)' | sed 's/\(X\)(Y)/\1/'`" != "X" ]; then    echo "Your sed doesn't behave like sed."    badlib=yfiif [ "`echo 'X(Y)' | grep '^X(Y)'`" != "X(Y)" ]; then    echo "Your grep doesn't behave like grep."    badlib=yfiif [ "`echo 'X(Y)' | egrep '^(X)\(Y\)'`" != "X(Y)" ]; then    echo "Your egrep doesn't behave like egrep."    badlib=yfiif [ ! -z "$badlib" ]; then    echo "Your libraries might be broken."    echo    exit 1ficat <<EOFQuickInst configures LILO and installs it on your hard disk. It should only beused for first-time installations, _not_ to update or modify an existinginstallation of LILO. It will _not_ generate a valid installation with versionsof LILO below 22.The installation procedure can be interrupted by pressing ^C at any time. Whenat a prompt, a sub-shell can be invoked with the exclamation mark.EOFif yesno "Continue ?" yes; then : ; else    echo    exit 0fiechoreplace=""if [ -d $BOOT_DIR -a \( -f boot.b -o -f first.S \) ]; then    cat <<EOFA directory $BOOT_SUFFIX already exists. If you're installing a new version ofLILO now, QuickInst has to replace the old files with the new ones.EOF    if yesno "Replace old files ?" yes; then	replace=y    fi    echofiif [ -f $ROOT/etc/lilo/install -a ! -L $ROOT/etc/lilo/install -a \  "$replace" != "y" ]; then    cat <<EOF/etc/lilo/install is a regular file and not a symbolic link. It should bea symbolic link to /sbin/lilo (see INCOMPAT for details).EOF    if yesno "Replace install by a link ?" yes; then	ln -sf $SBIN_DIR/lilo $ROOT/etc/lilo/install    fi    echofinoinst=""if [ -f $CFG_DIR/disktab ]; then    if [ "#|" = "`sed 1q <$CFG_DIR/disktab`" ]; then	cat <<EOF$CFG_DIR/disktab is a Shoelace-style parameter table. It isincompatible with LILO and most likely obsolete.EOF	if yesno "Remove $CFG_DIR/disktab ?" yes; then	    rm -f $CFG_DIR/disktab	else	    if yesno "Proceed anyway ?" no; then		cat <<EOFOkay, but QuickInst won't automatically invoke LILO at the end of theconfiguration session, because you have to get rid of disktab first.EOF		noinst=y	    else		echo Terminating		exit 1	    fi	fi	echo    fifiechoif [ ! -f $BOOT_DIR/boot.b -o ! -z "$replace" ]; then    if [ ! -f boot.b ]; then	if [ ! -f first.S ]; then	    cat <<EOFLILO is not installed and I don't know how to make it. Please cd to thedirectory where your LILO source lives and try again.EOF	    exit 1	fi	if [ ! -f /usr/include/linux/config.h ]; then	    cat <<EOFThe kernel header files appear to be missing. Please install them, then tryQuickInst again.EOF	    exit 1	fi	if [ ! -f /usr/include/linux/autoconf.h ]; then	    cat <<EOF(Creating dummy /usr/include/linux/autoconf.h)EOF	    touch /usr/include/linux/autoconf.h	fi	cat <<EOFMaking LILO ...EOF	if make; then : ; else exit; fi	echo    fi    cat <<EOFInstalling LILO ...EOF    if make install; then : ; else exit; fi    echofiif [ ! -x $SBIN_DIR/lilo ]; then    cat <<EOF$SBIN_DIR/lilo is missing. Don't know how to proceed ...EOF    exit 1fiversion="`$SBIN_DIR/lilo -V 2>/dev/null | sed 's/LILO version \(0\.\)\?//' | sed 's/\..*//'`"# echo LILO version $version is installedif [ -z "$version" ]; then    cat <<EOFIncompatible version of LILO. Expecting 22 (or later), found 10 or older.EOF    exit 1fiif [ "$version" -lt 22 ]; then    cat <<EOFIncompatible version of LILO. Expecting 22 (or later), found $versionEOF    exit 1fi#if [ ! -x ./activate ]; then#    cat <<EOF#activate  is not in the current directory. Please cd to your LILO source#directory and run QuickInst again.#EOF#fiif [ -d $ROOT/etc/lilo -a ! -x $ROOT/etc/lilo/install ]; then    ln -s $SBIN_DIR/lilo $ROOT/etc/lilo/installfiif [ -f $CFG_FILE ]; then    cat <<EOFThere is an existing configuration file:  "$CFG_FILE"EOF    if yesno "Do you wish to generate a new \"$CFG_FILE\"" no ; then :    else	echo	echo "Running $SBIN_DIR/lilo" ...	echo	if $SBIN_DIR/lilo ; then		echo 	else	    cat <<EOFErrors were noted in the running of the newly installed LILO with theold configuration file.  You will have to edit the file and re-run$SBIN_DIR/lilo to install the new boot loader.Exiting ...EOF	fi	exit    fifidev="`find /dev -maxdepth 1 -type b -name '[hs]da' | sed 's,/[hs]da$,,;1q'`"if [ -z "$dev" ]; then    cat <<EOF(Can't locate hda or sda device in /dev or in a subdirectory or it. Assuming disk devices live in /dev)EOF    dev="/dev"else    echo "(Disk devices live in $dev)"fiechoecho "Gathering configuration data ..."second=/dev/sdbif [ -L $dev/hda ]; then    cat <<EOF$dev/hda is a symbolic link. Assuming your first disk is $dev/sdaEOF    first=$dev/sda    if probe $dev/sdb; then	second=$dev/sdb    fielse    if probe $dev/hda; then	first=$dev/hda	if probe $dev/hdb; then	    second=$dev/hdb	else	    if probe $dev/sda; then		second=$dev/sda	    fi	fi    else	if probe $dev/sda; then	    first=$dev/sda	    if probe $dev/sdb; then		second=$dev/sdb	    fi	else	    cat <<EOFUnable to determine what your first disk is. (Tried $dev/hdaand $dev/sda, but none of them appears to exist.)Sorry, this is a fatal error.EOF	    exit 1	fi    fifiroot=""if locate path rootdev rdev setroot; then    root=`$path | awk '{ print $1 }'`    echo    echo "(/ is mounted on $root)"fiboot=""if echo $root | grep "^${first}[1-4]*\$" >/dev/null; then    boot=$rootficat <<EOF

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -