2006-11-26 04:11:12 -07:00
|
|
|
#!/bin/sh
|
2019-12-29 01:54:02 -07:00
|
|
|
# $XTermId: minstall.in,v 1.25 2019/07/19 00:53:57 tom Exp $
|
2010-03-25 16:03:51 -06:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# this file is part of xterm
|
|
|
|
#
|
2019-12-29 01:54:02 -07:00
|
|
|
# Copyright 2001-2016,2019 by Thomas E. Dickey
|
2010-05-08 06:20:46 -06:00
|
|
|
#
|
2010-03-25 16:03:51 -06:00
|
|
|
# All Rights Reserved
|
2010-05-08 06:20:46 -06:00
|
|
|
#
|
2010-03-25 16:03:51 -06:00
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
# copy of this software and associated documentation files (the
|
|
|
|
# "Software"), to deal in the Software without restriction, including
|
|
|
|
# without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
# permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
# the following conditions:
|
2010-05-08 06:20:46 -06:00
|
|
|
#
|
2010-03-25 16:03:51 -06:00
|
|
|
# The above copyright notice and this permission notice shall be included
|
|
|
|
# in all copies or substantial portions of the Software.
|
2010-05-08 06:20:46 -06:00
|
|
|
#
|
2010-03-25 16:03:51 -06:00
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
|
|
|
|
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2010-05-08 06:20:46 -06:00
|
|
|
#
|
2010-03-25 16:03:51 -06:00
|
|
|
# Except as contained in this notice, the name(s) of the above copyright
|
|
|
|
# holders shall not be used in advertising or otherwise to promote the
|
|
|
|
# sale, use or other dealings in this Software without prior written
|
|
|
|
# authorization.
|
|
|
|
# -----------------------------------------------------------------------------
|
2006-11-26 04:11:12 -07:00
|
|
|
#
|
|
|
|
# Install manpages, substituting a reasonable section value since XFree86 4.x
|
2007-08-25 12:53:27 -06:00
|
|
|
# and derived imakes do not use constants...
|
2006-11-26 04:11:12 -07:00
|
|
|
#
|
|
|
|
# Parameters:
|
|
|
|
# $1 = program to invoke as "install"
|
|
|
|
# $2 = manpage to install
|
|
|
|
# $3 = final installed-path
|
|
|
|
# $4 = app-defaults directory
|
2011-08-28 11:40:55 -06:00
|
|
|
# $5 = app-defaults class
|
2013-01-04 09:40:18 -07:00
|
|
|
# $6 = application name, normally "xterm"
|
2013-03-09 07:45:38 -07:00
|
|
|
# $7 = application name transformed
|
|
|
|
# $8 = pixmap directory
|
2011-08-28 11:40:55 -06:00
|
|
|
#
|
|
|
|
# Other values correspond to definitions in xtermcfg.h, and cannot be directly
|
|
|
|
# modified using "make". They are substituted directly into this script.
|
2006-11-26 04:11:12 -07:00
|
|
|
#
|
|
|
|
|
2007-08-25 12:53:27 -06:00
|
|
|
# override locale...
|
|
|
|
LANG=C; export LANG
|
|
|
|
LANGUAGE=C; export LANGUAGE
|
|
|
|
LC_ALL=C; export LC_ALL
|
|
|
|
LC_CTYPE=C; export LC_CTYPE
|
2008-02-16 02:34:45 -07:00
|
|
|
XTERM_LOCALE=C export XTERM_LOCALE
|
|
|
|
|
2009-04-04 09:10:44 -06:00
|
|
|
# avoid interference by the "man" command.
|
|
|
|
for p in /bin /usr/bin
|
|
|
|
do
|
|
|
|
if test -f $p/cat ; then
|
|
|
|
MANPAGER=cat; export MANPAGER
|
|
|
|
PAGER=cat; export PAGER
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2007-08-25 12:53:27 -06:00
|
|
|
|
|
|
|
# get parameters
|
2006-11-26 04:11:12 -07:00
|
|
|
MINSTALL="$1"
|
|
|
|
OLD_FILE="$2"
|
|
|
|
END_FILE="$3"
|
|
|
|
APPS_DIR="$4"
|
2011-08-28 11:40:55 -06:00
|
|
|
APP_TYPE="$5"
|
2013-01-04 09:40:18 -07:00
|
|
|
APP_name="$6"
|
2013-03-09 07:45:38 -07:00
|
|
|
USE_name="$7"
|
|
|
|
XPMS_DIR="$8"
|
2006-11-26 04:11:12 -07:00
|
|
|
|
2007-08-25 12:53:27 -06:00
|
|
|
suffix=`echo "$END_FILE" | sed -e 's%^.*\.%%'`
|
2006-11-26 04:11:12 -07:00
|
|
|
NEW_FILE=temp$$
|
|
|
|
|
2007-08-25 12:53:27 -06:00
|
|
|
MY_MANSECT=$suffix
|
|
|
|
|
2010-03-25 16:03:51 -06:00
|
|
|
# utmp and wtmp have different pathnames on different systems, but there
|
|
|
|
# are only a few common choices. Note that they may not necessarily appear
|
|
|
|
# in the same directories. Prefer utmpx/wtmpx to utmp/wtmp, since that's
|
|
|
|
# the way the configure script is designed.
|
2010-05-08 06:20:46 -06:00
|
|
|
UTMP_NAME=utmp
|
2010-03-25 16:03:51 -06:00
|
|
|
UTMP_PATH=/etc
|
2010-05-08 06:20:46 -06:00
|
|
|
for name in /etc /var/adm /var/run /var/log
|
2010-03-25 16:03:51 -06:00
|
|
|
do
|
|
|
|
if test -f $name/utmpx ; then
|
|
|
|
UTMP_NAME=utmpx
|
|
|
|
UTMP_PATH=$name
|
|
|
|
break
|
|
|
|
elif test -f $name/utmp ; then
|
|
|
|
UTMP_PATH=$name
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
UTMP_PATH=$UTMP_PATH/$UTMP_NAME
|
|
|
|
|
|
|
|
WTMP_NAME=wtmp
|
|
|
|
WTMP_PATH=/etc
|
2010-05-08 06:20:46 -06:00
|
|
|
for name in /etc /var/adm /var/run /var/log
|
2010-03-25 16:03:51 -06:00
|
|
|
do
|
|
|
|
if test -f $name/wtmpx ; then
|
|
|
|
WTMP_NAME=wtmpx
|
|
|
|
WTMP_PATH=$name
|
|
|
|
break
|
|
|
|
elif test -f $name/wtmp ; then
|
|
|
|
WTMP_PATH=$name
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
WTMP_PATH=$WTMP_PATH/$WTMP_NAME
|
|
|
|
|
2007-08-25 12:53:27 -06:00
|
|
|
# "X" is usually in the miscellaneous section, along with "undocumented".
|
2014-05-09 13:56:40 -06:00
|
|
|
# Use that to guess an appropriate section. This relies on having the manpage
|
|
|
|
# installed.
|
|
|
|
X_MANPAGE=X
|
|
|
|
X_MANSECT=`man $X_MANPAGE 2>&1 | grep $X_MANPAGE'([^)]*)' | head -n 1 | tr '\012' '\040' | sed -e 's/^[^0123456789]*\([^) ][^) ]*\).*/\1/'`
|
2007-08-25 12:53:27 -06:00
|
|
|
test -z "$X_MANSECT" && X_MANSECT=$suffix
|
|
|
|
|
2013-01-04 09:40:18 -07:00
|
|
|
VERSION_H=`echo "$OLD_FILE" | sed -e 's,/[^/]*$,/version.h,' -e s',^[^/]*$,version.h,'`
|
|
|
|
PATCH_NUM=`fgrep XTERM_PATCH $VERSION_H|sed -e 's/[^0-9]*//g'`
|
|
|
|
PATCH_YMD=`fgrep XTERM_DATE $VERSION_H|sed -e 's,[^0-9/.-]*,,g'`
|
|
|
|
|
2013-03-09 07:45:38 -07:00
|
|
|
# Make capitalization variants
|
|
|
|
APP_chr0=`echo "$APP_name" | sed -e 's/^\(.\).*/\1/' | tr '[a-z]' '[A-Z]'`
|
|
|
|
APP_chr1=`echo "$APP_name" | sed -e 's/^.//'`
|
|
|
|
APP_Name=${APP_chr0}${APP_chr1}
|
2013-01-04 09:40:18 -07:00
|
|
|
APP_NAME=`echo "$APP_name" | tr '[a-z]' '[A-Z]'`
|
|
|
|
|
2013-03-09 07:45:38 -07:00
|
|
|
# Provide for renaming in test-builds:
|
|
|
|
USE_chr0=`echo "$USE_name" | sed -e 's/^\(.\).*/\1/' | tr '[a-z]' '[A-Z]'`
|
|
|
|
USE_chr1=`echo "$USE_name" | sed -e 's/^.//'`
|
|
|
|
USE_Name=${USE_chr0}${USE_chr1}
|
|
|
|
USE_NAME=`echo "$USE_name" | tr '[a-z]' '[A-Z]'`
|
|
|
|
|
2006-11-26 04:11:12 -07:00
|
|
|
sed -e 's%__vendorversion__%"X Window System"%' \
|
2013-01-04 09:40:18 -07:00
|
|
|
-e 's%__app_version__%Patch\ \#'$PATCH_NUM% \
|
|
|
|
-e 's%__app_date__%'$PATCH_YMD% \
|
2013-03-09 07:45:38 -07:00
|
|
|
-e "s%^\.TH [^ ][^ ]*%.TH $USE_NAME%" \
|
|
|
|
-e "s%^\.ds N $APP_Name%.ds N $USE_Name%" \
|
|
|
|
-e "s%^\.ds n $APP_name%.ds n $USE_name%" \
|
|
|
|
-e 's%^'"$APP_name"' \\- %'"$USE_name"' \- %' \
|
2011-08-28 11:40:55 -06:00
|
|
|
-e s%__default_termname__%@default_TERM@% \
|
|
|
|
-e s%__default_termid__%@default_termid@% \
|
2013-01-04 09:40:18 -07:00
|
|
|
-e s%__alt_sends_esc__%@alt_sends_esc@% \
|
|
|
|
-e s%__meta_sends_esc__%@meta_sends_esc@% \
|
2013-06-02 13:55:50 -06:00
|
|
|
-e s%__backarrow_is_bs__%@backarrow_is_bs@% \
|
|
|
|
-e s%__backarrow_is_erase__%@backarrow_is_erase@% \
|
2013-01-04 09:40:18 -07:00
|
|
|
-e s%__delete_is_del__%@delete_is_del@% \
|
2019-12-29 01:54:02 -07:00
|
|
|
-e s%__double_buffer__%@double_buffer@% \
|
2015-09-05 08:11:45 -06:00
|
|
|
-e s%__initial_erase__%@initial_erase@% \
|
2011-08-28 11:40:55 -06:00
|
|
|
-e s%__default_class__%$APP_TYPE% \
|
2006-11-26 04:11:12 -07:00
|
|
|
-e s%__apploaddir__%$APPS_DIR% \
|
2007-08-25 12:53:27 -06:00
|
|
|
-e s%__mansuffix__%$MY_MANSECT%g \
|
|
|
|
-e s%__miscmansuffix__%$X_MANSECT%g \
|
2013-01-04 09:40:18 -07:00
|
|
|
-e s%__pixmapsdir__%$XPMS_DIR% \
|
2010-03-25 16:03:51 -06:00
|
|
|
-e s%fIutmp'\\%fI'$UTMP_NAME'\\%g' \
|
|
|
|
-e s%/etc/utmp%$UTMP_PATH%g \
|
|
|
|
-e s%fIwtmp'\\%fI'$WTMP_NAME'\\%g' \
|
|
|
|
-e s%/etc/wtmp%$WTMP_PATH%g \
|
2017-07-15 13:20:51 -06:00
|
|
|
-e 's%/\\(\*\*%/*%g' \
|
2006-11-26 04:11:12 -07:00
|
|
|
$OLD_FILE >$NEW_FILE
|
2013-03-09 07:45:38 -07:00
|
|
|
# diff -u $OLD_FILE $NEW_FILE
|
2006-11-26 04:11:12 -07:00
|
|
|
|
|
|
|
echo "$MINSTALL $OLD_FILE $END_FILE"
|
|
|
|
eval "$MINSTALL $NEW_FILE $END_FILE"
|
|
|
|
|
|
|
|
rm -f $NEW_FILE
|