2011-06-07 13:21:06 -06:00
|
|
|
#!/bin/sh
|
2011-08-18 13:47:42 -06:00
|
|
|
# $XTermId: df-install.in,v 1.5 2011/07/07 09:41:14 tom Exp $
|
2011-06-07 13:21:06 -06:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# this file is part of xterm
|
|
|
|
#
|
|
|
|
# Copyright 2011 by Thomas E. Dickey
|
|
|
|
#
|
|
|
|
# All Rights Reserved
|
|
|
|
#
|
|
|
|
# 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:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included
|
|
|
|
# in all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Install desktop-files, substituting the category to customize the file
|
|
|
|
# to the current system's conventions.
|
|
|
|
#
|
|
|
|
# Parameters are passed to the desktop-file-install program. The last
|
|
|
|
# parameter is the name of the ".desktop" file to install.
|
|
|
|
OPTS=
|
|
|
|
|
2011-08-18 13:47:42 -06:00
|
|
|
if test $# != 0
|
|
|
|
then
|
|
|
|
APP_NAME=$1
|
|
|
|
shift 1
|
|
|
|
fi
|
|
|
|
|
2011-06-07 13:21:06 -06:00
|
|
|
CDPATH=:
|
|
|
|
export CDPATH
|
|
|
|
|
|
|
|
while test $# != 0
|
|
|
|
do
|
|
|
|
case .$1 in #(vi
|
|
|
|
*.desktop) #(vi
|
|
|
|
if test $# = 1
|
|
|
|
then
|
|
|
|
OLD_FILE=$1
|
|
|
|
else
|
|
|
|
OPTS="$OPTS $1"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
OPTS="$OPTS $1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift 1
|
|
|
|
done
|
|
|
|
|
|
|
|
MY_TEMP=tempdir$$
|
|
|
|
rm -rf $MY_TEMP
|
|
|
|
|
|
|
|
if test -z "$OLD_FILE"
|
|
|
|
then
|
|
|
|
echo "? not found: $OLD_FILE"
|
|
|
|
exit 1
|
|
|
|
elif ! mkdir $MY_TEMP
|
|
|
|
then
|
|
|
|
echo "? cannot mkdir: $MY_TEMP"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
NEW_FILE=`basename $OLD_FILE`
|
2011-08-18 13:47:42 -06:00
|
|
|
sed \
|
|
|
|
-e '/^[^#]/s%xterm%'$APP_NAME'%g' \
|
|
|
|
-e '/^[^#]/s%XTerm%@APP_CLASS@%g' \
|
|
|
|
-e '/^Category=/s%=.*%@DESKTOP_CATEGORY@%' \
|
|
|
|
$OLD_FILE >$MY_TEMP/$NEW_FILE
|
2011-06-07 13:21:06 -06:00
|
|
|
cd $MY_TEMP
|
|
|
|
|
|
|
|
desktop-file-install $OPTS $NEW_FILE
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
rm -rf $MY_TEMP
|
|
|
|
|
|
|
|
# vi:ts=4 sw=4
|