summarylogtreecommitdiffstats
path: root/geant4.install
blob: 295e50da5538ba2509f9f54e8dbb5c78765f0c0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh

_init() {
    variables=(  "G4NEUTRONHPDATA" \
                 "G4LEDATA" \
                 "G4LEVELGAMMADATA" \
                 "G4RADIOACTIVEDATA" \
                 "G4PARTICLEXSDATA" \
                 "G4PIIDATA" \
                 "G4REALSURFACEDATA" \
                 "G4SAIDXSDATA" \
                 "G4ABLADATA" \
                 "G4INCLDATA" \
                 "G4ENSDFSTATEDATA" \
                 "G4PARTICLEHPDATA" \  # not included by default anyway
                 "G4NEUTRONXS" \       # to be removed
              )

shell=("sh" "csh")

existing="existing"
path="/etc/profile.d"
}
_clean(){
    for _ext in ${shell[*]}
    do
        rm -f $existing.${_ext}
    done
}
_read() {
    _init
    for _varname in ${variables[*]}
    do
	if [ "$_varname" == "G4NEUTRONXS" ]   # to be removed
	then
	    continue
	fi
        for _ext in ${shell[*]}
        do
            sed -n /${_varname}/p ${path}/geant4.${_ext} >> $existing.${_ext}
	done
    done
}
_keep() {
    _init
    for _ext in ${shell[*]}
    do
        cat $existing.${_ext} >> ${path}/geant4.${_ext}
    done
    _clean
}

pre_upgrade() {
    _read
}
post_upgrade() {
    _keep
}