revamp scheme for integrating external plugins (#202545)

This commit is contained in:
Nils Philippsen 2006-08-16 11:11:31 +00:00
parent 98f248e1b0
commit 493446b708
2 changed files with 100 additions and 9 deletions

82
gimp-plugin-mgr.in Normal file
View File

@ -0,0 +1,82 @@
#!/bin/bash
shopt -s nullglob
GIMPTOOL="@GIMPTOOL@"
GIMPPLUGINDIR="`"$GIMPTOOL" --gimpplugindir`"
EXITVAL=0
showhelp () {
cat << EOF
Usage: gimp-plugin-mgr <mode> [<pluginname> [<pluginname> [...]]
Mode can be:
--install|-i: install plugin(s)
--uninstall|-u: uninstall plugin(s)
--help|-h: show this message
EOF
}
install_uninstall () {
local action="$1"
shift
local plugins="$@"
pushd "$GIMPPLUGINDIR/plug-ins" >&/dev/null
if [ "$plugins" == "*" ]; then
pushd "/etc/gimp/plugins.d" >&/dev/null
shopt -u nullglob
plugins=""
for file in *; do
plugins="$plugins ${file%.conf}"
done
shopt -s nullglob
popd >&/dev/null
fi
for plugin in $plugins; do
PLUGINFILE=
if [ ! -r "/etc/gimp/plugins.d/${plugin}.conf" ]; then
echo "gimp-plugin-mgr: can't read /etc/gimp/plugins.d/${plugin}.conf" >&2
EXITVAL=$(( $EXITVAL + 1 ))
continue
fi
. "/etc/gimp/plugins.d/${plugin}.conf"
case "$action" in
install)
if [ ! "$PLUGINFILE" ]; then
echo "gimp-plugin-mgr: PLUGINFILE not defined for $plugin" >&2
EXITVAL=$(( $EXITVAL + 1 ))
continue
fi
ln -snf "$PLUGINFILE" "$GIMPPLUGINDIR/plug-ins/$plugin"
;;
uninstall)
if [ ! -L "$GIMPPLUGINDIR/plug-ins/$plugin" ]; then
echo "gimp-plugin-mgr: $GIMPPLUGINDIR/plug-ins/$plugin not a symbolic link" >&2
EXITVAL=$(( $EXITVAL + 1 ))
continue
fi
rm -f "$plugin"
;;
esac
done
popd >&/dev/null
}
case "$1" in
--install|-i)
shift
install_uninstall install "$@"
;;
--uninstall|-u)
shift
install_uninstall uninstall "$@"
;;
*)
if [ "$1" != "--help" -a "$1" != "-h" ]; then
EXITVAL=1
fi
showhelp
;;
esac
exit $EXITVAL

View File

@ -36,7 +36,7 @@ Version: 2.2.12
%define age 0
%define minorver 200
%define microver %(ver=%{version}; echo ${ver##*.*.})
Release: 3%{?dist}
Release: 4%{?dist}
Epoch: 2
License: GPL, LGPL
Group: Applications/Multimedia
@ -71,7 +71,7 @@ BuildRequires: gimp-print-devel >= 4.2.0
BuildRequires: automake >= 1.7
BuildRequires: autoconf >= 2.54
BuildRequires: libtool >= 1.5
BuildRequires: perl
BuildRequires: sed
BuildRequires: libwmf-devel >= 0.2.8
BuildRequires: intltool
BuildRequires: gettext
@ -90,6 +90,7 @@ Requires(post): hicolor-icon-theme
Requires(postun): /usr/bin/update-desktop-database
Requires(postun): hicolor-icon-theme
Source0: ftp://ftp.gimp.org/pub/gimp/v%{binver}/gimp-%{version}.tar.bz2
Source1: gimp-plugin-mgr.in
Patch0: gimp-2.0pre3-buildroot.patch
Patch1: gimp-2.0.1-gimphelpmissing.patch
Patch2: gimp-2.2.3-icontheme.patch
@ -196,6 +197,9 @@ CFLAGS="%optflags -fomit-frame-pointer" \
make %{?_smp_mflags}
# convenience stuff for external plugins (e.g. xsane)
sed -e 's|@GIMPTOOL@|%{_bindir}/gimptool-%{interfacever}|g' < %{SOURCE1} > gimp-plugin-mgr
%install
export PATH="$PATH:$PWD/bin"
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
@ -252,24 +256,24 @@ ln -snf gimptool-%{interfacever} %{buildroot}/%{_bindir}/gimptool
ln -snf gimptool-%{interfacever}.1 %{buildroot}/%{_mandir}/man1/gimptool.1
%endif
# convenience stuff for external plugins (e.g. xsane)
mkdir -p %{buildroot}%{_sysconfdir}/gimp/plugins.d
mkdir -p %{_sbindir}
install -m 0755 gimp-plugin-mgr %{_sbindir}/gimp-plugin-mgr
%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
%post
/usr/bin/update-desktop-database %{_datadir}/applications
if [ -x %{_sbindir}/xsane-install-gimp-plugin ]; then
%{_sbindir}/xsane-install-gimp-plugin --install %{interfacever}
fi
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi
%{_sbindir}/gimp-plugin-mgr --install '*'
%preun
# Do this always, because interfacever could be different
if [ -x %{_sbindir}/xsane-install-gimp-plugin ]; then
%{_sbindir}/xsane-install-gimp-plugin --uninstall %{interfacever}
fi
%{_sbindir}/gimp-plugin-mgr --uninstall '*'
%postun
if [ "$1" = "0" ]; then
@ -321,6 +325,7 @@ fi
%{_datadir}/gimp/%{interfacever}/themes/
%dir %{_sysconfdir}/gimp
%dir %{_sysconfdir}/gimp/plugins.d
%dir %{_sysconfdir}/gimp/%{interfacever}
%config(noreplace) %{_sysconfdir}/gimp/%{interfacever}/controllerrc
%config(noreplace) %{_sysconfdir}/gimp/%{interfacever}/gimprc
@ -337,6 +342,7 @@ fi
%{_bindir}/gimp-%{binver}
%{_bindir}/gimp-remote-%{binver}
%{_bindir}/gimptool-%{interfacever}
%{_sbindir}/gimp-plugin-mgr
#%{_bindir}/embedxpm
#%{_bindir}/escputil-%{interfacever}
@ -396,6 +402,9 @@ fi
%{_libdir}/pkgconfig/*
%changelog
* Wed Aug 16 2006 Nils Philippsen <nphilipp@redhat.com> - 2:2.2.12-4
- revamp scheme for integrating external plugins (#202545)
* Wed Aug 02 2006 Nils Philippsen <nphilipp@redhat.com> - 2:2.2.12-3
- allow spaces in filenames when saving (#200888, patch by Michael Natterer)