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:
parent
859a265cba
commit
a5f47c23d5
7 changed files with 68 additions and 88 deletions
|
@ -119,11 +119,9 @@
|
||||||
./etc/utmp minix-sys
|
./etc/utmp minix-sys
|
||||||
./home minix-sys
|
./home minix-sys
|
||||||
./home/ast minix-sys
|
./home/ast minix-sys
|
||||||
./home/ast/.ashrc minix-sys
|
|
||||||
./home/ast/.exrc minix-sys
|
./home/ast/.exrc minix-sys
|
||||||
./home/ast/.profile minix-sys
|
./home/ast/.profile minix-sys
|
||||||
./home/bin minix-sys
|
./home/bin minix-sys
|
||||||
./home/bin/.ashrc minix-sys
|
|
||||||
./home/bin/.exrc minix-sys
|
./home/bin/.exrc minix-sys
|
||||||
./home/bin/.profile minix-sys
|
./home/bin/.profile minix-sys
|
||||||
./lib minix-sys
|
./lib minix-sys
|
||||||
|
@ -138,7 +136,6 @@
|
||||||
./multiboot/mod06_memory minix-sys
|
./multiboot/mod06_memory minix-sys
|
||||||
./proc minix-sys
|
./proc minix-sys
|
||||||
./root minix-sys
|
./root minix-sys
|
||||||
./root/.ashrc minix-sys
|
|
||||||
./root/.exrc minix-sys
|
./root/.exrc minix-sys
|
||||||
./root/.profile minix-sys
|
./root/.profile minix-sys
|
||||||
./sbin minix-sys
|
./sbin minix-sys
|
||||||
|
@ -166,7 +163,6 @@
|
||||||
./usr/adm minix-sys
|
./usr/adm minix-sys
|
||||||
./usr/adm/old minix-sys
|
./usr/adm/old minix-sys
|
||||||
./usr/ast minix-sys
|
./usr/ast minix-sys
|
||||||
./usr/ast/.ashrc minix-sys
|
|
||||||
./usr/ast/.exrc minix-sys
|
./usr/ast/.exrc minix-sys
|
||||||
./usr/ast/.profile minix-sys
|
./usr/ast/.profile minix-sys
|
||||||
./usr/benchmarks minix-sys
|
./usr/benchmarks minix-sys
|
||||||
|
|
|
@ -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
|
|
|
@ -1,7 +1,28 @@
|
||||||
# Login shell profile.
|
# Login shell profile.
|
||||||
|
|
||||||
# Activate emacs keybindings and command line history support
|
umask 022
|
||||||
set -o emacs
|
|
||||||
|
# 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.
|
# Check terminal type.
|
||||||
case $TERM in
|
case $TERM in
|
||||||
|
@ -10,6 +31,3 @@ dialup|unknown|network)
|
||||||
TERM="${term:-$TERM}"
|
TERM="${term:-$TERM}"
|
||||||
unset term
|
unset term
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Shell configuration.
|
|
||||||
unset EDITOR; . $HOME/.ashrc
|
|
||||||
|
|
35
etc/profile
35
etc/profile
|
@ -1,5 +1,32 @@
|
||||||
RC_TZ=/etc/rc.timezone
|
# Default system-wide login shell profile.
|
||||||
export TZ=GMT0
|
|
||||||
if [ -f "$RC_TZ" ]
|
# Activate emacs keybindings and command line history support
|
||||||
then . "$RC_TZ"
|
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
|
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
|
||||||
|
|
||||||
|
|
48
etc/rc
48
etc/rc
|
@ -5,22 +5,20 @@ exec 2>/dev/log
|
||||||
exec </dev/null
|
exec </dev/null
|
||||||
|
|
||||||
umask 022
|
umask 022
|
||||||
FSTAB=/etc/fstab
|
|
||||||
TERM="${TERM-minix}"
|
# Same settings as in the default /etc/profile. We do not source this file
|
||||||
PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin:/sbin
|
# as the system administrator may decide to change those values for his users.
|
||||||
RC_TZ=/etc/rc.timezone
|
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
|
export TERM PATH
|
||||||
|
|
||||||
|
# Local variables
|
||||||
ARCH="`sysenv arch`"
|
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()
|
usage()
|
||||||
{
|
{
|
||||||
echo >&2 "Usage: $0 [-saf] start|stop|down"
|
echo >&2 "Usage: $0 [-saf] start|stop|down"
|
||||||
|
@ -60,28 +58,6 @@ edit()
|
||||||
service $opt edit /usr/sbin/$service -label $service "$@"
|
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
|
while getopts 'saf' opt
|
||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
|
@ -148,13 +124,9 @@ start)
|
||||||
mount -r $usrdev /usr
|
mount -r $usrdev /usr
|
||||||
else
|
else
|
||||||
# If we're not booting from CD, fsck + mount using /etc/fstab.
|
# If we're not booting from CD, fsck + mount using /etc/fstab.
|
||||||
read <$FSTAB fstabline
|
fsck -x / $fflag $fsckopts
|
||||||
if [ "$fstabline" = "# Poor man's File System Table." ]
|
|
||||||
then mountfstab_poorman # Old minix /etc/fstab
|
|
||||||
else fsck -x / $fflag $fsckopts
|
|
||||||
mount -a
|
mount -a
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Unmount and free now defunct ramdisk
|
# Unmount and free now defunct ramdisk
|
||||||
umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk"
|
umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk"
|
||||||
|
|
|
@ -43,10 +43,7 @@ esac
|
||||||
# Get the device table.
|
# Get the device table.
|
||||||
FSTAB=/etc/fstab
|
FSTAB=/etc/fstab
|
||||||
touch $FSTAB
|
touch $FSTAB
|
||||||
if grep -q "Poor man" $FSTAB
|
root="`awk <$FSTAB '{ if($2=="/") { print $1 } }'`"
|
||||||
then . $FSTAB
|
|
||||||
else root="`awk <$FSTAB '{ if($2=="/") { print $1 } }'`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# The real root device may be the RAM disk.
|
# The real root device may be the RAM disk.
|
||||||
realroot=`printroot -r`
|
realroot=`printroot -r`
|
||||||
|
|
|
@ -68,9 +68,9 @@ INODES=6000
|
||||||
dd if=/dev/zero seek=$BLOCKS of=$fsimage count=1 bs=$BS >/dev/null 2>&1
|
dd if=/dev/zero seek=$BLOCKS of=$fsimage count=1 bs=$BS >/dev/null 2>&1
|
||||||
|
|
||||||
# -s keeps modes
|
# -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 }'`"
|
sum="`sha1 $fsimage | awk '{ print $4 }'`"
|
||||||
|
|
||||||
if [ $sum != $expect ]
|
if [ $sum != $expect ]
|
||||||
|
|
Loading…
Reference in a new issue