summarylogtreecommitdiffstats
path: root/envizon.install
blob: ce03da2d4cf0640309701b7c455bd61f5dd39a5a (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
post_install() {
  cd /opt/envizon || exit
  openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 \
    -subj "/C=DE/ST=None/L=None/O=evait/CN=None" \
    -keyout .ssl/localhost.key  -out .ssl/localhost.crt
  openssl rand -hex 64 > config/secret
  systemd-sysusers envizon.conf
  post_group "$@"
  post_common "$@"
}

post_upgrade() {
  if [ -d /usr/share/envizon ]; then
    echo ">>    Found directory '/usr/share/envizon'. This might be left over"
    echo ">>    from a previous installation. You should check if you still need it,"
    echo ">>    otherwise it can probably be removed."
  fi
  post_group "$@"
  post_common "$@"
}

post_remove() {
  rm -r /opt/envizon
}

post_group() {
  chown -R :envizon /opt/envizon
  chmod -R g+w /opt/envizon
  chmod -R g+r /opt/envizon/.ssl
}

post_common() {
  echo ">>"
  echo ">>    To run envizon, you need to be a member of the envizon group."
  echo ">>    You can add your user to the group with 'sudo usermod -a -G envizon your_user'."
  echo ">>    Afterwards, you can apply the group changes immediately"
  echo '>>    with '\''exec sg envizon newgrp `id -gn`'\''.'
  echo ">>"
  echo ">>    A running and initialized PostgreSQL instance is required. If you haven't done so yet,"
  echo ">>    run sudo -u postgres /opt/envizon/db_setup.sh to create a database and the database user."
}