summarylogtreecommitdiffstats
path: root/lsi-msm.install
blob: e3b2cef2d418b88697d055041362dd3cdfd5bd95 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
yellow="${bold}$(tput setaf 3)"
blue="${bold}$(tput setaf 4)"
green="${bold}$(tput setaf 2)"

_instructions() {
  printf "${yellow}==>${all_off} ${bold}ATENTION:${all_off}
${green}==>${all_off} ${bold}Run 'LSI MegaRAID Storage Manager':${all_off}
  ${blue}->${all_off} For open '${bold}LSI MegaRAID Storage Manager${all_off}' client:
     '${bold}Menu${all_off}' -> '${bold}System${all_off}' -> '${bold}MegaRAID Storage Manager StartupUI${all_off}'
     Or launch:
     '\x23 ${bold}/usr/share/MegaRAID_Storage_Manager/startupui.sh${all_off}'\n"
}

post_install() {
  ldconfig &> /dev/null

  . /etc/profile.d/msm.sh
  cd "${MSM_HOME}"
  LC_ALL=C \
  /usr/lib/jvm/java-8-openjdk/jre/bin/java \
   -Djava.util.prefs.systemRoot="${MSM_HOME}/jre" \
   -Djava.util.prefs.userRoot="${MSM_HOME}/jre/.userPrefs" \
   -classpath .:GUI.jar \
   ExternalApp.ConfigRepositoryMain 71244 \
   -set INSTALLER_VERSION "v${1%-*}" \
   &> /dev/null

  _instructions
}

post_upgrade() {
  ldconfig &> /dev/null

  . /etc/profile.d/msm.sh
  cd "${MSM_HOME}"
  rm -fr ActiveClientList.txt
  LC_ALL=C \
  /usr/lib/jvm/java-8-openjdk/jre/bin/java \
    -Djava.util.prefs.systemRoot="${MSM_HOME}/jre" \
    -Djava.util.prefs.userRoot="${MSM_HOME}/jre/.userPrefs" \
    -classpath .:Framework/Framework.jar \
    VivaldiHeartbeat ActiveClientList.txt \
    &> /dev/null
  LC_ALL=C \
  /usr/lib/jvm/java-8-openjdk/jre/bin/java \
    -Djava.util.prefs.systemRoot="${MSM_HOME}/jre" \
    -Djava.util.prefs.userRoot="${MSM_HOME}/jre/.userPrefs" \
    -classpath .:GUI.jar \
    ExternalApp.ConfigRepositoryMain 71244 \
    -clear \
    &> /dev/null
  LC_ALL=C \
  /usr/lib/jvm/java-8-openjdk/jre/bin/java \
    -Djava.util.prefs.systemRoot="${MSM_HOME}/jre" \
    -Djava.util.prefs.userRoot="$MSM_HOME}/jre/.userPrefs" \
    -classpath .:GUI.jar \
    ExternalApp.ConfigRepositoryMain 71244 \
    -set INSTALLER_VERSION "v${1%-*}" \
    &> /dev/null

  _instructions
}

pre_remove() {
  . /etc/profile.d/msm.sh
  cd "${MSM_HOME}"
  rm -fr ActiveClientList.txt
  LC_ALL=C \
  /usr/lib/jvm/java-8-openjdk/jre/bin/java \
    -Djava.util.prefs.systemRoot="${MSM_HOME}/jre" \
    -Djava.util.prefs.userRoot="${MSM_HOME}/jre/.userPrefs" \
    -classpath .:Framework/Framework.jar \
    VivaldiHeartbeat ActiveClientList.txt \
    &> /dev/null
  LC_ALL=C \
  /usr/lib/jvm/java-8-openjdk/jre/bin/java \
    -Djava.util.prefs.systemRoot="${MSM_HOME}/jre" \
    -Djava.util.prefs.userRoot="${MSM_HOME}/jre/.userPrefs" \
    -classpath .:GUI.jar \
    ExternalApp.ConfigRepositoryMain 71244 \
    -clear \
    &> /dev/null

  if [ "$(systemctl is-active lsi_msm)" = "active" ]; then
    systemctl stop lsi_msm
    printf "${green}==>${all_off} ${bold}Stopping 'lsi_msm' Service${all_off}.\n"
  fi
  if [ "$(systemctl is-enabled lsi_msm)" = "enable" ]; then
    systemctl disable lsi_msm
    printf "${green}==>${all_off} ${bold}Disabling 'lsi_msm' Service${all_off}.\n"
  fi
}

post_remove() {
  ldconfig &> /dev/null

  paths=(/usr/share/MegaRAID_Storage_Manager)
  first=true
  for path in ${paths[@]}; do
    if [ -d $path ]; then
      if $first; then
        first=false
        printf "${green}==>${all_off} ${bold}Leftover Paths:${all_off}\n"
      fi
      printf "${blue}  -> ${all_off} ${bold}$path${all_off}\n"
    fi
  done

  files=(/etc/SlAsyncAddpCfg*.cfg)
  first=true
  for file in ${files[@]}; do
    if [ -d $file ]; then
      if $first; then
        first=false
        printf "${green}==>${all_off} ${bold}Leftover files:${all_off}\n"
      fi
      printf "${blue}  -> ${all_off} ${bold}$file${all_off}\n"
    fi
  done
}