minstall.in revision 5307cd1a
10bd37d32Smrg#!/bin/sh 2f2e35a3aSmrg# $XTermId: minstall.in,v 1.26 2021/01/27 01:36:06 tom Exp $ 30bd37d32Smrg# ----------------------------------------------------------------------------- 40bd37d32Smrg# this file is part of xterm 50bd37d32Smrg# 65307cd1aSmrg# Copyright 2001-2021,2022 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 63f2e35a3aSmrgMANPAGER="cat"; export MANPAGER 64f2e35a3aSmrgPAGER="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 118f2e35a3aSmrglower=abcdefghijklmnopqrstuvwxyz 119f2e35a3aSmrgupper=ABCDEFGHIJKLMNOPQRSTUVWXYZ 120f2e35a3aSmrg 1210bd37d32Smrg# "X" is usually in the miscellaneous section, along with "undocumented". 122e0a2b6dfSmrg# Use that to guess an appropriate section. This relies on having the manpage 123e0a2b6dfSmrg# installed. 124e0a2b6dfSmrgX_MANPAGE=X 125e0a2b6dfSmrgX_MANSECT=`man $X_MANPAGE 2>&1 | grep $X_MANPAGE'([^)]*)' | head -n 1 | tr '\012' '\040' | sed -e 's/^[^0123456789]*\([^) ][^) ]*\).*/\1/'` 1260bd37d32Smrgtest -z "$X_MANSECT" && X_MANSECT=$suffix 1270bd37d32Smrg 1280bd37d32SmrgVERSION_H=`echo "$OLD_FILE" | sed -e 's,/[^/]*$,/version.h,' -e s',^[^/]*$,version.h,'` 1295307cd1aSmrgPATCH_NUM=`@FGREP@ XTERM_PATCH "$VERSION_H" | sed -e 's/[^0-9]*//g'` 1305307cd1aSmrgPATCH_YMD=`@FGREP@ XTERM_DATE "$VERSION_H" | sed -e 's,[^0-9/.-]*,,g'` 1310bd37d32Smrg 1320bd37d32Smrg# Make capitalization variants 133f2e35a3aSmrgAPP_chr0=`echo "$APP_name" | sed -e 's/^\(.\).*/\1/' | tr "$lower" "$upper"` 1340bd37d32SmrgAPP_chr1=`echo "$APP_name" | sed -e 's/^.//'` 1350bd37d32SmrgAPP_Name=${APP_chr0}${APP_chr1} 136f2e35a3aSmrg# APP_NAME=`echo "$APP_name" | tr "$lower" "$upper"` 1370bd37d32Smrg 1380bd37d32Smrg# Provide for renaming in test-builds: 139f2e35a3aSmrgUSE_chr0=`echo "$USE_name" | sed -e 's/^\(.\).*/\1/' | tr "$lower" "$upper"` 1400bd37d32SmrgUSE_chr1=`echo "$USE_name" | sed -e 's/^.//'` 1410bd37d32SmrgUSE_Name=${USE_chr0}${USE_chr1} 142f2e35a3aSmrgUSE_NAME=`echo "$USE_name" | tr "$lower" "$upper"` 1430bd37d32Smrg 1440bd37d32Smrgsed -e 's%__vendorversion__%"X Window System"%' \ 145f2e35a3aSmrg -e 's%__app_version__%Patch\ \#'"$PATCH_NUM"% \ 146f2e35a3aSmrg -e 's%__app_date__%'"$PATCH_YMD"% \ 147f2e35a3aSmrg -e 's%^\.TH [^ ][^ ]*%.TH '"$USE_NAME"% \ 148f2e35a3aSmrg -e 's%^\.ds N '"$APP_Name"'%.ds N '"$USE_Name"% \ 149f2e35a3aSmrg -e 's%^\.ds n '"$APP_name"'%.ds n '"$USE_name"% \ 1500bd37d32Smrg -e 's%^'"$APP_name"' \\- %'"$USE_name"' \- %' \ 151f2e35a3aSmrg -e "s%__default_termname__%@default_TERM@%" \ 152f2e35a3aSmrg -e "s%__default_termid__%@default_termid@%" \ 153f2e35a3aSmrg -e "s%__alt_sends_esc__%@alt_sends_esc@%" \ 154f2e35a3aSmrg -e "s%__meta_sends_esc__%@meta_sends_esc@%" \ 155f2e35a3aSmrg -e "s%__backarrow_is_bs__%@backarrow_is_bs@%" \ 156f2e35a3aSmrg -e "s%__backarrow_is_erase__%@backarrow_is_erase@%" \ 157f2e35a3aSmrg -e "s%__delete_is_del__%@delete_is_del@%" \ 158f2e35a3aSmrg -e "s%__double_buffer__%@double_buffer@%" \ 159f2e35a3aSmrg -e "s%__initial_erase__%@initial_erase@%" \ 160f2e35a3aSmrg -e "s%__default_class__%$APP_TYPE%" \ 161f2e35a3aSmrg -e "s%__apploaddir__%$APPS_DIR%" \ 162f2e35a3aSmrg -e "s%__mansuffix__%$MY_MANSECT%g" \ 163f2e35a3aSmrg -e "s%__miscmansuffix__%$X_MANSECT%g" \ 164f2e35a3aSmrg -e "s%__pixmapsdir__%$XPMS_DIR%" \ 165f2e35a3aSmrg -e 's%fIutmp\\%fI'$UTMP_NAME'\\%g' \ 166f2e35a3aSmrg -e "s%/etc/utmp%$UTMP_PATH%g" \ 167f2e35a3aSmrg -e 's%fIwtmp\\%fI'$WTMP_NAME'\\%g' \ 168f2e35a3aSmrg -e "s%/etc/wtmp%$WTMP_PATH%g" \ 169913cc679Smrg -e 's%/\\(\*\*%/*%g' \ 170f2e35a3aSmrg "$OLD_FILE" >$NEW_FILE 1710bd37d32Smrg# diff -u $OLD_FILE $NEW_FILE 1720bd37d32Smrg 1730bd37d32Smrgecho "$MINSTALL $OLD_FILE $END_FILE" 1740bd37d32Smrgeval "$MINSTALL $NEW_FILE $END_FILE" 1750bd37d32Smrg 1760bd37d32Smrgrm -f $NEW_FILE 177