From: Lionel Sambuc Date: Wed, 30 Oct 2013 17:12:35 +0000 (+0100) Subject: Remove some legacy support in rc scripts & some cleanup X-Git-Tag: v3.3.0~514 X-Git-Url: http://zhaoyanbai.com/repos/FAQ?a=commitdiff_plain;h=a5f47c23d5b23ae7b216ed3fb4442881c82c7cb8;p=minix.git Remove some legacy support in rc scripts & some cleanup * Remove support for the Poor Man fstab * Remove checks for the missing ARCH kernel variable * Remove .ashrc which is anyway only read once per login * Cleanup PATH variable Change-Id: Ic32e5749fba502dfa38d4d538860e717580bad60 --- diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index dc4957332..6f4e38367 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -119,11 +119,9 @@ ./etc/utmp minix-sys ./home minix-sys ./home/ast minix-sys -./home/ast/.ashrc minix-sys ./home/ast/.exrc minix-sys ./home/ast/.profile minix-sys ./home/bin minix-sys -./home/bin/.ashrc minix-sys ./home/bin/.exrc minix-sys ./home/bin/.profile minix-sys ./lib minix-sys @@ -138,7 +136,6 @@ ./multiboot/mod06_memory minix-sys ./proc minix-sys ./root minix-sys -./root/.ashrc minix-sys ./root/.exrc minix-sys ./root/.profile minix-sys ./sbin minix-sys @@ -166,7 +163,6 @@ ./usr/adm minix-sys ./usr/adm/old minix-sys ./usr/ast minix-sys -./usr/ast/.ashrc minix-sys ./usr/ast/.exrc minix-sys ./usr/ast/.profile minix-sys ./usr/benchmarks minix-sys diff --git a/etc/ast/.ashrc b/etc/ast/.ashrc deleted file mode 100644 index 5757405c2..000000000 --- a/etc/ast/.ashrc +++ /dev/null @@ -1,30 +0,0 @@ -# Ash initialization. - -test -z "$EDITOR" && { # Don't repeat in subshells. - -umask 022 - -# Favourite editor and pager, search path for binaries, etc. -export EDITOR=vi -export PAGER=less -export PATH=$HOME/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/pkg/X11R6/bin - -} # End of no-repeat. - -# Let cd display the current directory on the status line. -if [ -t 0 -a -f /usr/bin/tget ] && tget -flag hs -then -case $- in *i*) - hostname=$(expr $(uname -n) : '\([^.]*\)') - eval "cd() - { - chdir \"\$@\" && - echo -n '$(tget -str ts \ - "$USER@$hostname:'\"\`pwd\`\"'" \ - -str fs)' - }" - unset hostname - cd . - ;; -esac -fi diff --git a/etc/ast/.profile b/etc/ast/.profile index b74b16542..5ac0d8feb 100644 --- a/etc/ast/.profile +++ b/etc/ast/.profile @@ -1,7 +1,28 @@ # Login shell profile. -# Activate emacs keybindings and command line history support -set -o emacs +umask 022 + +# Favourite editor and pager, search path for binaries, etc. +export EDITOR=vi +export PAGER=less + +# Let cd display the current directory on the status line. +if [ -t 0 -a -f /usr/bin/tget ] && tget -flag hs +then +case $- in *i*) + hostname=$(expr $(uname -n) : '\([^.]*\)') + eval "cd() + { + chdir \"\$@\" && + echo -n '$(tget -str ts \ + "$USER@$hostname:'\"\`pwd\`\"'" \ + -str fs)' + }" + unset hostname + cd . + ;; +esac +fi # Check terminal type. case $TERM in @@ -10,6 +31,3 @@ dialup|unknown|network) TERM="${term:-$TERM}" unset term esac - -# Shell configuration. -unset EDITOR; . $HOME/.ashrc diff --git a/etc/profile b/etc/profile index 0673126c4..71c1a4e1b 100755 --- a/etc/profile +++ b/etc/profile @@ -1,5 +1,32 @@ -RC_TZ=/etc/rc.timezone +# Default system-wide login shell profile. + +# Activate emacs keybindings and command line history support +set -o emacs + +# Set the default path +PATH=/usr/local/bin:/usr/pkg/bin:/usr/bin:/bin + +# Add ~/bin, iff it is present +if [ -e ${HOME}/bin ]; then + PATH=${HOME}/bin:${PATH} +fi + +# Add sbin for root +if [ "x$(id -u)" = "x0" ]; then + PATH=/usr/local/sbin:/usr/pkg/sbin:/usr/sbin:/sbin:${PATH} + + if [ -e ${HOME}/sbin ]; then + PATH=${HOME}/sbin:${PATH} + fi +fi + +# Set the timezone export TZ=GMT0 -if [ -f "$RC_TZ" ] -then . "$RC_TZ" +RC_TZ=/etc/rc.timezone + +if [ -f ${RC_TZ} ]; then + . ${RC_TZ} fi + +export PATH TZ + diff --git a/etc/rc b/etc/rc index af08178c1..587c6ef73 100755 --- a/etc/rc +++ b/etc/rc @@ -5,22 +5,20 @@ exec 2>/dev/log exec &2 "Usage: $0 [-saf] start|stop|down" @@ -60,28 +58,6 @@ edit() service $opt edit /usr/sbin/$service -label $service "$@" } -# This function parses the deprecated minix shellscript-style -# /etc/fstab, and fscks and mounts its filesystems. -mountfstab_poorman() -{ - echo "WARNING: old fstab format, please upgrade!" - - # /etc/fstab lists the root, home, and usr devices. - . $FSTAB - - intr fsck.mfs $fsckopts $usr - if [ ! -z "$home" ] - then intr fsck.mfs $fsckopts $home - fi - - # mount /usr - mount $bin_img $usr /usr - - if [ ! -z "$home" ] - then mount $bin_img $home /home || echo "WARNING: couldn't mount $home on /home" - fi -} - while getopts 'saf' opt do case $opt in @@ -148,12 +124,8 @@ start) mount -r $usrdev /usr else # If we're not booting from CD, fsck + mount using /etc/fstab. - read <$FSTAB fstabline - if [ "$fstabline" = "# Poor man's File System Table." ] - then mountfstab_poorman # Old minix /etc/fstab - else fsck -x / $fflag $fsckopts - mount -a - fi + fsck -x / $fflag $fsckopts + mount -a fi # Unmount and free now defunct ramdisk diff --git a/releasetools/mkboot b/releasetools/mkboot index 169a8c0f3..b2abee8df 100755 --- a/releasetools/mkboot +++ b/releasetools/mkboot @@ -43,10 +43,7 @@ esac # Get the device table. FSTAB=/etc/fstab touch $FSTAB -if grep -q "Poor man" $FSTAB -then . $FSTAB -else root="`awk <$FSTAB '{ if($2=="/") { print $1 } }'`" -fi +root="`awk <$FSTAB '{ if($2=="/") { print $1 } }'`" # The real root device may be the RAM disk. realroot=`printroot -r` diff --git a/test/testmfs.sh b/test/testmfs.sh index f597a993f..c118276e4 100755 --- a/test/testmfs.sh +++ b/test/testmfs.sh @@ -68,9 +68,9 @@ INODES=6000 dd if=/dev/zero seek=$BLOCKS of=$fsimage count=1 bs=$BS >/dev/null 2>&1 # -s keeps modes -mkproto -s -b $BLOCKS -i $INODES $testdir >$protofile +/usr/sbin/mkproto -s -b $BLOCKS -i $INODES $testdir >$protofile -mkfs.mfs -T 1 -b $BLOCKS -i $INODES $fsimage $protofile >/dev/null 2>&1 +/sbin/mkfs.mfs -T 1 -b $BLOCKS -i $INODES $fsimage $protofile >/dev/null 2>&1 sum="`sha1 $fsimage | awk '{ print $4 }'`" if [ $sum != $expect ]