minstall.in revision 0bd37d32
1#!/bin/sh 2# $XTermId: minstall.in,v 1.19 2013/04/21 18:58:54 Andres.Perera Exp $ 3# ----------------------------------------------------------------------------- 4# this file is part of xterm 5# 6# Copyright 2001-2011,2012 by Thomas E. Dickey 7# 8# All Rights Reserved 9# 10# Permission is hereby granted, free of charge, to any person obtaining a 11# copy of this software and associated documentation files (the 12# "Software"), to deal in the Software without restriction, including 13# without limitation the rights to use, copy, modify, merge, publish, 14# distribute, sublicense, and/or sell copies of the Software, and to 15# permit persons to whom the Software is furnished to do so, subject to 16# the following conditions: 17# 18# The above copyright notice and this permission notice shall be included 19# in all copies or substantial portions of the Software. 20# 21# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 25# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28# 29# Except as contained in this notice, the name(s) of the above copyright 30# holders shall not be used in advertising or otherwise to promote the 31# sale, use or other dealings in this Software without prior written 32# authorization. 33# ----------------------------------------------------------------------------- 34# 35# Install manpages, substituting a reasonable section value since XFree86 4.x 36# and derived imakes do not use constants... 37# 38# Parameters: 39# $1 = program to invoke as "install" 40# $2 = manpage to install 41# $3 = final installed-path 42# $4 = app-defaults directory 43# $5 = app-defaults class 44# $6 = application name, normally "xterm" 45# $7 = application name transformed 46# $8 = pixmap directory 47# 48# Other values correspond to definitions in xtermcfg.h, and cannot be directly 49# modified using "make". They are substituted directly into this script. 50# 51 52# override locale... 53LANG=C; export LANG 54LANGUAGE=C; export LANGUAGE 55LC_ALL=C; export LC_ALL 56LC_CTYPE=C; export LC_CTYPE 57XTERM_LOCALE=C export XTERM_LOCALE 58 59# avoid interference by the "man" command. 60for p in /bin /usr/bin 61do 62if test -f $p/cat ; then 63MANPAGER=cat; export MANPAGER 64PAGER=cat; export PAGER 65break 66fi 67done 68 69# get parameters 70MINSTALL="$1" 71OLD_FILE="$2" 72END_FILE="$3" 73APPS_DIR="$4" 74APP_TYPE="$5" 75APP_name="$6" 76USE_name="$7" 77XPMS_DIR="$8" 78 79suffix=`echo "$END_FILE" | sed -e 's%^.*\.%%'` 80NEW_FILE=temp$$ 81 82MY_MANSECT=$suffix 83 84# utmp and wtmp have different pathnames on different systems, but there 85# are only a few common choices. Note that they may not necessarily appear 86# in the same directories. Prefer utmpx/wtmpx to utmp/wtmp, since that's 87# the way the configure script is designed. 88UTMP_NAME=utmp 89UTMP_PATH=/etc 90for name in /etc /var/adm /var/run /var/log 91do 92 if test -f $name/utmpx ; then 93 UTMP_NAME=utmpx 94 UTMP_PATH=$name 95 break 96 elif test -f $name/utmp ; then 97 UTMP_PATH=$name 98 break 99 fi 100done 101UTMP_PATH=$UTMP_PATH/$UTMP_NAME 102 103WTMP_NAME=wtmp 104WTMP_PATH=/etc 105for name in /etc /var/adm /var/run /var/log 106do 107 if test -f $name/wtmpx ; then 108 WTMP_NAME=wtmpx 109 WTMP_PATH=$name 110 break 111 elif test -f $name/wtmp ; then 112 WTMP_PATH=$name 113 break 114 fi 115done 116WTMP_PATH=$WTMP_PATH/$WTMP_NAME 117 118# "X" is usually in the miscellaneous section, along with "undocumented". 119# Use that to guess an appropriate section. 120X_MANSECT=`man X 2>&1 | tr '\012' '\020' | sed -e 's/^[^0123456789]*\([^) ][^) ]*\).*/\1/'` 121test -z "$X_MANSECT" && X_MANSECT=$suffix 122 123VERSION_H=`echo "$OLD_FILE" | sed -e 's,/[^/]*$,/version.h,' -e s',^[^/]*$,version.h,'` 124PATCH_NUM=`fgrep XTERM_PATCH $VERSION_H|sed -e 's/[^0-9]*//g'` 125PATCH_YMD=`fgrep XTERM_DATE $VERSION_H|sed -e 's,[^0-9/.-]*,,g'` 126 127# Make capitalization variants 128APP_chr0=`echo "$APP_name" | sed -e 's/^\(.\).*/\1/' | tr '[a-z]' '[A-Z]'` 129APP_chr1=`echo "$APP_name" | sed -e 's/^.//'` 130APP_Name=${APP_chr0}${APP_chr1} 131APP_NAME=`echo "$APP_name" | tr '[a-z]' '[A-Z]'` 132 133# Provide for renaming in test-builds: 134USE_chr0=`echo "$USE_name" | sed -e 's/^\(.\).*/\1/' | tr '[a-z]' '[A-Z]'` 135USE_chr1=`echo "$USE_name" | sed -e 's/^.//'` 136USE_Name=${USE_chr0}${USE_chr1} 137USE_NAME=`echo "$USE_name" | tr '[a-z]' '[A-Z]'` 138 139sed -e 's%__vendorversion__%"X Window System"%' \ 140 -e 's%__app_version__%Patch\ \#'$PATCH_NUM% \ 141 -e 's%__app_date__%'$PATCH_YMD% \ 142 -e "s%^\.TH [^ ][^ ]*%.TH $USE_NAME%" \ 143 -e "s%^\.ds N $APP_Name%.ds N $USE_Name%" \ 144 -e "s%^\.ds n $APP_name%.ds n $USE_name%" \ 145 -e 's%^'"$APP_name"' \\- %'"$USE_name"' \- %' \ 146 -e s%__default_termname__%@default_TERM@% \ 147 -e s%__default_termid__%@default_termid@% \ 148 -e s%__alt_sends_esc__%@alt_sends_esc@% \ 149 -e s%__meta_sends_esc__%@meta_sends_esc@% \ 150 -e s%__backarrow_is_bs__%@backarrow_is_bs@% \ 151 -e s%__backarrow_is_erase__%@backarrow_is_erase@% \ 152 -e s%__delete_is_del__%@delete_is_del@% \ 153 -e s%__default_class__%$APP_TYPE% \ 154 -e s%__apploaddir__%$APPS_DIR% \ 155 -e s%__mansuffix__%$MY_MANSECT%g \ 156 -e s%__miscmansuffix__%$X_MANSECT%g \ 157 -e s%__pixmapsdir__%$XPMS_DIR% \ 158 -e s%fIutmp'\\%fI'$UTMP_NAME'\\%g' \ 159 -e s%/etc/utmp%$UTMP_PATH%g \ 160 -e s%fIwtmp'\\%fI'$WTMP_NAME'\\%g' \ 161 -e s%/etc/wtmp%$WTMP_PATH%g \ 162 $OLD_FILE >$NEW_FILE 163# diff -u $OLD_FILE $NEW_FILE 164 165echo "$MINSTALL $OLD_FILE $END_FILE" 166eval "$MINSTALL $NEW_FILE $END_FILE" 167 168rm -f $NEW_FILE 169