summaryrefslogtreecommitdiffstats
path: root/system/man-db/doinst.sh
diff options
context:
space:
mode:
author B. Watson2014-08-15 09:58:19 +0200
committer Willy Sudiarto Raharjo2014-08-15 18:21:33 +0200
commitb1e258732ea485dd4feb6d25dd2ae3f636dbfaef (patch)
treea6b0eceb0da7f56da97d89fc45e06b1910939b26 /system/man-db/doinst.sh
parent4c4f7066fc127ec5a20de1c5dad2ac1668cbd4e5 (diff)
downloadslackbuilds-b1e258732ea485dd4feb6d25dd2ae3f636dbfaef.tar.gz
system/man-db: Added (database-driven manual pager suite).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/man-db/doinst.sh')
-rw-r--r--system/man-db/doinst.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/system/man-db/doinst.sh b/system/man-db/doinst.sh
new file mode 100644
index 0000000000..42773f6cd9
--- /dev/null
+++ b/system/man-db/doinst.sh
@@ -0,0 +1,32 @@
+
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/man_db.conf.new
+
+# Generate the initial man database (or rebuild it if it exists).
+# We want to skip this step if installing somewhere besides / (e.g. with
+# the -root option or ROOT env variable set for installpkg), hence the
+# readlink silliness.
+
+# The -c option means it blows away any existing db. I thought about
+# leaving it off (it will still create the db if it doesn't exist),
+# but decided it's better to build it fresh if the package gets
+# reinstalled (in case the db format has changed, or in case the
+# db is corrupted and the user is trying to fix it by reinstalling
+# this package).
+
+[ -x /bin/readlink ] && \
+[ "$( /bin/readlink -f $( pwd ) )" = "/" ] && \
+( [ -x /opt/man-db/bin/mandb ] && /opt/man-db/bin/mandb -c -q ) || \
+( [ -x /usr/bin/mandb ] && /usr/bin/mandb -c -q )