summarylogtreecommitdiffstats
path: root/cms-git.install
blob: cee08a97cf8fe1a67df3b24d44a5146ee102f4e2 (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
# chosen at random
CMSUSER_GID=26950
CMSUSER_UID=$CMSUSER_GID

post_install() {
  # Not sure if this is really needed
  install -d -m770 -g$CMSUSER_GID /var/run/cms

  # Copy configuration files, if they don't already exist
  cp --archive --no-clobber /usr/lib/cms/cms{,.ranking}.conf /etc/

  echo
  if ! getent group cmsuser >/dev/null; then
    groupadd -g$CMSUSER_GID cmsuser
  fi
  if ! getent passwd cmsuser >/dev/null; then
    useradd -u$CMSUSER_UID -g$CMSUSER_GID cmsuser -c 'CMS default user' -M -r -s /bin/false
  fi

  echo ">>> !! WARNING !!"
  echo ">>> For now, it is required that you add yourself to the cmsuser group,"
  echo ">>> for example by issuing this command:"
  echo ">>>   # usermod -a -G cmsuser <your user>"
  echo ">>> Logout to make the change effective. Also, remember to customize"
  echo ">>> the configuration files /etc/cms.conf and /etc/cms.ranking.conf."
  echo
}

post_upgrade() {
  post_install $1
}

post_remove() {
  echo
  echo ">>> !! WARNING !!"
  echo ">>> We won't delete the cmsuser user (nor the group), in case you should"
  echo ">>> need them for some reason. If you really don't need CMS anymore, then"
  echo ">>> you can issue:"
  echo ">>>   # userdel -r cmsuser"
  echo ">>> (ignore the error 'group not removed because it has other members')"
  echo ">>> And then run:"
  echo ">>>   # groupdel cmsuser"
  echo ">>> in order to delete the group (and remove every user from it)"
  echo ">>>"
  echo ">>> Also, if you want to delete the configuration files, then you can"
  echo ">>> issue this command:"
  echo ">>>   # rm /etc/cms{,.ranking}.conf"
  echo
}