dtconfig.src 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. XCOMM!/bin/ksh
  2. XCOMM $XConsortium: dtconfig.src /main/5 1996/04/23 12:12:10 drk $
  3. XCOMM (c) Copyright 1996 Digital Equipment Corporation.
  4. XCOMM (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
  5. XCOMM (c) Copyright 1993,1994,1996 International Business Machines Corp.
  6. XCOMM (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
  7. XCOMM (c) Copyright 1993,1994,1996 Novell, Inc.
  8. XCOMM (c) Copyright 1996 FUJITSU LIMITED.
  9. XCOMM (c) Copyright 1996 Hitachi.
  10. XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
  11. XCOMM Novell, Inc.
  12. XCOMM
  13. XCOMM This version of the CDE dtconfig script is for use in the Solaris(TM)
  14. XCOMM operating environment.
  15. XCOMM
  16. XCOMM Common Desktop Environment
  17. XCOMM
  18. XCOMM This script can be run after CDE installation to configure CDE within
  19. XCOMM the host platforms operating environment. For example, when auto-start
  20. XCOMM is selected, the CDE desktop login window will be displayed at end of the
  21. XCOMM workstation's power up boot cycle.
  22. XCOMM
  23. XCOMM Location: CDE_INSTALLATION_TOP/bin/dtconfig
  24. #define HASH #
  25. mode=$1
  26. arg_count=$#
  27. prg_name=$0
  28. Message()
  29. {
  30. HASH Message() - display message from dtconfig.cat
  31. HASH $1 - message id
  32. HASH $2 - fallback message text
  33. if [ -x $DTDSPMSG ]; then
  34. $DTDSPMSG -s 20 dtconfig $1 "$2" "$3"
  35. echo " "
  36. else
  37. echo "$2"
  38. fi
  39. }
  40. usage_error() {
  41. echo " "
  42. Message 1 " CDE configuration utility"
  43. echo " "
  44. Message 2 " $prg_name -d (disable auto-start)" $prg_name
  45. Message 3 " $prg_name -e (enable auto-start)" $prg_name
  46. Message 4 " $prg_name -kill (kill dtlogin)" $prg_name
  47. Message 5 " $prg_name -reset (reset dtlogin)" $prg_name
  48. Message 6 " $prg_name -p (printer action update)" $prg_name
  49. Message 25 " $prg_name -inetd (inetd.conf /usr/dt daemons)" $prg_name
  50. Message 26 " $prg_name -inetd.ow (inetd.conf /usr/openwin daemons)" $prg_name
  51. echo " "
  52. }
  53. XCOMM
  54. XCOMM Allow for configured and factory versions of dtlogin.rc
  55. XCOMM
  56. if [ -f CDE_CONFIGURATION_TOP/config/dtlogin.rc ]
  57. then
  58. RC_MASTER=CDE_CONFIGURATION_TOP/config/dtlogin.rc
  59. elif [ -f CDE_INSTALLATION_TOP/config/dtlogin.rc ]
  60. then
  61. RC_MASTER=CDE_INSTALLATION_TOP/config/dtlogin.rc
  62. fi
  63. RC_COPY=/etc/init.d/dtlogin
  64. XCOMM
  65. XCOMM Allow for configured and factory versions of dtlogin.xml
  66. XCOMM
  67. if [ -f CDE_CONFIGURATION_TOP/config/dtlogin.xml ]
  68. then
  69. SVC_MASTER=CDE_CONFIGURATION_TOP/config/dtlogin.xml
  70. elif [ -f CDE_INSTALLATION_TOP/config/dtlogin.xml ]
  71. then
  72. SVC_MASTER=CDE_INSTALLATION_TOP/config/dtlogin.xml
  73. fi
  74. SVC_COPY=application/graphical-login/dtlogin
  75. LEVEL_0_KILL=/etc/rc0.d/K10dtlogin
  76. LEVEL_1_KILL=/etc/rc1.d/K10dtlogin
  77. LEVEL_2_START=/etc/rc2.d/S99dtlogin
  78. DTDSPMSG=/usr/dt/bin/dtdspmsg
  79. NAWK=/usr/bin/nawk
  80. set `/bin/id`
  81. if [ $1 != "uid=0(root)" ]; then
  82. Message 7 "$prg_name: this script must be run as root" $prg_name
  83. exit 1
  84. fi
  85. if [ $arg_count -ne 1 ]; then
  86. echo " "
  87. HASH
  88. HASH Display error message for too many arguments
  89. HASH
  90. if [ $arg_count -gt 1 ]; then
  91. Message 8 "Usage: Too many arguments"
  92. HASH
  93. HASH Display error message for NULL arguments passed
  94. HASH
  95. elif [ $arg_count -eq 0 ]; then
  96. Message 9 "Usage: Needs one argument"
  97. fi
  98. usage_error
  99. exit 1
  100. fi
  101. rc_master_check() {
  102. if [ ! -x $RC_MASTER ]; then
  103. Message 10 "option failed"
  104. Message 11 "could not execute $RC_MASTER" $RC_MASTER
  105. exit 1
  106. fi
  107. }
  108. nawk_check() {
  109. if [ ! -x $NAWK ]; then
  110. Message 10 "option failed"
  111. Message 11 "could not execute $NAWK" $NAWK
  112. exit 1
  113. fi
  114. }
  115. XCOMM Following inetdSP() procedure is from Sun CDE SI post_install
  116. XCOMM configMin file. It adds the Subprocess Control daemon inetd.conf
  117. XCOMM line so it points to /usr/dt/bin/dtspcd.
  118. inetdSP()
  119. {
  120. FILE=/etc/inetd.conf
  121. TMPFILE=/tmp/inetd.conf
  122. XCOMM
  123. XCOMM check for existence of /etc/inetd.conf
  124. XCOMM
  125. if [ ! -f $FILE ] # highly unlikely
  126. then
  127. echo "" >$FILE
  128. fi
  129. XCOMM
  130. XCOMM see if it already exists
  131. XCOMM
  132. $NAWK '{if ($1 == "dtspc")
  133. print $0 > "/tmp/dtspc-already-there"
  134. }' $FILE >/dev/null
  135. DTSPCD=CDE_INSTALLATION_TOP/bin/dtspcd
  136. if [ ! -f /tmp/dtspc-already-there ]
  137. then
  138. echo "dtspc stream tcp nowait root $DTSPCD $DTSPCD" >>$FILE
  139. else
  140. rm /tmp/dtspc-already-there
  141. fi
  142. XCOMM
  143. XCOMM remove legacy entries like dtspcd
  144. XCOMM
  145. $NAWK '{if ($1 == "dtspcd" || $1 == "#dtspcd")
  146. ;
  147. else
  148. print $0
  149. }' $FILE >$TMPFILE
  150. cp $TMPFILE $FILE
  151. rm $TMPFILE
  152. FILE=/etc/services
  153. TMPFILE=/tmp/services
  154. XCOMM
  155. XCOMM check for existence of /etc/services
  156. XCOMM
  157. if [ ! -f $FILE ] # highly unlikely
  158. then
  159. echo "" >$FILE
  160. fi
  161. XCOMM
  162. XCOMM see if it already exists
  163. XCOMM
  164. $NAWK '{if ($1 == "dtspc")
  165. print $0 > "/tmp/dtspc-already-there"
  166. }' $FILE >/dev/null
  167. if [ ! -f /tmp/dtspc-already-there ]
  168. then
  169. echo "dtspc\t6112/tcp\t#subprocess control" >>$FILE
  170. else
  171. rm /tmp/dtspc-already-there
  172. fi
  173. XCOMM
  174. XCOMM remove legacy entries like dtspcd
  175. XCOMM
  176. $NAWK '{if ($1 == "dtspcd" || $1 == "#dtspcd")
  177. ;
  178. else
  179. print $0
  180. }' $FILE >$TMPFILE
  181. cp $TMPFILE $FILE
  182. rm $TMPFILE
  183. }
  184. XCOMM Following inetdTT() procedure code from Sun CDE SI post_install
  185. XCOMM configTT file. It updates the ToolTalk daemon inetd.conf
  186. XCOMM line so it points to /usr/dt/bin/rpc.ttdbserverd.
  187. inetdTT()
  188. {
  189. FILE=/etc/inetd.conf
  190. TMPFILE=/tmp/inetd.conf
  191. TTDBSERVERD=CDE_INSTALLATION_TOP/bin/rpc.ttdbserverd
  192. XCOMM
  193. XCOMM remove any non-dt ttdbserverd line
  194. XCOMM
  195. $NAWK -v ttdb=$TTDBSERVERD \
  196. '{if ($1 == "100083/1" && $6 != ttdb)
  197. ;
  198. else
  199. print $0
  200. }' $FILE >$TMPFILE
  201. cp $TMPFILE $FILE
  202. rm $TMPFILE
  203. XCOMM
  204. XCOMM add dt ttdbserverd line if its not already there
  205. XCOMM
  206. $NAWK '{if ($1 == "100083/1")
  207. print $0 > "/tmp/tt-already-there"
  208. }' $FILE >/dev/null
  209. if [ ! -f /tmp/tt-already-there ]
  210. then
  211. echo "100083/1 stream rpc/tcp wait root $TTDBSERVERD $TTDBSERVERD" \
  212. >>$FILE
  213. else
  214. rm /tmp/tt-already-there
  215. fi
  216. }
  217. XCOMM Following owTT() procedure updates the ToolTalk daemon inetd.conf
  218. XCOMM line so it points to /usr/openwin/bin/rpc.ttdbserverd.
  219. owTT()
  220. {
  221. FILE=/etc/inetd.conf
  222. TMPFILE=/tmp/inetd.conf
  223. TTDBSERVERD=/usr/openwin/bin/rpc.ttdbserverd
  224. XCOMM
  225. XCOMM remove any non-ow ttdbserverd line
  226. XCOMM
  227. $NAWK -v ttdb=$TTDBSERVERD \
  228. '{if ($1 == "100083/1" && $6 != ttdb)
  229. ;
  230. else
  231. print $0
  232. }' $FILE >$TMPFILE
  233. cp $TMPFILE $FILE
  234. rm $TMPFILE
  235. XCOMM
  236. XCOMM add ow ttdbserverd line if its not already there
  237. XCOMM
  238. $NAWK '{if ($1 == "100083/1")
  239. print $0 > "/tmp/tt-already-there"
  240. }' $FILE >/dev/null
  241. if [ ! -f /tmp/tt-already-there ]
  242. then
  243. echo "100083/1 stream rpc/tcp wait root $TTDBSERVERD $TTDBSERVERD" \
  244. >>$FILE
  245. else
  246. rm /tmp/tt-already-there
  247. fi
  248. }
  249. XCOMM Following inetdCM() procedure is from Sun CDE SI post_install
  250. XCOMM configRun file. It updates the Calendar Manager daemon inetd.conf
  251. XCOMM line so it points to /usr/dt/bin/rpc.cmsd.
  252. inetdCM()
  253. {
  254. FILE=/etc/inetd.conf
  255. TMPFILE=/tmp/inetd.conf
  256. CMSD=CDE_INSTALLATION_TOP/bin/rpc.cmsd
  257. XCOMM
  258. XCOMM remove any non-dt rpc.cmsd line
  259. XCOMM
  260. $NAWK -v cmsd=$CMSD \
  261. '{if ( ($1 == "100068/2-4" || $1 == "100068/2-5") && $6 != cmsd)
  262. ;
  263. else
  264. print $0
  265. }' $FILE >$TMPFILE
  266. cp $TMPFILE $FILE
  267. rm $TMPFILE
  268. XCOMM
  269. XCOMM remove possible old dt cmsd level 2-4 entry
  270. XCOMM
  271. $NAWK -v cmsd=$CMSD \
  272. '{if ($1 == "100068/2-4" && $6 == cmsd)
  273. ;
  274. else
  275. print $0
  276. }' $FILE >$TMPFILE
  277. cp $TMPFILE $FILE
  278. rm $TMPFILE
  279. XCOMM
  280. XCOMM add dt cmsd line in needed
  281. XCOMM
  282. $NAWK -v cmsd=$CMSD \
  283. '{if ($6 == cmsd && $1 == "100068/2-5")
  284. print $0 > "/tmp/cmsd-already-there"
  285. }' $FILE >/dev/null
  286. if [ ! -f /tmp/cmsd-already-there ]
  287. then
  288. echo "100068/2-5 dgram rpc/udp wait root $CMSD rpc.cmsd" >>$FILE
  289. else
  290. rm /tmp/cmsd-already-there
  291. fi
  292. }
  293. XCOMM Following owCM() procedure updates the Calendar Manager daemon inetd.conf
  294. XCOMM line so it points to /usr/openwin/bin/cmsd.
  295. owCM()
  296. {
  297. FILE=/etc/inetd.conf
  298. TMPFILE=/tmp/inetd.conf
  299. CMSD=/usr/openwin/bin/rpc.cmsd
  300. XCOMM
  301. XCOMM remove any non-ow rpc.cmsd line
  302. XCOMM
  303. $NAWK -v cmsd=$CMSD \
  304. '{if ( ($1 == "100068/2-4" || $1 == "100068/2-5") && $6 != cmsd )
  305. ;
  306. else
  307. print $0
  308. }' $FILE >$TMPFILE
  309. cp $TMPFILE $FILE
  310. rm $TMPFILE
  311. XCOMM
  312. XCOMM add openwin rpc.cmsd line if not already there
  313. XCOMM
  314. $NAWK -v cmsd=$CMSD \
  315. '{if ( ($1 == "100068/2-4" || $1 == "100068/2-5") && $6 == cmsd )
  316. print $0 > "/tmp/cmsd-already-there"
  317. }' $FILE >/dev/null
  318. XCOMM
  319. XCOMM if it is not there, add it
  320. XCOMM (note openwin cmsd is one rev back, its at level 2-4)
  321. XCOMM
  322. if [ ! -f /tmp/cmsd-already-there ]
  323. then
  324. echo "100068/2-4 dgram rpc/udp wait root $CMSD rpc.cmsd" >>$FILE
  325. else
  326. rm /tmp/cmsd-already-there
  327. fi
  328. }
  329. case "$mode" in
  330. '-d')
  331. if [ -f /usr/sbin/svcadm ]; then
  332. if svcs $SVC_COPY >/dev/null 2>&1; then
  333. if ! svcadm disable $SVC_COPY >/dev/null; then
  334. Message 12 "disable failed"
  335. Message 13 "could not disable dtlogin service" "svc-dtlogin"
  336. exit 1
  337. fi
  338. fi
  339. else
  340. /usr/bin/rm -f $LEVEL_2_START
  341. if [ -f $LEVEL_2_START ]; then
  342. Message 12 "disable failed"
  343. Message 13 "could not remove $LEVEL_2_START" $LEVEL_2_START
  344. exit 1
  345. fi
  346. fi
  347. Message 14 "done"
  348. Message 15 "desktop auto-start disabled."
  349. ;;
  350. '-e')
  351. if [ -f /usr/sbin/svcadm ]; then
  352. if ! svcs $SVC_COPY >/dev/null 2>&1; then
  353. if ! svccfg import $SVC_MASTER; then
  354. Message 16 "Enable Failed"
  355. Message 17 "could not import $SVC_MASTER" $SVC_MASTER
  356. exit 1
  357. fi
  358. elif ! svcadm enable $SVC_COPY >/dev/null; then
  359. Message 16 "enable failed"
  360. Message 17 "could not enable dtlogin service" svc-dtlogin
  361. exit 1
  362. fi
  363. else
  364. if [ -f $RC_MASTER ]; then
  365. /usr/bin/rm -f $RC_COPY
  366. fi
  367. if [ ! -x $RC_COPY ]; then
  368. if [ ! -f $RC_MASTER ]; then
  369. Message 16 "enable failed"
  370. Message 17 "could not find $RC_MASTER" $RC_MASTER
  371. exit 1
  372. fi
  373. /usr/bin/cp $RC_MASTER $RC_COPY
  374. /usr/bin/chmod 0555 $RC_COPY
  375. if [ ! -x $RC_COPY ]; then
  376. Message 16 "enable failed"
  377. Message 18 "could not create $RC_COPY" $RC_COPY
  378. exit 1
  379. fi
  380. fi
  381. /usr/bin/rm -f $LEVEL_0_KILL
  382. /usr/bin/ln $RC_COPY $LEVEL_0_KILL
  383. /usr/bin/rm -f $LEVEL_1_KILL
  384. /usr/bin/ln $RC_COPY $LEVEL_1_KILL
  385. /usr/bin/rm -f $LEVEL_2_START
  386. /usr/bin/ln $RC_COPY $LEVEL_2_START
  387. if [ ! -f $LEVEL_2_START ]; then
  388. Message 16 "enable failed"
  389. Message 19 "could not create $LEVEL_2_START" $LEVEL_2_START
  390. exit 1
  391. fi
  392. fi
  393. Message 14 "done"
  394. Message 20 "desktop auto-start enabled."
  395. ;;
  396. '-inetd')
  397. nawk_check
  398. inetdSP
  399. inetdCM
  400. inetdTT
  401. Message 14 "done"
  402. Message 27 "Next system boot, following will be run from /usr/dt/bin"
  403. Message 28 " rpc.ttdbserverd (ToolTalk)"
  404. Message 29 " rpc.cmsd (Calendar Manager)"
  405. Message 30 " dtspcd (Subprocess Control)"
  406. ;;
  407. '-inetd.ow')
  408. nawk_check
  409. owCM
  410. owTT
  411. Message 14 "done"
  412. Message 31 "Next system boot, following will be run from /usr/openwin/bin"
  413. Message 32 " rpc.ttdbserverd (ToolTalk)"
  414. Message 33 " rpc.cmsd (Calendar Manager)"
  415. ;;
  416. '-kill')
  417. if [ -f /usr/sbin/svcadm ]; then
  418. svcadm disable -t $SVC_COPY
  419. fi
  420. rc_master_check
  421. $RC_MASTER stop
  422. Message 14 "done"
  423. Message 21 "dtlogin kill complete."
  424. ;;
  425. '-reset')
  426. rc_master_check
  427. $RC_MASTER reset
  428. Message 14 "done"
  429. Message 22 "dtlogin config resources reloaded."
  430. ;;
  431. '-p')
  432. rc_master_check
  433. $RC_MASTER update_printers
  434. Message 14 "done"
  435. Message 23 "printer action update is complete"
  436. ;;
  437. *)
  438. echo " "
  439. Message 24 "Usage:"
  440. usage_error
  441. exit 1
  442. ;;
  443. esac
  444. exit 0