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