summaryrefslogtreecommitdiff
path: root/testing/util-linux/util-linux.install
blob: ef6dea1177af77699da1aaff370988625d974199 (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
post_install() {
  # create user for uuidd
  if ! getent group uuidd >/dev/null; then
    groupadd -r uuidd
  fi

  if ! getent passwd uuidd >/dev/null; then
    useradd -r -s /sbin/nologin -g uuidd uuidd
  fi

  # ensure /run/uuidd exists
  systemd-tmpfiles --create uuidd.conf
}

post_upgrade() {
  if [ "$(vercmp $2 2.21.2-4)" -lt 0 ]; then
    if [ -f /var/lib/hwclock/adjtime ]; then
      mv /var/lib/hwclock/adjtime /etc/adjtime
    fi
    if [ -d /var/lib/hwclock ]; then
      rmdir /var/lib/hwclock
    fi
  fi

  post_install
}

post_remove() {
  if getent passwd uuidd >/dev/null; then
    userdel uuidd
  fi

  if getent group uuidd >/dev/null; then
    userdel uuidd
  fi
}