summarylogtreecommitdiffstats
path: root/opentsdb.install
blob: 2ed7dc77a73bd0af7e11a211cf60574b393087f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
post_install() {
  getent group 'opentsdb' >/dev/null || groupadd -r 'opentsdb'
  getent passwd 'opentsdb' >/dev/null || useradd -r -g 'opentsdb' 'opentsdb'

  declare -a dirs=(
    "/etc/opentsdb"
    "/usr/share/opentsdb/plugins"
    "/var/log/opentsdb"
  )
  for fn in "${dirs[@]}"; do
    if [[ ! -d "$fn" ]]; then
      mkdir -p "$fn"
    fi
    chown -R opentsdb:opentsdb "$fn"
  done
}

post_remove() {
  getent passwd 'opentsdb' >/dev/null && userdel 'opentsdb'
  getent group 'opentsdb' >/dev/null && groupdel 'opentsdb'
}