Project

General

Profile

« Previous | Next » 

Revision 25876144

Added by Andreas Kohlbecker almost 11 years ago

first commits towards fixing #2324

View differences:

src/main/installer/linux/postrm
5 5

  
6 6
set -e
7 7

  
8
#variables
8
#
9
# variables
10
#
9 11
CDM_HOME="/opt/cdmserver/"
10
CDM_LIBRARY=$CDM_HOME".cdmLibrary"
11
LOG="/var/log/cdmserver/"
12
bindir="/etc/init.d/"
12
CDM_CONFIG_TEMPLATE="/opt/cdmserver/templates/.cdmLibrary"
13
CDM_LOG="/var/log/cdmserver/"
14

  
15
INIT_SCRIPT="cdmserver"
16
ETC_CDMSERVER="/etc/cdmserver/"
13 17

  
14
SERVERSCRIPT="cdmserver"
15
SERVERJAR="cdm-server.jar"
16
SERVERCONF="datasources.xml"
18
CDM_USER=cdm
19
CDM_GROUP=cdm
17 20

  
18
CDM_USER="cdmuser"
19
CDM_GROUP="cdmgroup"
21
CDM_USER_HOME=$CDM_HOME
20 22

  
21 23
#
22
#functions
24
# functions
23 25
#
24 26
userExist(){
25 27
    grep $1 /etc/passwd > /dev/null
......
47 49

  
48 50
do_remove(){
49 51

  
52
    echo "... do_remove()"
53

  
50 54
    #stopping the server
51
    if [ -e $bindir$SERVERSCRIPT ]
55
    if [ -x /etc/init.d/$INIT_SCRIPT ]
52 56
    then
53
    $bindir$SERVERSCRIPT stop
57
      echo "stopping server ..."
58
      /etc/init.d/$INIT_SCRIPT stop
54 59
    fi
55
    
56
   
57
    
58
    #removing the user and group
60

  
61
    echo "now removing server from rc.d ..."
62
    update-rc.d -f $INIT_SCRIPT remove
63

  
64
    rm -f $CDM_USER_HOME.cdmLibrary
65

  
66
    return 0
67
}
68

  
69
do_purge(){
70

  
71
    echo "... do_purge()"
72

  
73
    # removing the user and group
59 74
    if ( userExist $CDM_USER  )
60 75
    then
61
    userdel $CDM_USER
76
      userdel $CDM_USER
62 77
    fi
63 78

  
64 79
    if ( groupExist $CDM_GROUP  )
65 80
    then
66
    groupdel $CDM_GROUP
81
      groupdel $CDM_GROUP
67 82
    fi
68
    
69
    # remove the binary
70
    rm $CDM_HOME$SERVERJAR
71
    
72
    return $TRUE
73
    
74
}
75 83

  
76
do_purge(){
77
    do_remove
78
    
79
    #removing the daemon script
80
    rm -f $bindir$SERVERSCRIPT
81
    update-rc.d -f $SERVERSCRIPT remove
82
    
83
    #removing the directories
84
    rm -rf $CDM_LIBRARY
85
    rm -rf $CDM_HOME
86

  
87
    return $TRUE
84
    #
85
    # remove log files
86
    #
87
    rm -rf $CDM_LOG
88

  
89
    #
90
    # remove all configuration files
91
    #
92
    if [ -d $ETC_CDMSERVER ]
93
    then
94
      rm -r $ETC_CDMSERVER
95
    fi
96

  
97
    return 0
88 98
}
89 99

  
90 100
case "$1" in

Also available in: Unified diff