summaryrefslogtreecommitdiff
path: root/community/elasticsearch/elasticsearch.install
blob: ab25dbdb611cea6281e92b5620212e50e41907c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
post_install() {
    getent group elasticsearch >/dev/null 2>&1 || groupadd -g 114 elasticsearch &>/dev/null
    getent passwd elasticsearch >/dev/null 2>&1 || useradd -u 114 -g elasticsearch -d /usr/share/elasticsearch -s /bin/false elasticsearch &>/dev/null

    systemd-tmpfiles --create elasticsearch.conf
    chown -R elasticsearch:elasticsearch /usr/share/elasticsearch
}

post_upgrade(){
    getent group elasticsearch >/dev/null 2>&1 || groupadd -g 114 elasticsearch &>/dev/null
    getent passwd elasticsearch >/dev/null 2>&1 || useradd -u 114 -g elasticsearch -d /usr/share/elasticsearch -s /bin/false elasticsearch &>/dev/null
    
    systemd-tmpfiles --create elasticsearch.conf
}

post_remove() {
    if getent passwd elasticsearch >/dev/null 2>&1; then
        userdel elasticsearch
    fi
    if getent group elasticsearch >/dev/null 2>&1; then
        groupdel elasticsearch
    fi
}