install.dt.usl.src 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. XCOMM $XConsortium: install.dt.usl.src /main/4 1996/04/23 11:19:27 drk $
  2. XCOMM ==========================================================================
  3. XCOMM ==========================================================================
  4. XCOMM install.dt.usl
  5. XCOMM
  6. XCOMM Platform specific function overrides for the April 1994 Snapshot
  7. XCOMM install script, install.dt.
  8. XCOMM
  9. XCOMM This file is sourced by the install.dt script to allow platform
  10. XCOMM specific behavior for certain functionality. These functions are:
  11. XCOMM
  12. XCOMM DtiClearScreen() - clear the screen
  13. XCOMM DtiFreeSpace() - return available bytes in a directory
  14. XCOMM DtiVerifyConfiguration() - verify system configuration
  15. XCOMM DtiWhoami() - return user name
  16. XCOMM
  17. XCOMM ==========================================================================
  18. #define HASH #
  19. XCOMM ==========================================================================
  20. XCOMM
  21. XCOMM DtiClearScreen() - clears the screen
  22. XCOMM
  23. XCOMM The default DtiClearScreen() uses the 'clear' command to clear the
  24. XCOMM screen. If this platform does not have the 'clear' command,
  25. XCOMM declare DtiClearScreen() here with the appropriate functionality.
  26. XCOMM
  27. XCOMM Note: The default DtiClearScreen() writes to stderr, rather than stdout,
  28. XCOMM so be sure to do the same here. DtiPrint() does this automatically, so
  29. XCOMM use it if possible.
  30. XCOMM
  31. XCOMM Example:
  32. XCOMM
  33. XCOMM DtiClearScreen()
  34. XCOMM {
  35. XCOMM DtiPrint "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
  36. XCOMM DtiPrint "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
  37. XCOMM }
  38. XCOMM
  39. XCOMM Input - none
  40. XCOMM Output - none
  41. XCOMM Return -none
  42. XCOMM
  43. XCOMM USL uses the default (clear). We'll define it here to ensure usage.
  44. XCOMM ==========================================================================
  45. DtiClearScreen() {
  46. clear 1>&2
  47. }
  48. XCOMM ==========================================================================
  49. XCOMM
  50. XCOMM DtiFreeSpace
  51. XCOMM
  52. XCOMM The default DtiFreeSpace() does not check for free space, rather it
  53. XCOMM simply returns a BigNumber that install.dt will assume is large
  54. XCOMM enough in which to install the desktop.
  55. XCOMM
  56. XCOMM Declare DtiFreeSpace() here to return the actual available space for
  57. XCOMM a particular directory.
  58. XCOMM
  59. XCOMM The $1 parameter will contain the directory name to test. The directory
  60. XCOMM specified will exist. DtiFreeSpace() should return the number of bytes
  61. XCOMM available via the DtiReturn() function.
  62. XCOMM
  63. XCOMM Input
  64. XCOMM $1 - directory name
  65. XCOMM Output - none
  66. XCOMM Return
  67. XCOMM number of bytes available
  68. XCOMM
  69. XCOMM ==========================================================================
  70. DtiFreeSpace()
  71. {
  72. blocks="$(df "$1" | sed 's/^.*://' | awk '{print $1}')"
  73. case "$blocks" in
  74. [0-9]*) let blocks=blocks*512
  75. DtiReturn "$blocks" ;;
  76. *) DtiReturn "0" ;; # install.dt warn and confirm
  77. esac
  78. }
  79. XCOMM ==========================================================================
  80. XCOMM
  81. XCOMM DtiVerifyConfiguration
  82. XCOMM
  83. XCOMM The default DtiVerifyConfiguration() does no system configuration
  84. XCOMM testing. For a particular platform, one might want to test for
  85. XCOMM the presence of X11R5 or the OS version, for example, before allowing
  86. XCOMM the desktop to be installed.
  87. XCOMM
  88. XCOMM Declare this function to make such platform specific tests. Return
  89. XCOMM "yes" if the system passed, or "<message text>" if the system failed
  90. XCOMM in which case install.dt will display the <message text> as the reason.
  91. XCOMM
  92. XCOMM Input - none
  93. XCOMM Output - none
  94. XCOMM Return
  95. XCOMM "yes" - system configuration verified
  96. XCOMM "<message text>" - verification failed, display message text
  97. XCOMM
  98. XCOMM ==========================================================================
  99. DtiVerifyConfiguration()
  100. {
  101. if [ "$(uname -s)" = UNIX_SV -a "$(uname -r)" = 4.2 ]
  102. then
  103. if [ "$(uname -v)" = 1.0 ]
  104. then
  105. DtiReturn \
  106. "WARNING: THE CDE DESKTOP IS NOT SUPPORTED ON UnixWare 1.0"
  107. else
  108. HASH for all 4.2 releases after 1.0
  109. DtiReturn "yes"
  110. fi
  111. else
  112. DtiReturn "ERROR: THIS IS NOT A \"UNIX_SV 4.2\" SYSTEM"
  113. fi
  114. }
  115. XCOMM ==========================================================================
  116. XCOMM
  117. XCOMM DtiWhoami
  118. XCOMM
  119. XCOMM The default DtiWhoami() uses the 'whoami' command to determine
  120. XCOMM the user name. If this platform does not have the 'whoami' command,
  121. XCOMM declare DtiWhoami() here with the appropriate functionality.
  122. XCOMM
  123. XCOMM Input - none
  124. XCOMM Output - none
  125. XCOMM Return
  126. XCOMM result of system 'whoami' command
  127. XCOMM
  128. XCOMM ==========================================================================
  129. DtiWhoami()
  130. {
  131. /usr/ucb/whoami
  132. }
  133. XCOMM ==========================================================================
  134. XCOMM
  135. XCOMM DtiPrint - echo to stderr and log
  136. XCOMM
  137. XCOMM Input
  138. XCOMM $1 - data to echo to stdout and log
  139. XCOMM Output - none
  140. XCOMM Return -none
  141. XCOMM
  142. XCOMM Override on UnixWare because of printf "%s" integer-const problem
  143. XCOMM This coordinates with the leading blank in the passing of " $meg" in master.
  144. XCOMM ==========================================================================
  145. DtiPrint()
  146. {
  147. if [ "$#" -gt 1 ]
  148. then
  149. if [ "$#" -gt 5 ]
  150. then
  151. printf "$1" "$2" "$3" "$4" "$5" "$6" $7 $8 $9 >&2
  152. else
  153. if [ "$#" -gt 4 ]
  154. then
  155. printf "$1" "$2" "$3" "$4" "$5" $6 $7 $8 $9 >&2
  156. else
  157. printf "$1" "$2" $3 $4 $5 $6 $7 $8 $9 >&2
  158. fi
  159. fi
  160. else
  161. printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >&2
  162. fi
  163. Log "$1" $2 $3 $4 $5 $6 $7 $8 $9
  164. }