"Fossies" - the Fresh Open Source Software Archive

Member "xterm-379/minstall.in" (2 Oct 2022, 5919 Bytes) of package /linux/misc/xterm-379.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "minstall.in": 373_vs_374.

    1 #!/bin/sh
    2 # $XTermId: minstall.in,v 1.27 2022/10/02 20:13:11 tom Exp $
    3 # -----------------------------------------------------------------------------
    4 # this file is part of xterm
    5 #
    6 # Copyright 2001-2021,2022 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...
   53 LANG=C;     export LANG
   54 LANGUAGE=C; export LANGUAGE
   55 LC_ALL=C;   export LC_ALL
   56 LC_CTYPE=C; export LC_CTYPE
   57 XTERM_LOCALE=C  export XTERM_LOCALE
   58 
   59 # avoid interference by the "man" command.
   60 for p in /bin /usr/bin
   61 do
   62 if test -f $p/cat ; then
   63 MANPAGER="cat";   export MANPAGER
   64 PAGER="cat";      export PAGER
   65 break
   66 fi
   67 done
   68 
   69 # get parameters
   70 MINSTALL="$1"
   71 OLD_FILE="$2"
   72 END_FILE="$3"
   73 APPS_DIR="$4"
   74 APP_TYPE="$5"
   75 APP_name="$6"
   76 USE_name="$7"
   77 XPMS_DIR="$8"
   78 
   79 suffix=`echo "$END_FILE" | sed -e 's%^.*\.%%'`
   80 NEW_FILE=temp$$
   81 
   82 MY_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.
   88 UTMP_NAME=utmp
   89 UTMP_PATH=/etc
   90 for name in /etc /var/adm /var/run /var/log
   91 do
   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
  100 done
  101 UTMP_PATH=$UTMP_PATH/$UTMP_NAME
  102 
  103 WTMP_NAME=wtmp
  104 WTMP_PATH=/etc
  105 for name in /etc /var/adm /var/run /var/log
  106 do
  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
  115 done
  116 WTMP_PATH=$WTMP_PATH/$WTMP_NAME
  117 
  118 lower=abcdefghijklmnopqrstuvwxyz
  119 upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
  120 
  121 # "X" is usually in the miscellaneous section, along with "undocumented".
  122 # Use that to guess an appropriate section.  This relies on having the manpage
  123 # installed.
  124 X_MANPAGE=X
  125 X_MANSECT=`man $X_MANPAGE 2>&1 | grep $X_MANPAGE'([^)]*)' | head -n 1 | tr '\012' '\040' | sed -e 's/^[^0123456789]*\([^) ][^) ]*\).*/\1/'`
  126 test -z "$X_MANSECT" && X_MANSECT=$suffix
  127 
  128 VERSION_H=`echo "$OLD_FILE" | sed -e 's,/[^/]*$,/version.h,' -e s',^[^/]*$,version.h,'`
  129 PATCH_NUM=`@FGREP@ XTERM_PATCH "$VERSION_H" | sed -e 's/[^0-9]*//g'`
  130 PATCH_YMD=`@FGREP@ XTERM_DATE  "$VERSION_H" | sed -e 's,[^0-9/.-]*,,g'`
  131 
  132 # Make capitalization variants
  133 APP_chr0=`echo "$APP_name" | sed -e 's/^\(.\).*/\1/' | tr "$lower" "$upper"`
  134 APP_chr1=`echo "$APP_name" | sed -e 's/^.//'`
  135 APP_Name=${APP_chr0}${APP_chr1}
  136 # APP_NAME=`echo "$APP_name" | tr "$lower" "$upper"`
  137 
  138 # Provide for renaming in test-builds:
  139 USE_chr0=`echo "$USE_name" | sed -e 's/^\(.\).*/\1/' | tr "$lower" "$upper"`
  140 USE_chr1=`echo "$USE_name" | sed -e 's/^.//'`
  141 USE_Name=${USE_chr0}${USE_chr1}
  142 USE_NAME=`echo "$USE_name" | tr "$lower" "$upper"`
  143 
  144 sed -e 's%__vendorversion__%"X Window System"%' \
  145     -e 's%__app_version__%Patch\ \#'"$PATCH_NUM"% \
  146     -e 's%__app_date__%'"$PATCH_YMD"% \
  147     -e 's%^\.TH [^ ][^ ]*%.TH '"$USE_NAME"% \
  148     -e 's%^\.ds N '"$APP_Name"'%.ds N '"$USE_Name"% \
  149     -e 's%^\.ds n '"$APP_name"'%.ds n '"$USE_name"% \
  150     -e 's%^'"$APP_name"' \\- %'"$USE_name"' \- %' \
  151     -e "s%__default_termname__%@default_TERM@%" \
  152     -e "s%__default_termid__%@default_termid@%" \
  153     -e "s%__alt_sends_esc__%@alt_sends_esc@%" \
  154     -e "s%__meta_sends_esc__%@meta_sends_esc@%" \
  155     -e "s%__backarrow_is_bs__%@backarrow_is_bs@%" \
  156     -e "s%__backarrow_is_erase__%@backarrow_is_erase@%" \
  157     -e "s%__delete_is_del__%@delete_is_del@%" \
  158     -e "s%__double_buffer__%@double_buffer@%" \
  159     -e "s%__initial_erase__%@initial_erase@%" \
  160     -e "s%__default_class__%$APP_TYPE%" \
  161     -e "s%__apploaddir__%$APPS_DIR%" \
  162     -e "s%__mansuffix__%$MY_MANSECT%g" \
  163     -e "s%__miscmansuffix__%$X_MANSECT%g" \
  164     -e "s%__pixmapsdir__%$XPMS_DIR%" \
  165     -e 's%fIutmp\\%fI'$UTMP_NAME'\\%g' \
  166     -e "s%/etc/utmp%$UTMP_PATH%g" \
  167     -e 's%fIwtmp\\%fI'$WTMP_NAME'\\%g' \
  168     -e "s%/etc/wtmp%$WTMP_PATH%g" \
  169     -e 's%/\\(\*\*%/*%g' \
  170     "$OLD_FILE" >$NEW_FILE
  171 # diff -u $OLD_FILE $NEW_FILE
  172 
  173 echo "$MINSTALL $OLD_FILE $END_FILE"
  174 eval "$MINSTALL $NEW_FILE $END_FILE"
  175 
  176 rm -f $NEW_FILE