minstall.in revision 0bd37d32
10bd37d32Smrg#!/bin/sh 20bd37d32Smrg# $XTermId: minstall.in,v 1.19 2013/04/21 18:58:54 Andres.Perera Exp $ 30bd37d32Smrg# ----------------------------------------------------------------------------- 40bd37d32Smrg# this file is part of xterm 50bd37d32Smrg# 60bd37d32Smrg# Copyright 2001-2011,2012 by Thomas E. Dickey 70bd37d32Smrg# 80bd37d32Smrg# All Rights Reserved 90bd37d32Smrg# 100bd37d32Smrg# Permission is hereby granted, free of charge, to any person obtaining a 110bd37d32Smrg# copy of this software and associated documentation files (the 120bd37d32Smrg# "Software"), to deal in the Software without restriction, including 130bd37d32Smrg# without limitation the rights to use, copy, modify, merge, publish, 140bd37d32Smrg# distribute, sublicense, and/or sell copies of the Software, and to 150bd37d32Smrg# permit persons to whom the Software is furnished to do so, subject to 160bd37d32Smrg# the following conditions: 170bd37d32Smrg# 180bd37d32Smrg# The above copyright notice and this permission notice shall be included 190bd37d32Smrg# in all copies or substantial portions of the Software. 200bd37d32Smrg# 210bd37d32Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 220bd37d32Smrg# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 230bd37d32Smrg# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 240bd37d32Smrg# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 250bd37d32Smrg# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 260bd37d32Smrg# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 270bd37d32Smrg# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 280bd37d32Smrg# 290bd37d32Smrg# Except as contained in this notice, the name(s) of the above copyright 300bd37d32Smrg# holders shall not be used in advertising or otherwise to promote the 310bd37d32Smrg# sale, use or other dealings in this Software without prior written 320bd37d32Smrg# authorization. 330bd37d32Smrg# ----------------------------------------------------------------------------- 340bd37d32Smrg# 350bd37d32Smrg# Install manpages, substituting a reasonable section value since XFree86 4.x 360bd37d32Smrg# and derived imakes do not use constants... 370bd37d32Smrg# 380bd37d32Smrg# Parameters: 390bd37d32Smrg# $1 = program to invoke as "install" 400bd37d32Smrg# $2 = manpage to install 410bd37d32Smrg# $3 = final installed-path 420bd37d32Smrg# $4 = app-defaults directory 430bd37d32Smrg# $5 = app-defaults class 440bd37d32Smrg# $6 = application name, normally "xterm" 450bd37d32Smrg# $7 = application name transformed 460bd37d32Smrg# $8 = pixmap directory 470bd37d32Smrg# 480bd37d32Smrg# Other values correspond to definitions in xtermcfg.h, and cannot be directly 490bd37d32Smrg# modified using "make". They are substituted directly into this script. 500bd37d32Smrg# 510bd37d32Smrg 520bd37d32Smrg# override locale... 530bd37d32SmrgLANG=C; export LANG 540bd37d32SmrgLANGUAGE=C; export LANGUAGE 550bd37d32SmrgLC_ALL=C; export LC_ALL 560bd37d32SmrgLC_CTYPE=C; export LC_CTYPE 570bd37d32SmrgXTERM_LOCALE=C export XTERM_LOCALE 580bd37d32Smrg 590bd37d32Smrg# avoid interference by the "man" command. 600bd37d32Smrgfor p in /bin /usr/bin 610bd37d32Smrgdo 620bd37d32Smrgif test -f $p/cat ; then 630bd37d32SmrgMANPAGER=cat; export MANPAGER 640bd37d32SmrgPAGER=cat; export PAGER 650bd37d32Smrgbreak 660bd37d32Smrgfi 670bd37d32Smrgdone 680bd37d32Smrg 690bd37d32Smrg# get parameters 700bd37d32SmrgMINSTALL="$1" 710bd37d32SmrgOLD_FILE="$2" 720bd37d32SmrgEND_FILE="$3" 730bd37d32SmrgAPPS_DIR="$4" 740bd37d32SmrgAPP_TYPE="$5" 750bd37d32SmrgAPP_name="$6" 760bd37d32SmrgUSE_name="$7" 770bd37d32SmrgXPMS_DIR="$8" 780bd37d32Smrg 790bd37d32Smrgsuffix=`echo "$END_FILE" | sed -e 's%^.*\.%%'` 800bd37d32SmrgNEW_FILE=temp$$ 810bd37d32Smrg 820bd37d32SmrgMY_MANSECT=$suffix 830bd37d32Smrg 840bd37d32Smrg# utmp and wtmp have different pathnames on different systems, but there 850bd37d32Smrg# are only a few common choices. Note that they may not necessarily appear 860bd37d32Smrg# in the same directories. Prefer utmpx/wtmpx to utmp/wtmp, since that's 870bd37d32Smrg# the way the configure script is designed. 880bd37d32SmrgUTMP_NAME=utmp 890bd37d32SmrgUTMP_PATH=/etc 900bd37d32Smrgfor name in /etc /var/adm /var/run /var/log 910bd37d32Smrgdo 920bd37d32Smrg if test -f $name/utmpx ; then 930bd37d32Smrg UTMP_NAME=utmpx 940bd37d32Smrg UTMP_PATH=$name 950bd37d32Smrg break 960bd37d32Smrg elif test -f $name/utmp ; then 970bd37d32Smrg UTMP_PATH=$name 980bd37d32Smrg break 990bd37d32Smrg fi 1000bd37d32Smrgdone 1010bd37d32SmrgUTMP_PATH=$UTMP_PATH/$UTMP_NAME 1020bd37d32Smrg 1030bd37d32SmrgWTMP_NAME=wtmp 1040bd37d32SmrgWTMP_PATH=/etc 1050bd37d32Smrgfor name in /etc /var/adm /var/run /var/log 1060bd37d32Smrgdo 1070bd37d32Smrg if test -f $name/wtmpx ; then 1080bd37d32Smrg WTMP_NAME=wtmpx 1090bd37d32Smrg WTMP_PATH=$name 1100bd37d32Smrg break 1110bd37d32Smrg elif test -f $name/wtmp ; then 1120bd37d32Smrg WTMP_PATH=$name 1130bd37d32Smrg break 1140bd37d32Smrg fi 1150bd37d32Smrgdone 1160bd37d32SmrgWTMP_PATH=$WTMP_PATH/$WTMP_NAME 1170bd37d32Smrg 1180bd37d32Smrg# "X" is usually in the miscellaneous section, along with "undocumented". 1190bd37d32Smrg# Use that to guess an appropriate section. 1200bd37d32SmrgX_MANSECT=`man X 2>&1 | tr '\012' '\020' | sed -e 's/^[^0123456789]*\([^) ][^) ]*\).*/\1/'` 1210bd37d32Smrgtest -z "$X_MANSECT" && X_MANSECT=$suffix 1220bd37d32Smrg 1230bd37d32SmrgVERSION_H=`echo "$OLD_FILE" | sed -e 's,/[^/]*$,/version.h,' -e s',^[^/]*$,version.h,'` 1240bd37d32SmrgPATCH_NUM=`fgrep XTERM_PATCH $VERSION_H|sed -e 's/[^0-9]*//g'` 1250bd37d32SmrgPATCH_YMD=`fgrep XTERM_DATE $VERSION_H|sed -e 's,[^0-9/.-]*,,g'` 1260bd37d32Smrg 1270bd37d32Smrg# Make capitalization variants 1280bd37d32SmrgAPP_chr0=`echo "$APP_name" | sed -e 's/^\(.\).*/\1/' | tr '[a-z]' '[A-Z]'` 1290bd37d32SmrgAPP_chr1=`echo "$APP_name" | sed -e 's/^.//'` 1300bd37d32SmrgAPP_Name=${APP_chr0}${APP_chr1} 1310bd37d32SmrgAPP_NAME=`echo "$APP_name" | tr '[a-z]' '[A-Z]'` 1320bd37d32Smrg 1330bd37d32Smrg# Provide for renaming in test-builds: 1340bd37d32SmrgUSE_chr0=`echo "$USE_name" | sed -e 's/^\(.\).*/\1/' | tr '[a-z]' '[A-Z]'` 1350bd37d32SmrgUSE_chr1=`echo "$USE_name" | sed -e 's/^.//'` 1360bd37d32SmrgUSE_Name=${USE_chr0}${USE_chr1} 1370bd37d32SmrgUSE_NAME=`echo "$USE_name" | tr '[a-z]' '[A-Z]'` 1380bd37d32Smrg 1390bd37d32Smrgsed -e 's%__vendorversion__%"X Window System"%' \ 1400bd37d32Smrg -e 's%__app_version__%Patch\ \#'$PATCH_NUM% \ 1410bd37d32Smrg -e 's%__app_date__%'$PATCH_YMD% \ 1420bd37d32Smrg -e "s%^\.TH [^ ][^ ]*%.TH $USE_NAME%" \ 1430bd37d32Smrg -e "s%^\.ds N $APP_Name%.ds N $USE_Name%" \ 1440bd37d32Smrg -e "s%^\.ds n $APP_name%.ds n $USE_name%" \ 1450bd37d32Smrg -e 's%^'"$APP_name"' \\- %'"$USE_name"' \- %' \ 1460bd37d32Smrg -e s%__default_termname__%@default_TERM@% \ 1470bd37d32Smrg -e s%__default_termid__%@default_termid@% \ 1480bd37d32Smrg -e s%__alt_sends_esc__%@alt_sends_esc@% \ 1490bd37d32Smrg -e s%__meta_sends_esc__%@meta_sends_esc@% \ 1500bd37d32Smrg -e s%__backarrow_is_bs__%@backarrow_is_bs@% \ 1510bd37d32Smrg -e s%__backarrow_is_erase__%@backarrow_is_erase@% \ 1520bd37d32Smrg -e s%__delete_is_del__%@delete_is_del@% \ 1530bd37d32Smrg -e s%__default_class__%$APP_TYPE% \ 1540bd37d32Smrg -e s%__apploaddir__%$APPS_DIR% \ 1550bd37d32Smrg -e s%__mansuffix__%$MY_MANSECT%g \ 1560bd37d32Smrg -e s%__miscmansuffix__%$X_MANSECT%g \ 1570bd37d32Smrg -e s%__pixmapsdir__%$XPMS_DIR% \ 1580bd37d32Smrg -e s%fIutmp'\\%fI'$UTMP_NAME'\\%g' \ 1590bd37d32Smrg -e s%/etc/utmp%$UTMP_PATH%g \ 1600bd37d32Smrg -e s%fIwtmp'\\%fI'$WTMP_NAME'\\%g' \ 1610bd37d32Smrg -e s%/etc/wtmp%$WTMP_PATH%g \ 1620bd37d32Smrg $OLD_FILE >$NEW_FILE 1630bd37d32Smrg# diff -u $OLD_FILE $NEW_FILE 1640bd37d32Smrg 1650bd37d32Smrgecho "$MINSTALL $OLD_FILE $END_FILE" 1660bd37d32Smrgeval "$MINSTALL $NEW_FILE $END_FILE" 1670bd37d32Smrg 1680bd37d32Smrgrm -f $NEW_FILE 169