📄 ask_filesys
字号:
#!/bin/sh## @(#)ask_filesys 4.5 (ULTRIX) 3/18/91 ## Usage: sh ask_filsys## Description: During the advanced installation, the user will be asked# about how to arrange the file system for /usr, /usr/users,# var, swap area, and dump area. # This shell script probes the disk which the user want to# install and figure out which partitions are suitable for.# If the default partition is available. It will show the# default partition for the user.## 008 - Mar, 1991 - Jon Wallace# Moved read and write checks under var filesystem section## 007 - Jan, 1991 - Jon Wallace# Changed text to describe the current name of the ULTRIX instal-# lation guide.## 006 - Aug 31, 1990 - Jon Wallace# Put in fix to echo the read into a variable to remove embedded# spaces.## 005 - Aug 09, 1989 - Jon Wallace# Added confirmation query when returning from finder in all# instances.## 004 - Jun 01, 1989 - Jon Wallace# Added variable ROUTINE which allows finder to page through large# menus of disks at installation time.## 003 - Jan 26, 1988 - Tung-Ning Cherng# Allowed using the existing partition of the system disk.## 002 - May, 1987 - Donnie Cherng# Added the location of the var file system request.# # 001 - July, 1986 - Tungning Cherng# Probe the disks and partitions to show the table for the user.## 000 - June, 1986 - Tung-Ning Cherng created## Edited prompts on Aug. 4, 1986 by Al Wojtas#LL=""ERMSG11=" ${LL}You have used all of the available partitions on this disk.You must select another disk from the table, and thenchoose a partition available on that disk."ERMSG13=" ${LL}One possible cause for the error is a corrupt disk.Choose another disk from the table."USRSIZE=24000 # Minimum size for /usr, only bin and base subsetsSWAPSIZE=6000 # Optimum for swap areaDUMPSIZE=4000 # Optimum for dump area##This while loop obtains the location of the /usr file system.#while : truedo echo "*** /usr FILE SYSTEM ALLOCATION ***You can allocate the /usr file system to one of the disks listed in thetable below. See the Guide to Installing ULTRIX for an explanation ofthis table: " ROUTINE="/usr FILE SYSTEM ALLOCATION" export ROUTINE if [ "$PASS" = "REPEAT" ] then USR=`finder -f` else USR=`finder -d` fi set xx $USR usr_D=$2; usr_d=$3; usr_u=$4 while : do echo -n "You selected ${usr_D}, device number ${usr_u}. Make sure this disk ison line and write-enabled (if applicable to this drive) and thenconfirm your choice.Use ${usr_D}, ${usr_d}${usr_u} for /usr file system? (y/n) []: " read ANS ANS=`echo $ANS` case $ANS in Y | y ) PASS= break ;; N | n ) PASS=REPEAT continue 2 ;; * ) echo "You must answer 'y' or 'n' to the following question." continue ;; esac done case $usr_d$usr_u in $media_d$media_u ) echo "You attempted to allocate the /usr file system on ${media_d}${media_u}, whichcontains your distribution medium." continue ;; $root_d$root_u ) ;; * ) (cd /dev; MAKEDEV $usr_d$usr_u >/dev/null) ;; esac dd if=/dev/r${usr_d}${usr_u}c of=/tmp/wrdisk count=1 >/dev/null 2>&1 || { echo "The $usr_D, $usr_d$usr_u is not accessible. Make sure the device ison-line and write enabled." continue } dd if=/tmp/wrdisk of=/dev/r${usr_d}${usr_u}c count=1 >/dev/null 2>&1 || { echo "The $usr_D, $usr_d$usr_u must be write enabled." continue } /etc/chpt -q /dev/r${usr_d}${usr_u}c | sed 1,3d > /tmp/ptable case $? in 0 ) ;; * ) echo "The chpt command failed. Contact your DIGITAL representative." exit 1 ;; esac availp='a b c d e f g h' case $usr_d$usr_u in $root_d$root_u ) avoidp=`cat /tmp/ptable | awk '{if ( $1 == "'$root_p'" ) print $5}' | sed s/,/\ /g` avoidp="$avoidp $root_p" #take out a partition availp=`delet_part "$avoidp" "$availp"` avoidp=`cat /tmp/ptable | awk '{if ( $1 == "b" ) print $5}' | sed s/,/\ /g` avoidp="$avoidp b" #take out b partition availp=`delet_part "$avoidp" "$availp"` ;; esac part=`size_part "$availp" $USRSIZE` def_part=x case $DEF_PT in 1 ) case $usr_d$usr_u in $root_d$root_u ) case $root_D in RA82 | RA90 ) def_part=d ;; * ) def_part=g ;; esac ;; esac ;; esac >/tmp/partsize for k in $part do awk '{if ($1 == "'$k'") {yy=$1; xx=$4/2; zz=$5}} END \{printf " %s\t --- \t%9d\t%s\n",yy,xx,zz}' /tmp/ptable >>/tmp/partsize done part=`cat /tmp/partsize` usr_p=`ask_part "$part" "/usr file system" "$usr_d$usr_u" $def_part` echo "Making the new file system for /usr on /dev/r$usr_d$usr_u$usr_p $usr_D ${LL}" echo "Making the new file system for /usr on /dev/r$usr_d$usr_u$usr_p $usr_D" 2>&1 >> /FILESYS.log umount /usr > /dev/null 2>&1 newfs -n /dev/r$usr_d$usr_u$usr_p $usr_D 2>&1 >> /FILESYS.log case $? in 0 ) ;; * ) echo "The newfs command failed to construct the /usr file system on/dev/r$usr_d$usr_u$usr_p $usr_D. ${ERMSG13}" continue ;; esac mount /dev/$usr_d$usr_u$usr_p /usr case $? in 0 ) ;; * ) echo "The mount command failed to mount the /usr file system on/dev/r$usr_d$usr_u$usr_p. ${ERMSG13} " continue ;; esac breakdone## for the first swap area#while : truedo echo "*** ALLOCATE THE SWAP1 SPACE ***You can allocate the swap1 space to one of the disks listed in thetable below. See the Guide to Installing ULTRIX for an explanation ofthis table: " ROUTINE="SWAP1 SPACE ALLOCATION" export ROUTINE SWAP1=`finder -f` set xx $SWAP1 swap1_D=$2; swap1_d=$3; swap1_u=$4 while : do echo -n "You selected ${swap1_D}, device number ${swap1_u}. Make sure this disk ison line and write-enabled (if applicable to this drive) and thenconfirm your choice.Use ${swap1_D}, ${swap1_d}${swap1_u} for swap1 space? (y/n) []: " read ANS ANS=`echo $ANS` case $ANS in Y | y ) PASS= break ;; N | n ) continue 2 ;; * ) echo "You must answer 'y' or 'n' to the following question." continue ;; esac done case $swap1_d$swap1_u in $root_d$root_u ) ;; * ) echo -n "The swap1 space on $swap1_d$swap1_u $swap1_D, which is not the same disk as root file system located $root_d$root_u $root_D. Are you sure <y/n>? " read ans ans=`echo $ans` case $ans in [Yy]* ) ;; * ) continue ;; esac ;; esac case $swap1_d$swap1_u in $media_d$media_u ) echo "You attempted to allocate the swap1 space on ${media_d}${media_u}, whichcontains your distribution medium." continue ;; $root_d$root_u | $usr_d$usr_u ) ;; * ) (cd /dev; MAKEDEV $swap1_d$swap1_u >/dev/null) ;; esac dd if=/dev/r${swap1_d}${swap1_u}c of=/tmp/wrdisk count=1 >/dev/null 2>&1 || { echo "The $swap1_D, $swap1_d$swap1_u is not accessible. Make sure the device ison-line and write enabled." continue } dd if=/tmp/wrdisk of=/dev/r${swap1_d}${swap1_u}c count=1 >/dev/null 2>&1 || { echo "The $swap1_D, $swap1_d$swap1_u must be write enabled. " continue } /etc/chpt -q /dev/r${swap1_d}${swap1_u}c | sed 1,3d > /tmp/ptable case $? in 0 ) ;; * ) echo "The chpt command failed. Contact your DIGITAL representative." exit 1 ;; esac # Not allow 'a' to prevent destroying disk partition table. availp="b c d e f g h" case $swap1_d$swap1_u in $root_d$root_u ) avoidp=`cat /tmp/ptable | awk '{if ( $1 == "'$root_p'" ) print $5}' | sed s/,/\ /g` availp=`delet_part "$avoidp" "$availp"` ;; esac case $swap1_d$swap1_u in $usr_d$usr_u ) avoidp=`cat /tmp/ptable | awk '{if ( $1 == "'$usr_p'" ) print $5}' | sed s/,/\ /g` avoidp="$avoidp $usr_p" availp=`delet_part "$avoidp" "$availp"` ;; esac part=`size_part "$availp" $SWAPSIZE` case $part in "" ) echo "${ERMSG11}" continue ;; esac def_part=x case $DEF_PT in 1 ) case $swap1_d$swap1_u in $root_d$root_u ) def_part=b ;; esac ;; esac >/tmp/partsize for k in $part do awk '{if ($1 == "'$k'") {yy=$1; xx=$4/2; zz=$5}} END \{printf " %s\t --- \t%9d\t%s\n",yy,xx,zz}' /tmp/ptable >>/tmp/partsize done part=`cat /tmp/partsize` swap1_p=`ask_part "$part" "swap1 space" "$swap1_d$swap1_u" $def_part` breakdone## for the second swap area#while : truedo echo -n "*** ALLOCATE THE SWAP2 SPACE ***Do you want to allocate a second swap space? (y/n) [n]: " read ans ans=`echo $ans` case $ans in y ) ;; n | "" ) break ;; * ) continue ;; esacecho "You can allocate the swap2 space to one of the disks listed in thetable below. See the Guide to Installing ULTRIX for an explanation ofthis table: " ROUTINE="SWAP2 SPACE ALLOCATION" export ROUTINE SWAP2=`finder -f` set xx $SWAP2 swap2_D=$2; swap2_d=$3; swap2_u=$4 while : do echo -n "You selected ${swap2_D}, device number ${swap2_u}. Make sure this disk ison line and write-enabled (if applicable to this drive) and thenconfirm your choice.Use ${swap2_D}, ${swap2_d}${swap2_u} for swap2 space? (y/n) []: " read ANS ANS=`echo $ANS` case $ANS in Y | y ) PASS= break ;; N | n ) continue 2 ;; * ) echo "You must answer 'y' or 'n' to the following question." continue ;; esac done case $swap2_d$swap2_u in $media_d$media_u ) echo "You attempted to allocate the swap2 space on ${media_d}${media_u}, whichcontains your distribution medium." continue ;; $root_d$root_u | $usr_d$usr_u | $swap1_d$swap1_u ) ;; * ) (cd /dev; MAKEDEV $swap2_d$swap2_u >/dev/null) ;; esac dd if=/dev/r${swap2_d}${swap2_u}c of=/tmp/wrdisk count=1 >/dev/null 2>&1 || { echo "The $swap2_D, $swap2_d$swap2_u is not accessible. Make sure the device ison-line and write enabled." continue } dd if=/tmp/wrdisk of=/dev/r${swap2_d}${swap2_u}c count=1 >/dev/null 2>&1 || { echo "The $swap2_D, $swap2_d$swap2_u must be write enabled. " continue } /etc/chpt -q /dev/r${swap2_d}${swap2_u}c | sed 1,3d > /tmp/ptable case $? in 0 ) ;; * ) echo "The chpt command failed. Contact your DIGITAL representative." exit 1 ;; esac # Not allow 'a' to prevent destroying disk partition table. availp="b c d e f g h"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -