138 lines
3.9 KiB
Plaintext
138 lines
3.9 KiB
Plaintext
|
#!/bin/bash
|
||
|
# $0 -- translate the list of files generated by rpm in a list suitable for
|
||
|
# inclusion into a specfile (kde4 only)
|
||
|
# Copyright (C) 2008-2010 Davide Madrisan <davide.madrisan@gmail.com>
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or modify it under
|
||
|
# the terms of the GNU General Public License version 2 as published by the
|
||
|
# Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY
|
||
|
# or FITNESS FOR A PARTICULAR PURPOSE.
|
||
|
#
|
||
|
# Report bugs to <davide.madrisan@gmail.com>
|
||
|
|
||
|
[ -z "$BASH" ] || [ ${BASH_VERSION:0:1} -lt 2 ] &&
|
||
|
echo $"this script requires bash version 2 or better" >&2 && exit 1
|
||
|
|
||
|
me=(${0##*/} "0.3.1")
|
||
|
|
||
|
[ -r @libdir@/libmsgmng.lib ] ||
|
||
|
{ echo "$me: "$"library not found"": @libdir@/libmsgmng.lib" 1>&2
|
||
|
exit 1; }
|
||
|
|
||
|
. @libdir@/libmsgmng.lib
|
||
|
|
||
|
# FIXME: add a po file for this script
|
||
|
#if [[ -z "$LANG" && -r /etc/sysconfig/i18n ]]; then
|
||
|
# . /etc/sysconfig/i18n
|
||
|
# export LANG
|
||
|
#fi
|
||
|
#TEXTDOMAIN="@package@"; export TEXTDOMAIN
|
||
|
|
||
|
# default values
|
||
|
let "nospaces = 1"
|
||
|
sed_extra_mask="s,^[ \t]*,,"
|
||
|
|
||
|
function version() {
|
||
|
echo "\
|
||
|
$me, "$"version"" ${me[1]}""
|
||
|
"$"Get the specfiles from a local repository.""
|
||
|
Copyright (C) 2008 Davide Madrisan <davide.madrisan@gmail.com>"
|
||
|
}
|
||
|
|
||
|
function copying() {
|
||
|
echo "\
|
||
|
"$"This program is free software; you can redistribute it and/or modify it under
|
||
|
the terms of the GNU General Public License version 2 as published by the
|
||
|
Free Software Foundation. There is NO warranty; not even for MERCHANTABILITY
|
||
|
or FITNESS FOR A PARTICULAR PURPOSE."
|
||
|
}
|
||
|
|
||
|
function usage() {
|
||
|
# $1: optional exit code (default is '1')
|
||
|
version
|
||
|
echo "
|
||
|
"$"Usage":"
|
||
|
$me <file_with_filelist> [-s]
|
||
|
|
||
|
"$"where the above options mean":"
|
||
|
-s, --spaces "$"Do not remove extra-spaces""
|
||
|
|
||
|
"$"Operation modes":"
|
||
|
-h, --help "$"Print this help, then exit""
|
||
|
-v, --version "$"Print version number, then exit""
|
||
|
|
||
|
"$"Some examples":"
|
||
|
$me /tmp/kompare4_filelist
|
||
|
|
||
|
"$"Report bugs to <davide.madrisan@gmail.com>."""
|
||
|
|
||
|
exit ${1:-1}
|
||
|
}
|
||
|
|
||
|
[ $# -eq 0 ] && usage
|
||
|
|
||
|
TEMP=`LANG=C getopt \
|
||
|
-o shv \
|
||
|
--long nospaces,help,version \
|
||
|
-n "$me" -- "$@"`
|
||
|
[[ $? = 0 ]] || exit 1
|
||
|
|
||
|
eval set -- "$TEMP"
|
||
|
|
||
|
while :; do
|
||
|
case $1 in
|
||
|
-s|--nospaces)
|
||
|
let "nospaces = 0"
|
||
|
sed_extra_mask="";;
|
||
|
-h|--help)
|
||
|
usage 0 ;;
|
||
|
-v|--version)
|
||
|
version; echo; copying; exit 0;;
|
||
|
--) shift; break ;;
|
||
|
*) notify.error $"(bug)"" -- "$"\`getopt' error"
|
||
|
esac
|
||
|
shift
|
||
|
done
|
||
|
|
||
|
flist="$1"
|
||
|
[[ -r "$flist" ]] || notify.error $"file not found"": \`$flist'"
|
||
|
|
||
|
# see: /etc/rpm/macros.kde4
|
||
|
cat $flist | \
|
||
|
while read line; do
|
||
|
echo $line | sed "\
|
||
|
$sed_extra_mask
|
||
|
s,/etc/opt/kde,%{_kde4_sysconfdir},
|
||
|
s,/opt/kde/bin,%{_kde4_bindir},
|
||
|
s,/opt/kde/sbin,%{_kde4_sbindir},
|
||
|
\
|
||
|
s,/opt/kde/include,%{_kde4_includedir},
|
||
|
\
|
||
|
s,/opt/kde/lib/kde4/libexec,%{_kde4_libexecdir},
|
||
|
s,/opt/kde/lib/kde4/plugins,%{_kde4_pluginsdir},
|
||
|
s,/opt/kde/lib,%{_kde4_libdir},
|
||
|
\
|
||
|
s,/opt/kde/share/applications,%{_kde4_xdgappsdir},
|
||
|
s,/opt/kde/share/apps/kconf_update,%{_kde4_kconfupdatedir},
|
||
|
s,/opt/kde/share/apps,%{_kde4_datadir},
|
||
|
s,/opt/kde/share/autostart,%{_kde4_autostartdir},
|
||
|
s,/opt/kde/share/config.kcfg,%{_kde4_kcfgdir},
|
||
|
s,/opt/kde/share/config,%{_kde4_configdir},
|
||
|
s,/opt/kde/share/dbus-1/interfaces,%{_kde4_dbusinterfacesdir},
|
||
|
s,/opt/kde/share/dbus-1/services,%{_kde4_dbusservicesdir},
|
||
|
s,/opt/kde/share/desktop-directories,%{_kde4_xdgdirectorydir},
|
||
|
s,/opt/kde/share/doc/HTML,%{_kde4_htmldir},
|
||
|
s,/opt/kde/share/icons,%{_kde4_icondir},
|
||
|
s,/opt/kde/share/kde4/services,%{_kde4_servicesdir},
|
||
|
s,/opt/kde/share/kde4/servicetypes,%{_kde4_servicetypesdir},
|
||
|
s,/opt/kde/share/locale,%{_kde4_localedir},
|
||
|
s,/opt/kde/share/mime/packages,%{_kde4_xdgmimedir},
|
||
|
s,/opt/kde/share/mimelnk,%{_kde4_mimedir},
|
||
|
s,/opt/kde/share/sounds,%{_kde4_soundsdir},
|
||
|
s,/opt/kde/share/templates,%{_kde4_templatesdir},
|
||
|
s,/opt/kde/share/wallpapers,%{_kde4_wallpaperdir},
|
||
|
s,/opt/kde/share,%{_kde4_sharedir},
|
||
|
#s,/opt/kde,%{_kde4_prefix},
|
||
|
"
|
||
|
done | sort
|