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
post_install() {
  groupadd -r tss

  useradd -r -g tss -d /var/lib/tpm -s /bin/false tss
  chown tss:tss /usr/sbin/tcsd

  mkdir -p /usr/var/lib/tpm
  chown tss:tss /usr/var/lib/tpm
  chmod 0700 /usr/var/lib/tpm

  chown tss:tss /etc/tcsd.conf
  chmod 0600 /etc/tcsd.conf
}

post_upgrade() {
  post_install $1
}

pre_remove() {
  /etc/rc.d/tcsd stop &> /dev/null
  rm -rf /usr/var/lib/tpm
  userdel tss
}

op=$1
shift
$op $*