Initial revision

This commit is contained in:
Ben Gras
2005-04-21 14:53:53 +00:00
commit 9865aeaa79
2264 changed files with 411685 additions and 0 deletions

188
commands/scripts/DESCRIBE.sh Executable file
View File

@@ -0,0 +1,188 @@
#!/bin/sh
#
# DESCRIBE 2.2 - Describe the given devices. Author: Kees J. Bot
#
# BUGS
# - Arguments may not contain shell metacharacters.
case $# in
0) flag=; set -$- /dev ;;
*) flag=d ;;
esac
ls -l$flag $* | \
sed -e '/^total/d' \
-e '/^[^bc]/s/.* /BAD BAD /' \
-e '/^[bc]/s/.* \([0-9][0-9]*\), *\([0-9][0-9]*\).* /\1 \2 /' \
| {
ex=0 # exit code
while read major minor path
do
case $path in
/*) name=`expr $path : '.*/\\(.*\\)$'`
;;
*) name=$path
esac
dev= des=
case $major in # One of the controllers? What is its controller nr?
3) ctrlr=0 ;;
8) ctrlr=1 ;;
10) ctrlr=2 ;;
12) ctrlr=3 ;;
esac
case $major,$minor in
1,0) des="RAM disk" dev=ram
;;
1,1) des="memory" dev=mem
;;
1,2) des="kernel memory" dev=kmem
;;
1,3) des="null device, data sink" dev=null
;;
2,*) drive=`expr $minor % 4`
case `expr $minor - $drive` in
0) des='auto density' dev="fd$drive"
;;
4) des='360k, 5.25"' dev="pc$drive"
;;
8) des='1.2M, 5.25"' dev="at$drive"
;;
12) des='360k in 720k, 5.25"' dev="qd$drive"
;;
16) des='720k, 3.5"' dev="ps$drive"
;;
20) des='360k in 1.2M, 5.25"' dev="pat$drive"
;;
24) des='720k in 1.2M, 5.25"' dev="qh$drive"
;;
28) des='1.44M, 3.5"' dev="PS$drive"
;;
112) des='auto partition 0' dev="fd${drive}p0"
;;
116) des='auto partition 1' dev="fd${drive}p1"
;;
120) des='auto partition 2' dev="fd${drive}p2"
;;
124) des='auto partition 3' dev="fd${drive}p3"
;;
*) dev=BAD
esac
des="floppy drive $drive ($des)"
;;
[38],[05]|[38],[123][05]|1[02],[05]|1[02],[123][05])
drive=`expr $minor / 5`
des="controller $ctrlr disk $drive" dev=c${ctrlr}d${drive}
;;
[38],?|[38],[123]?|1[02],?|1[02],[123]?)
drive=`expr $minor / 5`
par=`expr $minor % 5 - 1`
des="controller $ctrlr disk $drive partition $par"
dev=c${ctrlr}d${drive}p${par}
;;
[38],12[89]|[38],1[3-9]?|[38],2??|1[02],12[89]|1[02],1[3-9]?|1[02],2??)
drive=`expr \\( $minor - 128 \\) / 16`
par=`expr \\( \\( $minor - 128 \\) / 4 \\) % 4`
sub=`expr \\( $minor - 128 \\) % 4`
des="hard disk $drive, partition $par, subpartition $sub"
des="controller $ctrlr disk $drive partition $par slice $sub"
#par=`expr $drive '*' 5 + $par`
dev=c${ctrlr}d${drive}p${par}s${sub}
;;
[38],6[4-9]|[38],7?|1[02],6[4-9]|1[02],7?)
tape=`expr \\( $minor - 64 \\) / 2`
case $minor in
*[02468])
des="controller $ctrlr tape $tape (non-rewinding)"
dev=c${ctrlr}t${tape}n
;;
*[13579])
des="controller $ctrlr tape $tape (rewinding)"
dev=c${ctrlr}t${tape}
esac
;;
4,0) des="console device" dev=console
;;
4,[1-7])des="virtual console $minor" dev=ttyc$minor
;;
4,15) des="diagnostics device" dev=log
;;
4,1[6-9])
line=`expr $minor - 16`
des="serial line $line" dev=tty0$line
;;
4,12[89]|4,1[3-8]?|4,19[01])
p=`expr \\( $minor - 128 \\) / 16 | tr '0123' 'pqrs'`
n=`expr $minor % 16`
test $n -ge 10 && n=`expr $n - 10 | tr '012345' 'abcdef'`
des="pseudo tty `expr $minor - 128`" dev=tty$p$n
;;
4,???)
p=`expr \\( $minor - 192 \\) / 16 | tr '0123' 'pqrs'`
n=`expr $minor % 16`
test $n -ge 10 && n=`expr $n - 10 | tr '012345' 'abcdef'`
des="controller of tty$p$n" dev=pty$p$n
;;
5,0) des="anonymous tty" dev=tty
;;
6,0) des="line printer, parallel port" dev=lp
;;
7,*)
d=`expr $minor % 8`
n=`expr $minor / 8`
case $d in
0) case $name in
psip*)
des="Pseudo IP #$n" dev=psip
;;
*) des="raw ethernet #$n" dev=eth
esac
;;
1) des="raw IP #$n" dev=ip
;;
2) des="TCP/IP #$n" dev=tcp
;;
3) des="UDP #$n" dev=udp
esac
case $d in
[0123])
if [ "$name" = "$dev" ]
then
des="$des (default)"
else
dev=$dev$n
fi
esac
;;
13,0)
des="audio" dev=audio
;;
14,0)
des="audio mixer" dev=mixer
;;
BAD,BAD)
des= dev=
;;
*) dev=BAD
esac
case $name:$dev in
*:)
echo "$path: not a device" >&2
ex=1
;;
*:*BAD*)
echo "$path: cannot describe: major=$major, minor=$minor" >&2
ex=1
;;
$dev:*)
echo "$path: $des"
;;
*:*) echo "$path: nonstandard name for $dev: $des"
esac
done
exit $ex
}

28
commands/scripts/M.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
#
# M, U - mount or unmount standard devices.
case $#:$2 in
1:|2:-r) ;;
*) echo "Usage: $0 <abbreviation> [-r]" >&2; exit 1
esac
. /etc/fstab
dev=$1 dir=$1
case $1 in
0) dev=/dev/fd0 dir=fd0 ;;
1) dev=/dev/fd1 dir=fd1 ;;
PS0|at0|fd0|pat0|pc0|ps0) dev=/dev/$dev dir=fd0 ;;
PS1|at1|fd1|pat1|pc1|ps1) dev=/dev/$dev dir=fd1 ;;
root) dev=$root ;;
tmp) dev=$tmp ;;
usr) dev=$usr ;;
*) dev=/dev/$dev dir=mnt
esac
case $0 in
*M) mount $dev /$dir $2 ;;
*U) umount $dev
esac

222
commands/scripts/MAKEDEV.sh Executable file
View File

@@ -0,0 +1,222 @@
#!/bin/sh
#
# MAKEDEV 3.3 - Make special devices. Author: Kees J. Bot
case $1 in
-n) e=echo; shift ;; # Just echo when -n is given.
*) e=
esac
case $#:$1 in
1:std) # Standard devices.
set -$- mem fd0 fd1 fd0p0 fd1p0 \
c0d0 c0d0p0 c0d0p0s0 c0d1 c0d1p0 c0d1p0s0 \
c0d2 c0d2p0 c0d2p0s0 c0d3 c0d3p0 c0d3p0s0 \
tty ttyc1 ttyc2 ttyc3 tty00 tty01 ttyp0 ttyp1 ttyp2 ttyp3 eth
;;
0:|1:-\?)
cat >&2 <<EOF
Usage: $0 [-n] key ...
Where key is one of the following:
ram mem kmem null # One of these makes all these memory devices
fd0 fd1 ... # Floppy devices for drive 0, 1, ...
fd0p0 fd1p0 ... # Make floppy partitions fd0p[0-3], fd1p[0-3], ...
c0d0 c0d1 ... # Make disks c0d0, c0d1, ...
c0d0p0 c0d1p0 ... # Make partitions c0d0p[0-3], c0d1p[0-3], ...
c0d0p0s0 c0d1p0s0 ... # Subparts c0d0p[0-3]s[0-3], c0d1p[0-3]s[0-3], ...
c1d0(p0)(s0) # Likewise for controller 1
c0t0 c0t1 c1t0 ... # Make tape devices c0t0, c0t0n, c0t1, ...
console lp tty log # One of these makes all four
ttyc1 ... ttyc7 # Virtual consoles
tty00 ... tty03 # Make serial lines
ttyp0 ... ttyq0 ... # Make tty, pty pairs
eth ip tcp udp # One of these makes some TCP/IP devices
audio mixer # Make audio devices
std # All standard devices
EOF
exit 1
esac
umask 077
ex=0
for dev
do
case $dev in # One of the controllers? Precompute major device nr.
c0*) maj=3 ;;
c1*) maj=8 ;;
c2*) maj=10 ;;
c3*) maj=12 ;;
esac
case $dev in
ram|mem|kmem|null)
# Memory devices.
#
$e mknod ram b 1 0; $e chmod 600 ram
$e mknod mem c 1 1; $e chmod 640 mem
$e mknod kmem c 1 2; $e chmod 640 kmem
$e mknod null c 1 3; $e chmod 666 null
$e chgrp kmem ram mem kmem null
;;
fd[0-3])
# Floppy disk drive n.
#
d=`expr $dev : '.*\\(.\\)'` # Drive number.
$e mknod $dev b 2 $d
$e chmod 666 $dev
;;
pc[0-3]|at[0-3]|qd[0-3]|ps[0-3]|pat[0-3]|qh[0-3]|PS[0-3])
# Obsolete density locked floppy disk drive n.
#
d=`expr $dev : '.*\\(.\\)'` # Drive number.
m=$d # Minor device number.
$e mknod pc$d b 2 $m; m=`expr $m + 4`
$e mknod at$d b 2 $m; m=`expr $m + 4`
$e mknod qd$d b 2 $m; m=`expr $m + 4`
$e mknod ps$d b 2 $m; m=`expr $m + 4`
$e mknod pat$d b 2 $m; m=`expr $m + 4`
$e mknod qh$d b 2 $m; m=`expr $m + 4`
$e mknod PS$d b 2 $m; m=`expr $m + 4`
$e chmod 666 pc$d at$d qd$d ps$d pat$d qh$d PS$d
;;
fd[0-3]p[0-3])
# Floppy disk partitions.
#
n=`expr $dev : '\\(.*\\)..'` # Name prefix.
d=`expr $dev : '..\\(.\\)'` # Drive number.
m=`expr 112 + $d` # Minor of partition 0.
alldev=
for p in 0 1 2 3
do
m=`expr 112 + $d + $p '*' 4` # Minor of partition $p.
$e mknod ${n}p${p} b 2 $m # Make e.g. fd0p0 - fd0p3
alldev="$alldev ${n}p${p}"
done
$e chmod 666 $alldev
;;
c[0-3]d[0-7])
# Whole disk devices.
d=`expr $dev : '...\\(.\\)'` # Disk number.
m=`expr $d '*' 5` # Minor device number.
$e mknod $dev b $maj $m
$e chmod 600 $dev
;;
c[0-3]d[0-7]p[0-3])
# Disk primary partitions.
n=`expr $dev : '\\(.*\\).'` # Name prefix.
d=`expr $dev : '...\\(.\\)'` # Disk number.
alldev=
for p in 0 1 2 3
do
m=`expr $d '*' 5 + 1 + $p` # Minor device number.
$e mknod $n$p b $maj $m
alldev="$alldev $n$p"
done
$e chmod 600 $alldev
;;
c[0-3]d[0-7]p[0-3]s[0-3])
# Disk subpartition.
n=`expr $dev : '\\(.*\\)...'` # Name prefix.
d=`expr $dev : '...\\(.\\)'` # Disk number.
alldev=
for p in 0 1 2 3
do
for s in 0 1 2 3
do
m=`expr 128 + $d '*' 16 + $p '*' 4 + $s` # Minor device nr.
$e mknod ${n}${p}s${s} b $maj $m
alldev="$alldev ${n}${p}s${s}"
done
done
$e chmod 600 $alldev
;;
c[0-3]t[0-7]|c[0-3]t[0-7]n)
# Tape devices.
n=`expr $dev : '\\(....\\)'` # Name prefix.
t=`expr $dev : '...\\(.\\)'` # Tape number.
m=`expr 64 + $t '*' 2` # Minor device number.
$e mknod ${n}n c $maj $m
$e mknod ${n} c $maj `expr $m + 1`
$e chmod 660 ${n}n ${n}
;;
console|lp|tty|log)
# Console, line printer, anonymous tty, diagnostics device.
#
$e mknod console c 4 0
$e chmod 600 console
$e chgrp tty console
$e mknod tty c 5 0
$e chmod 666 tty
$e mknod lp c 6 0
$e chown daemon lp
$e chgrp daemon lp
$e chmod 200 lp
$e mknod log c 4 15
$e chmod 222 log
;;
ttyc[1-7])
# Virtual consoles.
#
m=`expr $dev : '....\\(.*\\)'` # Minor device number.
$e mknod $dev c 4 $m
$e chgrp tty $dev
$e chmod 600 $dev
;;
tty0[0-3])
# Serial lines.
#
n=`expr $dev : '.*\\(.\\)'`
$e mknod $dev c 4 `expr $n + 16`
$e chmod 666 $dev
$e chgrp tty $dev
;;
tty[p-s][0-9a-f]|pty[p-s][0-9a-f])
# Pseudo ttys.
#
dev=`expr $dev : '...\\(..\\)'`
g=`expr $dev : '\\(.\\)'` # Which group.
g=`echo $g | tr 'pqrs' '0123'`
n=`expr $dev : '.\\(.\\)'` # Which pty in the group.
case $n in
[a-f]) n=1`echo $n | tr 'abcdef' '012345'`
esac
$e mknod tty$dev c 4 `expr $g '*' 16 + $n + 128`
$e mknod pty$dev c 4 `expr $g '*' 16 + $n + 192`
$e chgrp tty tty$dev pty$dev
$e chmod 666 tty$dev pty$dev
;;
eth|ip|tcp|udp|eth0|ip0|tcp0|udp0)
# TCP/IP devices.
#
$e mknod eth0 c 7 0 # Network 0 (Ethernet)
$e mknod ip0 c 7 1
$e mknod tcp0 c 7 2
$e mknod udp0 c 7 3
$e chmod 600 eth0 ip0
$e chmod 666 tcp0 udp0
$e ln -f eth0 eth # Default interface
$e ln -f ip0 ip
$e ln -f tcp0 tcp
$e ln -f udp0 udp
;;
audio|mixer)
# Audio devices.
#
$e mknod audio c 13 0
$e mknod mixer c 14 0
$e chmod 666 audio mixer
;;
*)
echo "$0: don't know about $dev" >&2
ex=1
esac
done
exit $ex

132
commands/scripts/Makefile Executable file
View File

@@ -0,0 +1,132 @@
# Makefile for cmd/scripts.
CFLAGS = -D_MINIX -D_POSIX_SOURCE
CCLD = $(CC) -i $(CFLAGS)
MAKE = exec make -$(MAKEFLAGS) install
all: # Does nothing
install: usr root
# Commands on the /usr partition.
usr: \
/usr/bin/DESCRIBE \
/usr/bin/M \
/usr/bin/U \
/usr/bin/MAKEDEV \
/usr/bin/adduser \
/usr/bin/cd \
/usr/bin/[ \
/usr/bin/command \
/usr/bin/echo \
/usr/bin/expr \
/usr/bin/false \
/usr/bin/getopts \
/usr/bin/read \
/usr/bin/test \
/usr/bin/true \
/usr/bin/umask \
/usr/bin/wait \
/usr/bin/checkhier \
/usr/bin/clear \
/usr/bin/clr \
/usr/bin/makewhatis \
/usr/bin/mkdist \
/usr/bin/setup \
/usr/bin/spell \
/usr/bin/srccrc \
/usr/bin/svclog \
/usr/bin/whatis \
/usr/bin/apropos \
/usr/bin/whereis \
# Commands on the root partition.
root: \
/bin/M \
/bin/U \
/bin/cd \
/bin/[ \
/bin/command \
/bin/echo \
/bin/expr \
/bin/false \
/bin/getopts \
/bin/read \
/bin/test \
/bin/true \
/bin/umask \
/bin/wait \
clean:
/usr/bin/DESCRIBE: DESCRIBE.sh
install -c -o bin $? $@
/usr/bin/M: M.sh
install -c -o bin $? $@
/usr/bin/U: /usr/bin/M
install -l $? $@
/usr/bin/MAKEDEV: MAKEDEV.sh
install -c -o bin $? $@
/usr/bin/adduser: adduser.sh
install -c -o bin $? $@
/usr/bin/cd: cd.sh
install -c -o bin $? $@
/usr/bin/[ /usr/bin/command /usr/bin/echo /usr/bin/expr /usr/bin/false \
/usr/bin/getopts /usr/bin/read /usr/bin/test /usr/bin/true /usr/bin/umask \
/usr/bin/wait: /usr/bin/cd
install -l $? $@
/usr/bin/checkhier: checkhier.sh
install -c -o bin $? $@
/usr/bin/clear: clear.sh
install -c -o bin $? $@
/usr/bin/clr: /usr/bin/clear
install -l $? $@
/usr/bin/makewhatis: makewhatis.sh
install -c -o bin $? $@
/usr/bin/mkdist: mkdist.sh
install -c -o bin $? $@
/usr/bin/setup: setup.sh
install -c -o bin $? $@
/usr/bin/spell: spell.sh
install -c -o bin $? $@
/usr/bin/srccrc: srccrc.sh
install -c -o bin $? $@
/usr/bin/svclog: svclog.sh
install -c -o bin $? $@
/usr/bin/whatis: whatis.sh
install -c -o bin $? $@
/usr/bin/apropos: /usr/bin/whatis
install -l $? $@
/usr/bin/whereis: whereis.sh
install -c -o bin $? $@
/bin/M: /usr/bin/M
install -c -o bin $? $@
/bin/U: /bin/M
install -l $? $@
/bin/cd: /usr/bin/cd
install -lc $? $@
/bin/[ /bin/command /bin/echo /bin/expr /bin/false /bin/getopts \
/bin/read /bin/test /bin/true /bin/umask /bin/wait: /bin/cd
install -l $? $@

121
commands/scripts/adduser.sh Executable file
View File

@@ -0,0 +1,121 @@
#!/bin/sh
#
# adduser 1.0 - add a new user to the system Author: Kees J. Bot
# 16 Jan 1996
# Check arguments.
case "$#" in
3) user="$1"; group="$2"; home="$3"
;;
*) echo "Usage: adduser user group home-dir" >&2; exit 1
esac
# We need to be root.
case "`id`" in
'uid=0('*)
;;
*) echo "adduser: you must be root to add users" >&2; exit 1
esac
# User and group names must be alphanumeric and no longer than 8 characters.
len=`expr "$user" : '[a-z][a-z0-9]*$'`
if [ "$len" -eq 0 -o "$len" -gt 8 ]
then
echo >&2 \
"adduser: the user name must be alphanumeric and no longer than 8 characters"
exit 1
fi
len=`expr "$group" : '[a-z][a-z0-9]*$'`
if [ "$len" -eq 0 -o "$len" -gt 8 ]
then
echo >&2 \
"adduser: the group name must be alphanumeric and no longer than 8 characters"
exit 1
fi
# The new user name must not exist, but the group must exist.
if grep "^$user:" /etc/passwd >/dev/null
then
echo "adduser: user $user already exists" >&2
exit 1
fi
gid=`sed -e "/^$group:/!d" -e 's/^[^:]*:[^:]*:\\([^:]*\\):.*/\\1/' /etc/group`
if [ `expr "$gid" : '[0-9]*$'` -eq 0 ]
then
echo "adduser: group $group does not exist" >&2
exit 1
fi
# Find the first free user-id of 10 or higher.
uid=10
while grep "^[^:]*:[^:]*:$uid:.*" /etc/passwd >/dev/null
do
uid=`expr $uid + 1`
done
# No interruptions.
trap '' 1 2 3 15
# Lock the password file.
ln /etc/passwd /etc/ptmp || {
echo "adduser: password file busy, try again later"
exit 1
}
# Make the new home directory, it should not exist already.
mkdir "$home" || {
rm -rf /etc/ptmp
exit 1
}
# Make the new home directory by copying the honorary home directory of our
# fearless leader.
echo cpdir /usr/ast "$home"
cpdir /usr/ast "$home" || {
rm -rf /etc/ptmp "$home"
exit 1
}
# Change the ownership to the new user.
echo chown -R $uid:$gid "$home"
chown -R $uid:$group "$home" || {
rm -rf /etc/ptmp "$home"
exit 1
}
# Is there a shadow password file? If so add an entry.
if [ -f /etc/shadow ]
then
echo "echo $user::0:0::: >>/etc/shadow"
echo "$user::0:0:::" >>/etc/shadow || {
rm -rf /etc/ptmp "$home"
exit 1
}
pwd="##$user"
else
pwd=
fi
# Finish up by adding a password file entry.
echo "echo $user:$pwd:$uid:$gid:$user:$home: >>/etc/passwd"
echo "$user:$pwd:$uid:$gid:$user:$home:" >>/etc/passwd || {
rm -rf /etc/ptmp "$home"
exit 1
}
# Remove the lock.
rm /etc/ptmp || exit
echo "
The new user $user has been added to the system. Note that the password,
full name, and shell may be changed with the commands passwd(1), chfn(1),
and chsh(1). The password is now empty, so only console logins are possible."
if [ $gid = 0 ]
then
echo "\
Also note that a new operator needs an executable search path (\$PATH) that
does not contain the current directory (an empty field or "." in \$PATH)."
fi
exit 0

11
commands/scripts/cd.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
#
# cd 1.3 - equivalents for normally builtin commands. Author: Kees J. Bot
case $0 in
*/*) command="`expr "$0" : '.*/\(.*\)'`"
;;
*) command="$0"
esac
"$command" "$@"

183
commands/scripts/checkhier.sh Executable file
View File

@@ -0,0 +1,183 @@
#!/bin/sh
#
# checkhier 2.7 - check the directory hierarchy Author: Kees J. Bot
# 7 May 1995
case "`id`" in
'uid=0('*) ;;
*) echo "$0: must be run by root" >&2
exit 1
esac
# List of all interesting top level files and directories, with mode,
# owner and group. Only the key files are listed, the rest is owned
# by bin, has mode 755 or 644, and is not critical to the operation of
# the system.
{
cat <<'EOF'
drwxr-xr-x root operator /
drwxr-xr-x bin operator /bin
drwxr-xr-x root operator /dev
drwxr-xr-x root operator /etc
-rw-r--r-- root operator /etc/fstab
-rw-r--r-- root operator /etc/group
-rw-r--r-- root operator /etc/hostname.file
-rw-r--r-- root operator /etc/inet.conf
-rw-r--r-- root operator /etc/motd
-rw-r--r-- root operator /etc/mtab
-rw-r--r-- root operator /etc/passwd
-rw-r--r-- root operator /etc/profile
-rw-r--r-- root operator /etc/protocols
-rw-r--r-- root operator /etc/rc
-rw-r--r-- root operator /etc/services
-rw------- root operator /etc/shadow
-rw-r--r-- root operator /etc/termcap
-rw-r--r-- root operator /etc/ttytab
-rw-r--r-- root operator /etc/utmp
dr-xr-xr-x root operator /fd0
dr-xr-xr-x root operator /fd1
dr-xr-xr-x root operator /mnt
dr-xr-xr-x root operator /root
drwxrwxrwx root operator /tmp
drwxr-xr-x root operator /usr
drwxr-xr-x root operator /usr/adm
-rw-r--r-- root operator /usr/adm/lastlog
-rw-r--r-- root operator /usr/adm/wtmp
drwxr-xr-x ast other /usr/ast
drwxr-xr-x bin operator /usr/bin
drwxr-xr-x root operator /usr/etc
drwxr-xr-x bin operator /usr/include
drwxr-xr-x bin operator /usr/lib
drwxrwxr-x root operator /usr/local
drwxrwxr-x bin operator /usr/local/bin
drwxrwxr-x bin operator /usr/local/include
drwxrwxr-x bin operator /usr/local/lib
drwxrwxr-x bin operator /usr/local/man
drwxrwxr-x bin operator /usr/local/src
drwxr-xr-x bin operator /usr/man
drwxr-xr-x bin operator /usr/mdec
drwx------ root operator /usr/preserve
drwxr-xr-x root operator /usr/run
drwxr-xr-x root operator /usr/spool
drwx--x--x root operator /usr/spool/at
drwx--x--x root operator /usr/spool/at/past
drwx------ root operator /usr/spool/crontabs
drwxrwxr-x root uucp /usr/spool/locks
drwx------ daemon daemon /usr/spool/lpd
drwxr-xr-x bin operator /usr/src
drwxrwxrwx root operator /usr/tmp
-rwsr-xr-x root ? /usr/bin/at
-rwsr-xr-x root ? /usr/bin/chfn
-rwsr-xr-x root ? /usr/bin/chsh
-rwsr-xr-x root ? /usr/bin/df
-rwsr-xr-x root ? /usr/bin/elvprsv
-rwsr-xr-x root ? /usr/bin/elvrec
-rwsr-xr-x root ? /usr/bin/format
-rwsr-xr-x root ? /usr/bin/hostaddr
-rwsr-xr-x root ? /usr/bin/install
-rwsr-xr-x daemon ? /usr/bin/lpd
-rwsr-xr-x root ? /usr/bin/mail
-rwsr-xr-x root ? /usr/bin/mount
-rwsr-xr-x root ? /usr/bin/passwd
-rwsr-xr-x root ? /usr/bin/ping
-rwxr-sr-x ? kmem /usr/bin/ps
-rwsr-xr-- root ? /usr/bin/shutdown
-rwsr-xr-x root ? /usr/bin/su
-rwxr-sr-x ? uucp /usr/bin/term
-rwsr-xr-x root ? /usr/bin/umount
-rwxr-sr-x ? tty /usr/bin/write
EOF
} | {
# Check if each file has the proper attributes. Offer a correction
# if not.
banner="\
# List of commands to fix the top level hierarchy. Do not apply these
# commands blindly, but check and repair by hand.
"
while read mode owner group file
do
( # "fix" a memory leak in set...
set -$- `ls -ld $file 2>/dev/null` '' '' '' ''
curmode=$1 curowner=$3 curgroup=$4
test $owner = '?' && curowner=$owner
test $group = '?' && curgroup=$group
# File types?
if [ x`expr "$mode" : '\\(.\\)'` != \
x`expr "$curmode" : '\\(.\\)'` ]
then
case $curmode in
?*) echo "${banner}rm -r $file"
banner=
esac
curmode= curowner= curgroup=
case $mode in
d*) echo "${banner}mkdir $file"
;;
-*) echo "${banner}> $file"
;;
*) echo "$0: $mode $file: unknown filetype" >&2
exit 1
esac
banner=
fi
# Mode?
if [ x$mode != x$curmode ]
then
octmode=
m=$mode
for i in u g o
do
r=0 w=0 x=0
case $m in
?r??*) r=4
esac
case $m in
??w?*) w=2
esac
case $m in
???[xst]*) x=1
esac
octmode=$octmode`expr $r + $w + $x`
m=`expr $m : '...\\(.*\\)'`
done
r=0 w=0 x=0
case $mode in
???[sS=]??????) r=4
esac
case $mode in
??????[sS=]???) w=2
esac
case $mode in
?????????[tT=]) x=1
esac
case $r$w$x in
000) ;;
*) octmode=`expr $r + $w + $x`$octmode
esac
echo "${banner}chmod $octmode $file"
banner=
fi
# Ownership?
if [ x$owner != x$curowner -o x$group != x$curgroup ]
then
echo "${banner}chown $owner:$group $file"
banner=
fi
# The Minix shell forgets processes, so wait explicitly.
wait
case "$banner" in '') exit 1;; *) exit 0;; esac) || banner=
done
case "$banner" in
'') exit 1
esac
exit 0
}

6
commands/scripts/clear.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
#
# clear 1.0 - clear the screen Author: Kees J. Bot
# 30 Mar 1996
export PATH=/bin:/usr/bin
exec tget -str cl

84
commands/scripts/makewhatis.sh Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/sh
#
# makewhatis 2.0 - make whatis(5) database. Author: Kees J. Bot.
#
# Make the whatis database of a man directory from the manual pages.
case $1 in
-*) set -$- x x
esac
case $# in
1) ;;
*) echo "Usage: $0 <mandir>" >&2
exit 1
esac
cd $1 || exit
{
# First pass, gathering the .SH NAME lines in various forms.
# First the man[1-8] directories, the titles are under the .SH NAME
# section header.
for chap in 1 2 3 4 5 6 7 8
do
for page in man$chap/*.$chap
do
if test -f "$page"; then # (Old sh barfs on 'continue')
sed -e 's/ / /g
/^\.SH NAME/,/^\.SH /!d
/^\.SH /d
s/\\f.//g # should not be needed
s/\\s[+-].//g
s/\\s.//g
s/\\//
'"s/ - / ($chap) - /" < "$page"
fi
done
done
# The Minix "Book style" documents, look for .CD
for page in man9/*.9
do
if test -f "$page"; then
sed -e 's/ / /g
/^\.CD /!d
s/^[^"]*"//
s/"[^"]*$//
s/\\(en/-/g
s/\\f.//g
s/\\s[+-].//g
s/\\s.//g
s/\\\*(M2/MINIX/g
s/\\//
'"s/ - / (9) - /" < "$page"
fi
done
# Some people throw extra flat text files into the cat[1-9]
# directories. It would be nice if man(1) can find them.
trap 'rm -f /tmp/mkw[cmn]$$; exit 1' 1 2 15
for chap in 1 2 3 4 5 6 7 8 9
do
ls cat$chap 2>/dev/null >/tmp/mkwc$$
ls man$chap 2>/dev/null >/tmp/mkwm$$
comm -23 /tmp/mkwc$$ /tmp/mkwm$$ >/tmp/mkwn$$
sed -e "/.*\\.$chap\$/!d
s/\\.$chap\$/ ($chap) - ???/" < /tmp/mkwn$$
done
rm -f /tmp/mkw[cmn]$$
} | {
# Second pass, remove empty lines, leading and trailing spaces,
# multiple spaces to one space, remove lines without a dash.
sed -e 's/ */ /g
s/^ //
s/ $//
/^$/d
/-/!d'
} | {
# Third pass, sort by section.
sort -t'(' +1 -o whatis
}

301
commands/scripts/mkdist.sh Executable file
View File

@@ -0,0 +1,301 @@
#!/bin/sh
#
# mkdist 3.6 - Make a Minix distribution Author: Kees J. Bot
# 20 Dec 1994
system=`uname`
usage()
{
case $system in
Minix) echo "Usage: $0" >&2
;;
Minix-vmd) echo "Usage: $0 base-path root-device usr-device" >&2
esac
exit 1
}
# No options.
while getopts '' opt; do usage; done
shift `expr $OPTIND - 1`
case $system:$# in
Minix:0)
# Interactive.
case "$0" in
/tmp/*)
rm -f "$0"
;;
*) # Move out of /usr.
cp -p "$0" /tmp/mkdist
exec /tmp/mkdist
esac
std=t
base=/
export PATH=/bin:/usr/bin
;;
Minix-vmd:3)
# Called by an external script from Minix-vmd to help make a distribution.
std=
base="$1" rootdev="$2" usrdev="$3"
esac
usrlist="
bin
bin/MAKEDEV
bin/arch
bin/badblocks
bin/chmod
bin/clone
bin/compress
bin/cp
bin/cpdir
bin/df
`test -f $base/usr/bin/mtools || echo bin/dosdir bin/dosread bin/doswrite`
`test -f $base/usr/bin/mtools && echo bin/mtools`
bin/edparams
bin/getty
bin/grep
bin/installboot
bin/isodir
bin/isoinfo
bin/isoread
bin/kill
bin/ln
bin/login
bin/ls
bin/mined
bin/mkdir
bin/mkfs
bin/mknod
bin/mkswap
bin/mv
bin/od
bin/part
bin/partition
bin/readall
bin/repartition
bin/rm
bin/rmdir
bin/sed
bin/setup
bin/shutdown
bin/sleep
bin/sort
bin/stty
bin/sysenv
bin/tar
bin/uname
bin/uncompress
bin/update
bin/vol
bin/zcat
etc
etc/rc
lib
lib/keymaps
`cd $base/usr && echo lib/keymaps/*`
lib/pwdauth
mdec
mdec/boot
mdec/bootblock
mdec/jumpboot
mdec/masterboot
tmp
"
if [ "$std" ]
then
# Find the root device, and the real root device.
. /etc/fstab
realroot=`printroot -r`
if [ $realroot = $root ]
then
rootdir=/
else
umount $root >/dev/null 2>&1
mount $root /root || exit
rootdir=/root
fi
echo -n "
The installation root and /usr can be put on either one diskette of at least
1.2 Mb, or on two diskettes of at least 720 kb.
Do you want to use a single diskette of at least 1.2 Mb? [y] "; read single
case $single in
''|[yY]*|sure)
single=t
;;
*) single=
esac
echo -n "Which drive to use? [0] "; read drive
case $drive in
'') drive=0
;;
[01]) ;;
*) echo "Please type '0' or '1'" >&2; exit 1
esac
if [ "$single" ]
then
echo -n "Insert the root+usr diskette in drive $drive and hit RETURN"
else
echo -n "Insert the root diskette in drive $drive and hit RETURN"
fi
read ret
rootdev=/dev/fd$drive
v1=-1
else
rootdir=$base
v1='-t 1'
fi
umount $rootdev 2>/dev/null
if [ "$std" ]
then
umount ${rootdev}p1 2>/dev/null
umount ${rootdev}p2 2>/dev/null
else
umount $rootdir/minix 2>/dev/null
umount $rootdir/etc 2>/dev/null
fi
mkfs $v1 -i 272 $rootdev 480 || exit
mount $rootdev /mnt || exit
if [ "$std" ]
then
partition -mf $rootdev 0 81:960 81:240 81:240 >/dev/null || exit
repartition $rootdev >/dev/null || exit
mkfs $v1 ${rootdev}p1 || exit
mkfs $v1 ${rootdev}p2 || exit
mount ${rootdev}p1 $rootdir/minix || exit # Hide /minix and /etc
mount ${rootdev}p2 $rootdir/etc 2>/dev/null # (complains about /etc/mtab)
else
install -d /tmp/.minix || exit
install -d /tmp/.etc || exit # Hide /minix and /etc
mount -t lo /tmp/.minix $rootdir/minix || exit
mount -t lo /tmp/.etc $rootdir/etc || exit
fi
cpdir -vx $rootdir /mnt || exit
install -d -o 0 -g 0 -m 755 /mnt || exit
install -d -o 0 -g 0 -m 555 /mnt/root || exit
install -d -o 0 -g 0 -m 555 /mnt/mnt || exit
install -d -o 0 -g 0 -m 555 /mnt/usr || exit
if [ "$std" ]
then
umount ${rootdev}p2 2>/dev/null # Unhide /etc
umount ${rootdev}p1 || exit # Unhide /minix
else
umount $rootdir/etc || exit # Unhide /etc
umount $rootdir/minix || exit # Unhide /minix
fi
install -d -o 2 -g 0 -m 755 /mnt/minix || exit
install -d -o 2 -g 0 -m 755 /mnt/etc || exit
set `ls -t $rootdir/minix` # Install the latest kernel
install -c $rootdir/minix/$1 /mnt/minix/`echo $1 | sed 's/r[0-9]*$//` || exit
cpdir -v $base/usr/src/etc /mnt/etc || exit # Install a fresh /etc
chown -R 0:0 /mnt/etc # Patch up owner and mode
chmod 600 /mnt/etc/shadow
# Change /etc/fstab.
echo >/mnt/etc/fstab "\
# Poor man's File System Table.
root=unknown
usr=unknown"
# How to install?
echo >/mnt/etc/issue "\
Login as root and run 'setup' to install Minix."
umount $rootdev || exit
test "$std" && umount $root 2>/dev/null
installboot -d $rootdev $base/usr/mdec/bootblock boot >/dev/null
# Partition the root floppy whether necessary or not. (Two images can be
# concatenated, or a combined image can be split later.)
partition -mf $rootdev 0 81:960 0:0 81:1440 81:480 >/dev/null || exit
if [ "$std" ]
then
if [ "$single" ]
then
repartition $rootdev >/dev/null
usrdev=${rootdev}p2
else
echo -n "Insert the usr diskette in drive $drive and hit RETURN"
read ret
usrdev=$rootdev
fi
fi
mkfs $v1 -i 96 $usrdev 720 || exit
mount $usrdev /mnt || exit
install -d -o 0 -g 0 -m 755 /mnt || exit
(cd $base/usr && exec tar cfD - $usrlist) | (cd /mnt && exec tar xvfp -) || exit
umount $usrdev || exit
# Put a "boot the other drive" bootblock on the /usr floppy.
installboot -m $usrdev /usr/mdec/masterboot >/dev/null
# We're done for Minix-vmd here, it has its own ideas on how to package /usr.
test "$std" || exit 0
# Guess the size of /usr in compressed form. Assume compression down to 60%
# of the original size. Use "disk megabytes" of 1000*1024 for a safe guess.
set -$- `df | grep "^$usr"`
size=`expr \\( $4 \\* 6 / 10 + 999 \\) / 1000`
echo -n "
You now need enough diskettes to hold /usr in compressed form, close to
$size Mb total. "
size=
while [ -z "$size" ]
do
if [ "$single" ]; then defsize=1440; else defsize=720; fi
echo -n "What is the size of the diskettes? [$defsize] "; read size
case $size in
'') size=$defsize
;;
360|720|1200|1440)
;;
*) echo "Sorry, I don't believe \"$size\", try again." >&2
size=
esac
done
drive=
while [ -z "$drive" ]
do
echo -n "What floppy drive to use? [0] "; read drive
case $drive in
'') drive=0
;;
[01])
;;
*) echo "It must be 0 or 1, not \"$drive\"."
drive=
esac
done
echo "
Enter the floppies in drive $drive when asked to. Mark them with the volume
numbers!
"
sleep 2
if [ `arch` = i86 ]; then bits=13; else bits=16; fi
>/tmp/DONE
cd /usr && tar cvf - . /tmp/DONE \
| compress -b$bits | vol -w $size /dev/fd$drive &&
echo Done.

368
commands/scripts/setup.sh Executable file
View File

@@ -0,0 +1,368 @@
#!/bin/sh
#
# setup 4.1 - install a Minix distribution Author: Kees J. Bot
# 20 Dec 1994
PATH=/bin:/usr/bin
export PATH
usage()
{
cat >&2 <<'EOF'
Usage: setup # Install a skeleton system on the hard disk.
setup /usr # Install the rest of the system (binaries or sources).
# To install from other things then floppies:
urlget http://... | setup /usr # Read from a web site.
urlget ftp://... | setup /usr # Read from an FTP site.
mtools copy c0d0p0:... - | setup /usr # Read from the C: drive.
dosread c0d0p0 ... | setup /usr # Likewise if no mtools.
EOF
exit 1
}
# No options.
while getopts '' opt; do usage; done
shift `expr $OPTIND - 1`
# Installing a floppy set?
case $# in
0) # No, we're installing a skeleton system on the hard disk.
;;
1)
cd "$1" || exit
# Annoying message still there?
grep "'setup /usr'" /etc/issue >/dev/null 2>&1 && rm -f /etc/issue
if [ -t 0 ]
then
size=bad
while [ "$size" = bad ]
do
echo -n "\
What is the size of the images on the diskettes? [all] "; read size
case $size in
''|360|720|1200|1440)
;;
*) echo "Sorry, I don't believe \"$size\", try again." >&2
size=bad
esac
done
drive=
while [ -z "$drive" ]
do
echo -n "What floppy drive to use? [0] "; read drive
case $drive in
'') drive=0
;;
[01])
;;
*) echo "It must be 0 or 1, not \"$drive\"."
drive=
esac
done
vol -r $size /dev/fd$drive | uncompress | tar xvfp -
else
# Standard input is where we can get our files from.
uncompress | tar xvfp -
fi
echo Done.
exit
;;
*)
usage
esac
# Installing Minix on the hard disk.
# Must be in / or we can't mount or umount.
case "`pwd`" in
/?*)
echo "Please type 'cd /' first, you are locking up `pwd`" >&2
exit 1
esac
case "$0" in
/tmp/*)
rm -f "$0"
;;
*) cp -p "$0" /tmp/setup
exec /tmp/setup
esac
# Find out what we are running from.
exec 9<&0 </etc/mtab # Mounted file table.
read thisroot rest # Current root (/dev/ram or /dev/fd?)
read fdusr rest # USR (/dev/fd? or /dev/fd?p2)
exec 0<&9 9<&-
# What do we know about ROOT?
case $thisroot:$fdusr in
/dev/ram:/dev/fd0p2) fdroot=/dev/fd0 # Combined ROOT+USR in drive 0
;;
/dev/ram:/dev/fd1p2) fdroot=/dev/fd1 # Combined ROOT+USR in drive 1
;;
/dev/ram:/dev/fd*) fdroot=unknown # ROOT is some other floppy
;;
/dev/fd*:/dev/fd*) fdroot=$thisroot # ROOT is mounted directly
;;
*) fdroot=$thisroot # ?
echo -n "\
It looks like Minix has been installed on disk already. Are you sure you
know what you are doing? [n] "
read yn
case "$yn" in
[yY]*|sure) ;;
*) exit
esac
esac
echo -n "\
This is the Minix installation script.
Note 1: If the screen blanks suddenly then hit F3 to select \"software
scrolling\".
Note 2: If things go wrong then hit DEL and start over.
Note 3: The installation procedure is described in the manual page
usage(8). It will be hard without it.
Note 4: Some questions have default answers, like this: [y]
Simply hit RETURN (or ENTER) if you want to choose that answer.
Note 5: If you see a colon (:) then you should hit RETURN to continue.
:"
read ret
echo "
What type of keyboard do you have? You can choose one of:
"
ls -C /usr/lib/keymaps | sed -e 's/\.map//g' -e 's/^/ /'
echo -n "
Keyboard type? [us-std] "; read keymap
test -n "$keymap" && loadkeys "/usr/lib/keymaps/$keymap.map"
echo -n "
Minix needs one primary partition of at least 35 Mb. (It fits in 25 Mb, but
it needs 35 Mb if fully recompiled. Add more space to taste, but don't
overdo it, there are limits to the size of a file system.)
If there is no free space on your disk then you have to back up one of the
other partitions, shrink, and reinstall. See the appropriate manuals of the
the operating systems currently installed. Restart your Minix installation
after you have made space.
To make this partition you will be put in the editor \"part\". Follow the
advice under the '!' key to make a new partition of type MINIX. Do not
touch an existing partition unless you know precisely what you are doing!
Please note the name of the partition (e.g. c0d0p1, c0d1p3, c1d1p0) you
make. (See the devices section in usage(8) on Minix device names.)
:"
read ret
primary=
while [ -z "$primary" ]
do
part || exit
echo -n "
Please finish the name of the primary partition you have created:
(Just type RETURN if you want to rerun \"part\") /dev/"
read primary
done
root=${primary}s0
swap=${primary}s1
usr=${primary}s2
hex2int()
{
# Translate hexadecimal to integer.
local h d i
h=$1
i=0
while [ -n "$h" ]
do
d=$(expr $h : '\(.\)')
h=$(expr $h : '.\(.*\)')
d=$(expr \( 0123456789ABCDEF : ".*$d" \) - 1)
i=$(expr $i \* 16 + $d)
done
echo $i
}
# Compute the amount of memory available to Minix.
memsize=0
ifs="$IFS"
IFS=','
set -- $(sysenv memory)
IFS="$ifs"
for mem
do
mem=$(expr $mem : '.*:\(.*\)')
memsize=$(expr $memsize + $(hex2int $mem) / 1024)
done
# Compute an advised swap size.
swapadv=0
case `arch` in
i86)
test $memsize -lt 4096 && swapadv=$(expr 4096 - $memsize)
;;
*) test $memsize -lt 6144 && swapadv=$(expr 6144 - $memsize)
esac
echo -n "
How much swap space would you like? Swapspace is only needed if this
system is memory starved, like a 16-bit system with less then 2M, or a
32-bit system with less then 4M. Minix swapping isn't very good yet, so
there is no need for it otherwise.
Size in kilobytes? [$swapadv] "
swapsize=
read swapsize
test -z "$swapsize" && swapsize=$swapadv
echo -n "
You have created a partition named: /dev/$primary
The following subpartitions are about to be created on /dev/$primary:
Root subpartition: /dev/$root 1440 kb
Swap subpartition: /dev/$swap $swapsize kb
/usr subpartition: /dev/$usr rest of $primary
Hit return if everything looks fine, or hit DEL to bail out if you want to
think it over. The next step will destroy /dev/$primary.
:"
read ret
# Secondary master bootstrap.
installboot -m /dev/$primary /usr/mdec/masterboot >/dev/null || exit
# Partition the primary.
p3=0:0
test "$swapsize" -gt 0 && p3=81:`expr $swapsize \* 2`
partition /dev/$primary 1 81:2880* $p3 81:0+ >/dev/null || exit
if [ "$swapsize" -gt 0 ]
then
# We must have that swap, now!
mkswap -f /dev/$swap || exit
mount -s /dev/$swap || exit
else
# Forget about swap.
swap=
fi
echo "
Migrating from floppy to disk...
"
mkfs /dev/$usr
echo "\
Scanning /dev/$usr for bad blocks. (Hit DEL to stop the scan if are
absolutely sure that there can not be any bad blocks. Otherwise just wait.)"
trap ': nothing' 2
readall -b /dev/$usr | sh
echo "Scan done"
sleep 2
trap 2
mount /dev/$usr /mnt || exit # Mount the intended /usr.
cpdir -v /usr /mnt || exit # Copy the usr floppy.
umount /dev/$usr || exit # Unmount the intended /usr.
umount $fdusr # Unmount the /usr floppy.
mount /dev/$usr /usr || exit # A new /usr
if [ $fdroot = unknown ]
then
echo "
By now the floppy USR has been copied to /dev/$usr, and it is now in use as
/usr. Please insert the installation ROOT floppy in a floppy drive."
drive=
while [ -z "$drive" ]
do
echo -n "What floppy drive is it in? [0] "; read drive
case $drive in
'') drive=0
;;
[01])
;;
*) echo "It must be 0 or 1, not \"$drive\"."
drive=
esac
done
fdroot=/dev/fd$drive
fi
echo "
Copying $fdroot to /dev/$root
"
mkfs /dev/$root || exit
mount /dev/$root /mnt || exit
if [ $thisroot = /dev/ram ]
then
# Running from the RAM disk, root image is on a floppy.
mount $fdroot /root || exit
cpdir -v /root /mnt || exit
umount $fdroot || exit
cpdir -f /dev /mnt/dev # Copy any extra MAKEDEV'd devices
else
# Running from the floppy itself.
cpdir -vx / /mnt || exit
chmod 555 /mnt/usr
fi
# Change /etc/fstab.
echo >/mnt/etc/fstab "\
# Poor man's File System Table.
root=/dev/$root
${swap:+swap=/dev/$swap}
usr=/dev/$usr"
# How to install further?
echo >/mnt/etc/issue "\
Login as root and run 'setup /usr' to install floppy sets."
# National keyboard map.
test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap
umount /dev/$root || exit # Unmount the new root.
# Compute size of the second level file block cache.
case `arch` in
i86)
cache=`expr "0$memsize" - 1024`
test $cache -lt 32 && cache=0
test $cache -gt 512 && cache=512
;;
*)
cache=`expr "0$memsize" - 2560`
test $cache -lt 64 && cache=0
test $cache -gt 1024 && cache=1024
esac
echo "Second level file system block cache set to $cache kb."
if [ $cache -eq 0 ]; then cache=; else cache="ramsize=$cache"; fi
# Make bootable.
installboot -d /dev/$root /usr/mdec/bootblock /boot >/dev/null || exit
edparams /dev/$root "rootdev=$root; ramimagedev=$root; $cache; save" || exit
echo "
Please insert the installation ROOT floppy and type 'halt' to exit Minix.
You can type 'boot $primary' to try the newly installed Minix system. See
\"TESTING\" in the usage manual."

35
commands/scripts/spell.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
#
# spell 1.1 - show unknown words Author: Kees J. Bot
# 28 Apr 1995
dict=words
while getopts 'd:' opt
do
case $opt in
d) dict="$OPTARG"
;;
?) echo "Usage: spell [-d dict] [file ...]" >&2; exit 1
esac
done
shift `expr $OPTIND - 1`
case "$dict" in
*/*) ;;
*) dict="/usr/lib/dict/$dict"
esac
{
if [ $# = 0 ]
then
prep
else
for file
do
prep "$file"
done
fi
} | {
sort -u | comm -23 - "$dict"
}

24
commands/scripts/srccrc.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# srccrc 1.0 - compute CRC checksums of the entire source tree
# Author: Kees J. Bot
cd /usr || exit
{
# List the file names of all files in /usr/include and /usr/src.
find include src/* -type f
} | {
# Sort the list to make them comparable.
sort
} | {
# Remove files like *.o, *.bak, etc.
sed -e '/\.o$/d
/\.a$/d
/\.bak$/d
/\/a\.out$/d
/\/core$/d
/\/bin\/[^/]*$/d'
} | {
# Compute checksums.
xargs crc
}

6
commands/scripts/svclog.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
#
svc=`basename $1 ,S`,S
if test \( ! -r $svc \) -a -d "SVC" ; then svc=SVC/$svc ; fi
grep '^#\*\*\*SVC' $svc

53
commands/scripts/whatis.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/sh
#
# whatis/apropos 1.3 - search whatis(5) database for commands
# Author: Kees J. Bot
# BUGS
# whatis file must be as if created by makewhatis(8).
#
# This version includes a fix by Michael Haardt originally posted to
# comp.os.minix in July 1999. Fixes for grep provided by Michael in May
# 1999 caused whatis to break, this is now fixed. (ASW 2004-12-12)
all='exit 0'
case "$1" in
-a) all="found='exit 0'"
shift
esac
case $#:$0 in
1:*whatis)
;;
1:*apropos)
all="found='exit 0'"
;;
*) echo "Usage: `basename $0` [-a] <keyword>" >&2
exit 1
esac
IFS=":$IFS"
MANPATH="${MANPATH-/usr/local/man:/usr/man}"
found=
for m in $MANPATH
do
for w in $m/whatis
do
test -f $w || continue
case $0 in
*whatis)
grep '^\('$1'\|[^(]* '$1'\)[ ,][^(]*(' $w && eval $all
;;
*apropos)
grep -i "$1" $w && eval $all
esac
done
done
$found
echo "`basename $0`: $1: not found" >&2
exit 1

23
commands/scripts/whereis.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
: List all system directories containing the argument
: Author: Terrence W. Holm
if test $# -ne 1; then
echo "Usage: whereis name"
exit 1
fi
path="/bin /lib /etc\
/usr/bin /usr/lib\
/usr/include /usr/include/sys"
for dir in $path; do
for file in $dir/$1 $dir/$1.*; do
if test -f $file; then
echo $file
elif test -d $file; then
echo $file/
fi
done
done
exit 0