
1: # install-man.in - install a manpage. 2: # 3: # Copyright (c) 1997, 1998 Joseph Samuel Myers. 4: # All rights reserved. 5: # 6: # Redistribution and use in source and binary forms, with or without 7: # modification, are permitted provided that the following conditions 8: # are met: 9: # 1. Redistributions of source code must retain the above copyright 10: # notice, this list of conditions and the following disclaimer. 11: # 2. Redistributions in binary form must reproduce the above copyright 12: # notice, this list of conditions and the following disclaimer in the 13: # documentation and/or other materials provided with the distribution. 14: # 3. The name of the author may not be used to endorse or promote products 15: # derived from this software without specific prior written permission. 16: # 17: # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18: # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19: # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20: # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21: # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22: # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23: # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24: # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25: # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26: # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27: # SUCH DAMAGE. 28: 29: set -e 30: 31: if [ $# = 1 ]; then 32: page=$1 33: basepage=$(basename "$page") 34: section=${basepage##*.} 35: if [ "$section" = 6 ]; then 36: mandir=@install_prefix@@man6dir@ 37: elif [ "$section" = 8 ]; then 38: mandir=@install_prefix@@man8dir@ 39: elif [ "$section" = 5 ]; then 40: mandir=@install_prefix@@man5dir@ 41: else 42: echo "Unknown manpage section $section" >&2 43: exit 1 44: fi 45: @install_manpage@ "$page" "$mandir/$basepage" 46: if [ @gzip_manpages@ = y ]; then 47: rm -f "$mandir/$basepage.gz" 48: gzip -9 "$mandir/$basepage" 49: fi 50: elif [ $# = 2 ]; then 51: # Manpage 2 should link to manpage 1. No complications of removing 52: # directories from their names. 53: page1=$1 54: section1=${page1##*.} 55: page2=$2 56: section2=${page2##*.} 57: if [ "$section2" = 6 ]; then 58: mandir=@install_prefix@@man6dir@ 59: elif [ "$section2" = 8 ]; then 60: mandir=@install_prefix@@man8dir@ 61: elif [ "$section2" = 5 ]; then 62: mandir=@install_prefix@@man5dir@ 63: else 64: echo "Unknown manpage section $section2" >&2 65: exit 1 66: fi 67: if [ @use_dot_so@ = .so ]; then 68: echo ".so man$section1/$page1" >"$mandir/$page2" 69: chmod @manpage_perms@ "$mandir/$page2" 70: if [ @do_chown@ = y ]; then 71: chown @manpage_owner@:@manpage_group@ "$mandir/$page2" 72: fi 73: if [ @gzip_manpages@ = y ]; then 74: rm -f "$mandir/$page2.gz" 75: gzip -9 "$mandir/$page2" 76: fi 77: else 78: if [ "$section1" = "$section2" ]; then 79: linkto="$page1" 80: else 81: linkto="../man$section1/$page1" 82: fi 83: if [ @gzip_manpages@ = y ]; then 84: ln -sf "$linkto.gz" "$mandir/$page2.gz" 85: else 86: ln -sf "$linkto" "$mandir/$page2" 87: fi 88: fi 89: else 90: echo "usage: $0 manpage [ manpage ]" >&2 91: exit 1 92: fi