| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
lib_log="${DPKG_ROOT:-}/var/lib/wtmpdb/wtmp.db" |
| 6 |
new_log="${DPKG_ROOT:-}/var/log/wtmp.db" |
| 7 |
|
| 8 |
if [ "$1" = "configure" ] |
| 9 |
then |
| 10 |
# Effect the conversion from storing the live log in the state directory to |
| 11 |
# storing it in its proper place, the logs directory. |
| 12 |
if [ -s "$lib_log" ] && [ ! -h "$lib_log" ] && [ ! -s "$new_log" ] |
| 13 |
then |
| 14 |
mv -f "$lib_log" "$new_log" |
| 15 |
fi |
| 16 |
|
| 17 |
# The unhandled case is records in both old and new locations. For this we |
| 18 |
# would need a 'wtmpdb merge' operation called in wtmpdb.postinst but no |
| 19 |
# such operation yet exists and arguably we should not second guess what |
| 20 |
# had happened in that scenario. In this case the log in the old location |
| 21 |
# will be left untouched. |
| 22 |
|
| 23 |
# Set up the symlink in case tmpfiles.d is not serviced on this system. |
| 24 |
if [ ! -f "$lib_log" ] |
| 25 |
then |
| 26 |
mkdir -p "$(dirname "$lib_log")" |
| 27 |
ln -sf ../../log/wtmp.db "$lib_log" |
| 28 |
fi |
| 29 |
fi |
| 30 |
|
| 31 |
#DEBHELPER# |