installCDE.src: remove duplicate code
[oweals/cde.git] / cde / admin / IntegTools / post_install / configLang.src
1 XCOMM!/bin/ksh
2 XCOMM $XConsortium: configLang.src /main/3 1996/04/23 19:33:13 drk $
3
4 ConfigureBackdropsForLang()
5 {
6     if [ ! -d /etc/dt/backdrops/$thelang ]
7     then
8         mkdir -p /etc/dt/backdrops/$thelang
9     fi
10
11     typeset -L1 firstchar
12
13     exec 3< ${build_tree}/cde1/localized/${thelang}/backdrops/backdrops.msg
14
15     while read -u3 SRC
16     do
17         firstchar=$SRC
18         if [ "$SRC" != "" -a "$firstchar" != "!" ]
19         then
20             set -A tokens $SRC
21             if [ "${tokens[1]}" = "" ]
22             then
23                 ln -s /usr/dt/backdrops/C/${tokens[0]} \
24                         /etc/dt/backdrops/$thelang/${tokens[0]}
25             else
26                 ln -s /usr/dt/backdrops/C/${tokens[0]} \
27                         /etc/dt/backdrops/$thelang/${tokens[1]}
28             fi
29         fi
30     done
31
32     exec 3<&-
33 }
34
35 ConfigurePalettesForLang()
36 {
37     if [ ! -d /etc/dt/palettes/$thelang ]
38     then
39         mkdir -p /etc/dt/palettes/$thelang
40     fi
41
42     typeset -L1 firstchar
43
44     exec 3< ${build_tree}/cde1/localized/${thelang}/palettes/palettes.msg
45
46     while read -u3 SRC
47     do
48         firstchar=$SRC
49         if [ "$SRC" != "" -a "$firstchar" != "!" ]
50         then
51             set -A tokens $SRC
52             if [ "${tokens[1]}" = "" ]
53             then
54                 ln -s /usr/dt/palettes/C/${tokens[0]} \
55                         /etc/dt/palettes/$thelang/${tokens[0]}
56             else
57                 ln -s /usr/dt/palettes/C/${tokens[0]} \
58                         /etc/dt/palettes/$thelang/${tokens[1]}
59             fi
60         fi
61     done
62
63     exec 3<&-
64 }
65
66 #include "option.func"
67
68 XCOMM ##################################################################
69 XCOMM 
70 XCOMM  Main Body
71 XCOMM 
72 XCOMM ##################################################################
73
74     build_tree=$PWD
75     build_tree=${build_tree%/admin/IntegTools/post_install}
76
77     thelang=$2
78
79     if [ "$thelang" = "" -o "$thelang" = "-e" -o "$thelang" = "-d" ]
80     then
81         echo "Usage: configLang [ -e | -d ] <Lang>"
82         return 1
83     fi
84
85     HandleOption $*
86
87     if [ "$OPERATION" = "configure" ]
88     then
89
90         ConfigureBackdropsForLang
91         ConfigurePalettesForLang
92
93     elif [ "$OPERATION" = "deconfigure" ]
94     then
95
96         rm -rf /etc/dt/backdrops/$thelang
97         rm -rf /etc/dt/palettes/$thelang
98
99     fi