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
This commit is contained in:
Lionel Sambuc 2013-10-30 18:12:35 +01:00
parent 859a265cba
commit a5f47c23d5
7 changed files with 68 additions and 88 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,32 @@
RC_TZ=/etc/rc.timezone
export TZ=GMT0
if [ -f "$RC_TZ" ]
then . "$RC_TZ"
# 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
RC_TZ=/etc/rc.timezone
if [ -f ${RC_TZ} ]; then
. ${RC_TZ}
fi
export PATH TZ

50
etc/rc
View File

@ -5,22 +5,20 @@ exec 2>/dev/log
exec </dev/null
umask 022
FSTAB=/etc/fstab
TERM="${TERM-minix}"
PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin:/sbin
# Same settings as in the default /etc/profile. We do not source this file
# as the system administrator may decide to change those values for his users.
RC_TZ=/etc/rc.timezone
PATH=/usr/local/sbin:/usr/pkg/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/pkg/bin:/usr/bin:/bin
# Set TERM to minix if not present.
TERM="${TERM-minix}"
export TERM PATH
# Local variables
ARCH="`sysenv arch`"
if [ ! "$ARCH" ]
then # Older kernels do not provide an arch sysenv variable.
# We assume we are on x86 then, as existing systems with
# kernel and userland (i.e. this script) unsynchronized
# will be x86.
ARCH=i386
fi
usage()
{
echo >&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

View File

@ -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`

View File

@ -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 ]