File: libwtmpdb0.postinst

package info (click to toggle)
wtmpdb 0.75.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 692 kB
  • sloc: ansic: 4,222; xml: 715; sh: 81; makefile: 16
file content (29 lines) | stat: -rw-r--r-- 741 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

set -e

lib_log="${DPKG_ROOT:-}/var/lib/wtmpdb/wtmp.db"
new_log="${DPKG_ROOT:-}/var/log/wtmp.db"

# Effect the conversion from storing the live log in the state directory to
# storing it in its proper place, the logs directory. Also set up the symlink
# where tmpfiles.d is not available.
if [ "$1" = "configure" ]
then
  if [ -s "$lib_log" ] && [ ! -h "$lib_log" ] && [ ! -s "$new_log" ]
  then
    mv -f "$lib_log" "$new_log"
  fi

  # The unhandled case is records in both locations. For this we need
  # a 'wtmpdb merge' operation called in wtmpdb.postinst but no such
  # operation yet exists.

  if [ ! -f "$lib_log" ]
  then
    mkdir -p "$(dirname "$lib_log")"
    ln -sf ../../log/wtmp.db "$lib_log"
  fi
fi

#DEBHELPER#