#!/bin/sh # # config3270 -- Autoconfigure /dev/3270/* and /etc/inittab # # Usage: # config3270 # # Output: # /tmp/mkdev3270 # # Operation: # 1. Run this script # 2. Run the script it produces: /tmp/mkdev3270 # 3. Issue "telinit q" or reboot, as appropriate. # global P := '/proc/tty/driver/tty3270' global ROOT := '' global D := "$ROOT/dev" global SUBD := '3270' global TTY := "$SUBD/tty" global TUB := "$SUBD/tub" global SCR := "$ROOT/tmp/mkdev3270" global SCRTMP := "$SCR.a" global GETTYLINE := ':2345:respawn:/sbin/mingetty' global INITTAB := "$ROOT/etc/inittab" global NINITTAB := "$ROOT/etc/NEWinittab" global OINITTAB := "$ROOT/etc/OLDinittab" global ADDNOTE := ''\'"# Additional mingettys for the 3270/tty* driver, tub3270 ---'\\" if ! ls $P > /dev/null !2 > !1 { modprobe tub3270 > /dev/null !2 > !1 } ls $P > /dev/null !2 > !1 || exit 1 # Initialize two files, one for /dev/3270 commands and one # to replace the /etc/inittab file (old one saved in OLDinittab) echo "#!/bin/sh" > $SCR || exit 1 echo " " >> $SCR echo "# Script built by /sbin/config3270" >> $SCR if test ! -d /dev/dasd { echo rm -rf "$D/$SUBD/*" >> $SCR } echo "grep -v $TTY $INITTAB > $NINITTAB" > $SCRTMP || exit 1 echo "echo $ADDNOTE >> $NINITTAB" >> $SCRTMP if test ! -d /dev/dasd { echo mkdir -p $D/$SUBD >> $SCR } # Now query the tub3270 driver for 3270 device information # and add appropriate mknod and mingetty lines to our files echo what=config > $P while read devno maj min{ if test $min = 0 { global fsmaj := $maj if test ! -d /dev/dasd { echo mknod $D/$TUB c $fsmaj 0 >> $SCR echo chmod 666 $D/$TUB >> $SCR } } elif test $maj = CONSOLE { if test ! -d /dev/dasd { echo mknod $D/$TUB$devno c $fsmaj $min >> $SCR } } else { if test ! -d /dev/dasd { echo mknod $D/$TTY$devno c $maj $min >>$SCR echo mknod $D/$TUB$devno c $fsmaj $min >> $SCR } echo "echo t$min$GETTYLINE $TTY$devno >> $NINITTAB" >> $SCRTMP } } < $P echo mv $INITTAB $OINITTAB >> $SCRTMP || exit 1 echo mv $NINITTAB $INITTAB >> $SCRTMP cat $SCRTMP >> $SCR rm $SCRTMP exit 0 (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:P) op:Equal rhs:{(/proc/tty/driver/tty3270)} spids:[45])] spids: [45] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ROOT) op:Equal rhs:{(SQ )} spids:[48])] spids: [48] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:D) op: Equal rhs: {($ VSub_Name "$ROOT") (/dev)} spids: [50] ) ] spids: [50] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:SUBD) op:Equal rhs:{(3270)} spids:[54])] spids: [54] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TTY) op: Equal rhs: {($ VSub_Name "$SUBD") (/tty)} spids: [57] ) ] spids: [57] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TUB) op: Equal rhs: {($ VSub_Name "$SUBD") (/tub)} spids: [61] ) ] spids: [61] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SCR) op: Equal rhs: {($ VSub_Name "$ROOT") (/tmp/mkdev3270)} spids: [65] ) ] spids: [65] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SCRTMP) op: Equal rhs: {($ VSub_Name "$SCR") (.a)} spids: [69] ) ] spids: [69] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GETTYLINE) op: Equal rhs: {(Lit_Other ":") (2345) (Lit_Other ":") (respawn) (Lit_Other ":") (/sbin/mingetty)} spids: [73] ) ] spids: [73] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INITTAB) op: Equal rhs: {($ VSub_Name "$ROOT") (/etc/inittab)} spids: [81] ) ] spids: [81] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NINITTAB) op: Equal rhs: {($ VSub_Name "$ROOT") (/etc/NEWinittab)} spids: [85] ) ] spids: [85] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:OINITTAB) op: Equal rhs: {($ VSub_Name "$ROOT") (/etc/OLDinittab)} spids: [89] ) ] spids: [89] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ADDNOTE) op: Equal rhs: {(EscapedLiteralPart token:) (DQ ("# Additional mingettys for the 3270/tty* driver, tub3270 ---") (EscapedLiteralPart token:) ) } spids: [93] ) ] spids: [93] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(ls)} {($ VSub_Name "$P")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [109] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [113] ) ] ) ] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [{(modprobe)} {(tub3270)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[124]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[128]) ] ) ] spids: [-1 117] ) ] spids: [-1 131] ) (AndOr children: [ (SimpleCommand words: [{(ls)} {($ VSub_Name "$P")}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[137]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[141]) ] ) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (SimpleCommand words: [{(echo)} {(DQ ("#!/bin/sh"))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Name "$SCR")} spids:[163])] ) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) (SimpleCommand words: [{(echo)} {(DQ (" "))}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{($ VSub_Name "$SCR")} spids:[179])] ) (SimpleCommand words: [{(echo)} {(DQ ("# Script built by /sbin/config3270"))}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{($ VSub_Name "$SCR")} spids:[189])] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(/dev/dasd)} {(Lit_Other "]")}) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(rm)} {(-rf)} {(DQ ($ VSub_Name "$D") (/) ($ VSub_Name "$SUBD") ("/*"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$SCR")} spids: [222] ) ] ) ] spids: [-1 206] ) ] spids: [-1 226] ) (AndOr children: [ (SimpleCommand words: [ {(echo)} { (DQ ("grep -v ") ($ VSub_Name "$TTY") (" ") ($ VSub_Name "$INITTAB") (" > ") ($ VSub_Name "$NINITTAB") ) } ] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Name "$SCRTMP")} spids:[239])] ) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) (SimpleCommand words: [{(echo)} {(DQ ("echo ") ($ VSub_Name "$ADDNOTE") (" >> ") ($ VSub_Name "$NINITTAB"))}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{($ VSub_Name "$SCRTMP")} spids:[258])] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(/dev/dasd)} {(Lit_Other "]")}) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(mkdir)} {(-p)} {($ VSub_Name "$D") (/) ($ VSub_Name "$SUBD")}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$SCR")} spids: [288] ) ] ) ] spids: [-1 275] ) ] spids: [-1 292] ) (SimpleCommand words: [{(echo)} {(Lit_VarLike "what=") (config)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Name "$P")} spids:[306])] ) (While cond: [(Sentence child:(C {(read)} {(devno)} {(maj)} {(min)}) terminator:)] body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$min")} {(Lit_Other "=")} {(0)} {(Lit_Other "]")} ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fsmaj) op: Equal rhs: {($ VSub_Name "$maj")} spids: [339] ) ] spids: [339] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(/dev/dasd)} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {(mknod)} {($ VSub_Name "$D") (/) ($ VSub_Name "$TUB")} {(c)} {($ VSub_Name "$fsmaj")} {(0)} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$SCR")} spids: [373] ) ] ) (SimpleCommand words: [ {(echo)} {(chmod)} {(666)} {($ VSub_Name "$D") (/) ($ VSub_Name "$TUB")} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$SCR")} spids: [388] ) ] ) ] spids: [-1 356] ) ] spids: [-1 393] ) ] spids: [-1 336] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$maj")} {(Lit_Other "=")} {(CONSOLE)} {(Lit_Other "]")} ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(/dev/dasd)} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {(mknod)} {($ VSub_Name "$D") (/) ($ VSub_Name "$TUB") ($ VSub_Name "$devno")} {(c)} {($ VSub_Name "$fsmaj")} {($ VSub_Name "$min")} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$SCR")} spids: [443] ) ] ) ] spids: [-1 425] ) ] spids: [-1 448] ) ] spids: [396 409] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(/dev/dasd)} {(Lit_Other "]")}) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {(mknod)} {($ VSub_Name "$D") (/) ($ VSub_Name "$TTY") ($ VSub_Name "$devno")} {(c)} {($ VSub_Name "$maj")} {($ VSub_Name "$min")} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$SCR")} spids: [485] ) ] ) (SimpleCommand words: [ {(echo)} {(mknod)} {($ VSub_Name "$D") (/) ($ VSub_Name "$TUB") ($ VSub_Name "$devno")} {(c)} {($ VSub_Name "$fsmaj")} {($ VSub_Name "$min")} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$SCR")} spids: [504] ) ] ) ] spids: [-1 467] ) ] spids: [-1 509] ) (SimpleCommand words: [ {(echo)} { (DQ ("echo t") ($ VSub_Name "$min") ($ VSub_Name "$GETTYLINE") (" ") ($ VSub_Name "$TTY") ($ VSub_Name "$devno") (" >> ") ($ VSub_Name "$NINITTAB") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$SCRTMP")} spids: [525] ) ] ) ] spids: [451 530] ) ] spids: [320 532] ) redirects: [(Redir op_id:Redir_Less fd:-1 arg_word:{($ VSub_Name "$P")} spids:[534])] ) (AndOr children: [ (SimpleCommand words: [{(echo)} {(mv)} {($ VSub_Name "$INITTAB")} {($ VSub_Name "$OINITTAB")}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{($ VSub_Name "$SCRTMP")} spids:[547])] ) (C {(exit)} {(1)}) ] op_id: Op_DPipe ) (SimpleCommand words: [{(echo)} {(mv)} {($ VSub_Name "$NINITTAB")} {($ VSub_Name "$INITTAB")}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{($ VSub_Name "$SCRTMP")} spids:[565])] ) (SimpleCommand words: [{(cat)} {($ VSub_Name "$SCRTMP")}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{($ VSub_Name "$SCR")} spids:[573])] ) (C {(rm)} {($ VSub_Name "$SCRTMP")}) (C {(exit)} {(0)}) ] )