dtinfo other files
[oweals/cde.git] / cde / admin / IntegTools / post_install / dec / configShlibs.src
1 XCOMM! /bin/ksh
2 XCOMM #######
3 XCOMM  Product: CDE
4 XCOMM  Fileset: CDE-SHLIBS
5 XCOMM  customize
6 XCOMM  @(#) $XConsortium: configShlibs.src /main/2 1996/04/21 19:14:20 drk $
7 XCOMM #######
8 XCOMM
9 XCOMM (c) Copyright Hewlett-Packard Company, 1993
10 XCOMM
11 XCOMM #######
12 #define STAR *
13
14 XCOMM ############################################
15 RemoveShlibFiles()
16 {
17     while read SRC
18     do
19       if [ "$SRC" != "" ]
20       then
21         rm -f $SRC
22         dirname=${SRC%/STAR}
23         if [ -d $dirname ]
24         then
25           cd $dirname
26           while [ "$dirname" != "$CDE_TOP" ]
27           do
28             cd ..
29             rmdir ${dirname##STAR/} >/dev/null 2>/dev/null
30             dirname=${dirname%/STAR}
31           done
32         fi
33       fi
34     done <<-EOF
35 #include "CDE-SHLIBS.list"
36         EOF
37 }
38
39 VerifyInstalledFiles()
40 {
41     echo "Status   mode    owner   group   filename"
42     echo "-----------------------------------------"
43 XCOMM     exists  correct correct correct  /usr/dt/foo1
44 XCOMM     MISSING  WRONG   WRONG   WRONG   /usr/dt/foo2
45 XCOMM        exists    the link is correct    /usr/dt/link
46
47     while read SRC
48     do
49 #include "../verify.func"
50     done <<-EOF
51 #include "CDE-SHLIBS.lst"
52         EOF
53 }
54
55 #include "../option.func"
56
57 MakeTheLink()
58 {
59 XCOMM
60 XCOMM Special treatment for CDE .so's that would otherwise overwrite
61 XCOMM sponsor-provided libraries.
62 XCOMM
63   typeset -i status=0
64
65   for lib in $CDE_NEW_SHLIB
66   do
67     savedlib=/usr/shlib/$lib.preCDE
68     sharelib=/usr/shlib/$lib
69     cdelib=CDE_INSTALLATION_TOP/lib/$lib
70
71     echo "  Creating symlink for $lib"
72
73     if [ -L $sharelib ]
74     then
75
76         if [ ! -e $savedlib ]
77         then
78             /bin/mv $sharelib $savedlib
79         fi
80         /bin/ln -s -f $cdelib $sharelib
81
82     elif [ -e $sharelib ]
83     then
84
85         /bin/mv -f $sharelib $savedlib
86         /bin/ln -s $cdelib $sharelib
87
88     else
89
90         echo "  Failed to symlink $lib"
91         status=1
92     fi
93
94   done
95   return $status
96 }
97
98 UnmakeTheLink()
99 {
100 XCOMM
101 XCOMM Restore the saved versions of libraries.
102 XCOMM
103   for lib in $CDE_NEW_SHLIB
104   do
105     savedlib=/usr/shlib/$lib.preCDE
106     newlib=/usr/shlib/$lib
107
108     echo "  Restoring $lib"
109
110     if [ -e $savedlib ]
111     then
112         if [ -L $newlib ]
113         then
114             /bin/rm -f $newlib
115             /bin/mv -f $savedlib $newlib
116         elif [ -e /usr/shlib/$lib ]
117         then
118             echo "  $newlib is not a symlink.  Left alone."
119         else
120             /bin/mv -f $savedlib $newlib
121         fi
122     fi
123
124   done
125   return $status
126 }
127
128 XCOMM ##########################################################################
129 XCOMM
130 XCOMM                           Main Body
131 XCOMM
132 XCOMM ##########################################################################
133
134 PRODUCT=CDE
135 FILESET=CDE-SHLIBS
136 retval=0
137 CDE_TOP=CDE_INSTALLATION_TOP
138 CDE_CONF_TOP=CDE_CONFIGURATION_TOP
139 CDE_NEW_SHLIB="libXm.so libMrm.so"
140
141   HandleOption $*
142
143   if [ "$OPERATION" = "configure" ]
144   then
145
146 XCOMM    MakeTheLink
147     retval=0
148
149   elif [ "$OPERATION" = "deconfigure" ]
150   then
151
152 XCOMM    UnmakeTheLink
153
154     RemoveShlibFiles
155
156     VerifyInstalledFiles
157
158   elif [ "$OPERATION" = "verify" ]
159   then
160
161     VerifyInstalledFiles
162
163   fi
164
165   return $retval
166