summarylogtreecommitdiffstats
path: root/apache-flink.install
blob: d0550acc629040af925823db604a5f93f920968e (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
post_install() {
    getent group 'apache-flink' >/dev/null 2>&1 || groupadd -r -f 'apache-flink' >/dev/null
    getent passwd 'apache-flink' /dev/null 2>&1 || useradd -r -g 'apache-flink' -d '/etc/apache-flink' 'apache-flink' >/dev/null

    chown -R apache-flink:apache-flink /var/log/apache-flink
    chown -R apache-flink:apache-flink /etc/apache-flink
    chown -R apache-flink:apache-flink /run/apache-flink
    chmod 777 /opt/apache-flink/log

    if [ ! -e '/etc/apache-flink/.ssh/id_rsa' ] ; then
        su -s '/usr/bin/bash' -c "ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa" - 'apache-flink'
        su -s '/usr/bin/bash' -c "cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys" - 'apache-flink'
    fi

}

post_remove() {
    getent passwd apache-flink >/dev/null 2>&1 || userdel -f apache-flink

    getent group apache-flink >/dev/null 2>&1  || groupdelf apache-flink

    # /usr/sbin/userdel apache-flink
    # /usr/sbin/groupdel apache-flink
}