summaryrefslogtreecommitdiff
path: root/package/man
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:48:04 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:48:04 +0200
commit89b7b67a13ebb7965cc7f13ad0595e2194a2d34c (patch)
tree25efd77a90ae87236e6730d8ea3846bbe0fd126f /package/man
add sqmail-4.2.29asqmail-4.2
Diffstat (limited to 'package/man')
-rwxr-xr-xpackage/man124
1 files changed, 124 insertions, 0 deletions
diff --git a/package/man b/package/man
new file mode 100755
index 0000000..6b79049
--- /dev/null
+++ b/package/man
@@ -0,0 +1,124 @@
+#!/bin/sh
+shout() { echo "$0: $@" >&2; }
+barf() { shout "fatal: $@"; exit 111; }
+safe() { "$@" || barf "cannot $@"; }
+
+me=`cat package/path | cut -d'/' -f2`
+unix=`uname -a | cut -d' ' -f1 | tr [a-z] [A-Z]`
+mandir=""
+usemanpath=0
+usemandoc=0
+
+if [ `which manpath` 2>/dev/null ]
+then
+ usemanpath=1
+fi
+
+if [ `which mandoc` 2>/dev/null ]
+then
+ usemandoc=1
+ shout "Using mandoc facility for man files."
+fi
+
+safe umask 022
+[ -d man ] || barf "no man directory"
+
+if [ -f conf-man ]
+then
+ mandir=`head -1 conf-man`
+ if [ -d "$mandir" ]
+ then
+ shout "Setting manual man-dir: $mandir."
+ else
+ if [ $usemanpath -eq 0 ]
+ then
+ barf "`manpath` not available; use conf-man instead."
+ fi
+ mandir=`manpath | awk -F: '{print $1}'`
+ if [ -d "$mandir" ]
+ then
+ shout "Setting manpath man-dir: $mandir."
+ else
+ barf "can't determine man-path directory."
+ fi
+ fi
+else
+ barf "can't determine man-path directory."
+ exit 1
+fi
+
+cd man
+if [ $usemandoc -eq 1 ]
+then
+ safe make -f Makefile.mandoc
+else
+ safe make
+fi
+
+if [ $usemandoc -eq 0 ]
+then
+ shout "Installing ${me} compressed man-files in ${mandir}."
+else
+ shout "Installing ${me} un-compressed man-files in ${mandir}."
+fi
+
+for i in `find . -name "*[1-8]"`
+do
+ all="$all $i"
+done
+
+for manfile in $all
+do
+ dir="man`echo $manfile | awk -F. '{print $NF}'`"
+ [ -d $mandir/$dir ] || safe mkdir $mandir/$dir
+ if [ $usemandoc -eq 0 ]
+ then
+ safe gzip $manfile && \
+ install -m 644 "$manfile.gz" $mandir/$dir/"${manfile#*/}.gz"
+ else
+ safe install -m 644 $manfile $mandir/$dir/${manfile#*./}
+ fi
+done
+
+## nroff: Required for old catman systems only
+
+if [ $usemandoc -eq 0 ]
+then
+ shout "Installing ${me} nroff'ed man-files in ${mandir}/catX."
+
+ all=""
+ for i in `find . -name "*0"`
+ do
+ all="$all $i"
+ done
+
+ for manfile in $all
+ do
+ catname=${manfile%.0}
+ catfiles=`ls -1 ${catname}* | grep -v '.0' | grep -v '.9'`
+
+ for catfile in $catfiles
+ do
+ dir="$mandir/cat`echo $catfile | awk -F. '{print $(NF-1)}'`"
+ safe mkdir -p $dir
+ safe install -m 644 $manfile $dir/${manfile#*/}
+ done
+ done
+else
+ if [ `which makewhatis` 2>/dev/null ]
+ then
+ makewhatis $mandir
+ shout "Installing ${me} mandoc files in db (makewhatis)."
+ elif [ `which catman` 2>/dev/null ]
+ then
+ catman $mandir
+ shout "Installing ${me} mandoc files in db (catman)."
+ else
+ man -w $mandir
+ shout "Installing ${me} mandoc files in db (man -w)."
+ fi
+fi
+
+cd ..
+
+exit 0