-
Notifications
You must be signed in to change notification settings - Fork 1
/
inittab.aix
92 lines (82 loc) · 2.4 KB
/
inittab.aix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/ksh
#From: [email protected] (Michael Staats)
#Subject: AIX inittab installation
#To: [email protected] (Gert Doering)
#Date: Mon, 29 Nov 1993 11:10:20 +0100
#> Ummm. That would force the user to specify the ttys in the Makefile -
#> doesn't sound too good. What about a small "inittab.aix" shell script that
#> sets up only /etc/inittab? With a tty line as an argument?
#
#of course, why not? So here it is:
#
#======================================================================
#!/bin/ksh
# mgetty installscript for AIX
# (C) 1993 Michael Staats
# free according to GNU Public License
#
# extensive Changes by Chris Lewis, [email protected]
TTY=tty0
DEBUGLEV=3
while getopts pm:t:x:n: name; do
case $name in
m) MGETTY="$OPTARG";;
n) NRINGS="-n $OPTARG";;
x) DEBUGLEV="$OPTARG";;
t) TTY=${OPTARG#/dev/*};;
*) echo "unknown option." >&2
echo "Usage: $0 [-m full_mgetty_path] [-x debuglevel] [-t tty]" >&2
exit 1;;
esac
done
# Try to find MGETTY if not specified
if [ -z "$MGETTY" ]; then
eval "$(grep '^BINDIR=' Makefile)"
eval "$(grep '^SBINDIR=' Makefile)"
MGETTY="$SBINDIR/mgetty"
[ ! -x "$MGETTY" ] && MGETTY="$BINDIR/mgetty"
[ ! -x "$MGETTY" ] && {
MGETTY="$(which mgetty)"
case "$MGETTY" in ./*) MGETTY=$PWD/${MGETTY#./*};; esac
}
[ ! -x "$MGETTY" ] && {
echo "Can't find mgetty. Please specify with -m mgettypath." >&2
}
fi
echo
echo " Ok, I'll install $MGETTY for use with $TTY."
echo " I will change /etc/inittab and update the ODM so that"
echo " /etc/getty will not run for this tty."
echo
echo -n " Is this ok (y/n)? "
YN=
while [ -z "$YN" ]; do
read YN
done
if [ "$YN" = y ]; then
echo "Installing."
if [ -n "`lsitab $TTY`" ]
then
chdev -l $TTY -a ttyprog_action=off
chitab "$TTY:2:off:/etc/getty -u /dev/$TTY"
fi
if [ -n "`lsitab m$TTY`" ]
then
chitab "m$TTY:2:respawn:$MGETTY -x $DEBUGLEV $NRINGS $TTY"
echo "Changed m$TTY entry in /etc/inittab"
else
mkitab "m$TTY:2:respawn:$MGETTY -x $DEBUGLEV $NRINGS $TTY"
echo "Added m$TTY entry to /etc/inittab"
fi
# This doesn't appear necessary on AIX, but what the hey:
telinit q
else
echo "Try again with \"$0 [ -m full_mgetty_path ] [ -t tty ]\""
fi
exit 0
======================================================================
Enjoy,
Michael
--
Michael Staats, Theoretical Physics, Uni-GH Duisburg
email: [email protected]