summaryrefslogtreecommitdiffstats
path: root/usr.sbin/etcupdate
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2013-12-09 19:31:30 +0000
committerjhb <jhb@FreeBSD.org>2013-12-09 19:31:30 +0000
commit4d0370b2ea8b272957152009285cb046543d0f82 (patch)
treee2fe4b8fff3506129db93a9eda53d3561511ee18 /usr.sbin/etcupdate
parenta5fb9c53410951ccdd7f40ec06e6aacf05e777dd (diff)
downloadFreeBSD-src-4d0370b2ea8b272957152009285cb046543d0f82.zip
FreeBSD-src-4d0370b2ea8b272957152009285cb046543d0f82.tar.gz
- Refresh /etc/localtime after each update using tzsetup -r.
- Regenerate /var/db/services.db when /etc/services changes. MFC after: 1 week
Diffstat (limited to 'usr.sbin/etcupdate')
-rw-r--r--usr.sbin/etcupdate/etcupdate.823
-rwxr-xr-xusr.sbin/etcupdate/etcupdate.sh46
2 files changed, 66 insertions, 3 deletions
diff --git a/usr.sbin/etcupdate/etcupdate.8 b/usr.sbin/etcupdate/etcupdate.8
index 91e9e1a..ffd0516 100644
--- a/usr.sbin/etcupdate/etcupdate.8
+++ b/usr.sbin/etcupdate/etcupdate.8
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010-2012 Advanced Computing Technologies LLC
+.\" Copyright (c) 2010-2013 Advanced Computing Technologies LLC
.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
.\" All rights reserved.
.\"
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 12, 2013
+.Dd December 9, 2013
.Dt ETCUPDATE 8
.Os
.Sh NAME
@@ -695,6 +695,25 @@ has been removed from the
tree,
but it has been locally modified.
The modified version of the file remains in the destination directory.
+.It "Needs update: /etc/localtime (required manual update via tzsetup(1))"
+The
+.Fa /var/db/zoneinfo
+file does not exist,
+so
+.Nm
+was not able to refresh
+.Fa /etc/localtime
+from its source file in
+.Fa /usr/share/zoneinfo .
+Running
+.Xr tzsetup 1
+will both refresh
+.Fa /etc/localtime
+and generate
+.Fa /var/db/zoneinfo
+permitting future updates to refresh
+.Fa /etc/localtime
+automatically.
.It "Needs update: /etc/mail/aliases.db (required manual update via newaliases(1))"
The file
.Pa /etc/mail/aliases
diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh
index e5ffe48..addcc14 100755
--- a/usr.sbin/etcupdate/etcupdate.sh
+++ b/usr.sbin/etcupdate/etcupdate.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2010 Advanced Computing Technologies LLC
+# Copyright (c) 2010-2013 Advanced Computing Technologies LLC
# Written by: John H. Baldwin <jhb@FreeBSD.org>
# All rights reserved.
#
@@ -486,6 +486,39 @@ diffnode()
esac
}
+# Run one-off commands after an update has completed. These commands
+# are not tied to a specific file, so they cannot be handled by
+# post_install_file().
+post_update()
+{
+ local args
+
+ # None of these commands should be run for a pre-world update.
+ if [ -n "$preworld" ]; then
+ return
+ fi
+
+ # If /etc/localtime exists and is not a symlink and /var/db/zoneinfo
+ # exists, run tzsetup -r to refresh /etc/localtime.
+ if [ -f ${DESTDIR}/etc/localtime -a \
+ ! -L ${DESTDIR}/etc/localtime ]; then
+ if [ -f ${DESTDIR}/var/db/zoneinfo ]; then
+ if [ -n "${DESTDIR}" ]; then
+ args="-C ${DESTDIR}"
+ else
+ args=""
+ fi
+ log "tzsetup -r ${args}"
+ if [ -z "$dryrun" ]; then
+ tzsetup -r ${args} >&3 2>&1
+ fi
+ else
+ warn "Needs update: /etc/localtime (required" \
+ "manual update via tzsetup(1))"
+ fi
+ fi
+}
+
# Create missing parent directories of a node in a target tree
# preserving the owner, group, and permissions from a specified
# template tree.
@@ -583,6 +616,14 @@ post_install_file()
fi
fi
;;
+ /etc/services)
+ log "services_mkdb -q -o $DESTDIR/var/db/services.db" \
+ "${DESTDIR}$1"
+ if [ -z "$dryrun" ]; then
+ services_mkdb -q -o $DESTDIR/var/db/services.db \
+ ${DESTDIR}$1 >&3 2>&1
+ fi
+ ;;
esac
}
@@ -1506,6 +1547,9 @@ EOF
"(requires manual update via newaliases(1))"
fi
+ # Run any special one-off commands after an update has completed.
+ post_update
+
if [ -s $WARNINGS ]; then
echo "Warnings:"
cat $WARNINGS
OpenPOWER on IntegriCloud