Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=mate14.git;a=commitdiff;h=0777f07e29fd0135ba30fe66f1aa01afb571801e

commit 0777f07e29fd0135ba30fe66f1aa01afb571801e
Author: Pingax <[email protected]>
Date:   Wed Jan 30 21:33:12 2013 +0100

* Add mate-scriptlet.sh & mate-scriptlet.install
( First draft)

diff --git a/source/include/mate-scriptlet.install 
b/source/include/mate-scriptlet.install
new file mode 100644
index 0000000..34b1e76
--- /dev/null
+++ b/source/include/mate-scriptlet.install
@@ -0,0 +1,200 @@
+schemas=($_F_mate_schemas)
+entries=($_F_mate_entries)
+
+UpdateDesktopDatabase()
+{
+       if [ -f /usr/bin/update-desktop-database ]
+       then
+               echo -n "updating desktop database..."
+               if update-desktop-database > /dev/null 2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+       if [ -f /usr/bin/update-desktop-database-3.0 ]
+       then
+               echo -n "updating desktop database gtk+3..."
+               if update-desktop-database > /dev/null 2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+}
+UpdateIconCache()
+{
+       if [ -f /usr/bin/gtk-update-icon-cache ]
+       then
+               echo -n "updating hicolor icon cache..."
+               if gtk-update-icon-cache -f -t /usr/share/icons/hicolor > 
/dev/null 2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+       if [ -f /usr/bin/gtk-update-icon-cache-3.0 ]
+       then
+               echo -n "updating hicolor icon cache gtk+3..."
+               if gtk-update-icon-cache-3.0 -f -t /usr/share/icons/hicolor > 
/dev/null 2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+}
+
+UpdateGtkImmodules()
+{
+       if [ -f /usr/bin/gtk-query-immodules-2.0 ]
+       then
+               echo -n "updating gtk+2 immodules .."
+                       if /usr/bin/gtk-query-immodules-2.0 > 
/etc/gtk-2.0/gtk.immodules 2>&1 ; then
+                               echo " done."
+                       else
+                               echo " failed."
+                       fi
+       fi
+       if [ -f /usr/bin/gtk-query-immodules-3.0 ]
+       then
+               echo -n "updating gtk+3 immodules .."
+               if /usr/bin/gtk-query-immodules-3.0 --update-cache > /dev/null 
2>&1 ; then
+                       echo " done."
+                else
+                        echo " failed."
+                fi
+        fi
+}
+
+post_install()
+{
+       if [ ${#schemas[*]} -gt 0 ]; then
+               echo -n "installing gconf schemas... "
+               for schema in "${schemas[@]}" ; do
+                       MATECONF_CONFIG_SOURCE=`/usr/bin/mateconftool-2 
--get-default-source` \
+                               /usr/bin/mateconftool-2 --makefile-install-rule 
"$schema" > /dev/null 2>&1
+               done
+               if [ -e /bin/pidof ]; then
+                       kill -HUP `pidof /usr/libexec/gconfd-2` > /dev/null 2>&1
+               fi
+               echo "done."
+       fi
+       if [ ${#entries[*]} -gt 0 ]; then
+               echo -n "loading gconf entries... "
+               for entry in "${entries[@]}" ; do
+                       mateconftool-2 --direct 
--config-source=`/usr/bin/mateconftool-2 --get-default-source` --load $entry > 
/dev/null 2>&1
+               done
+               if [ -e /bin/pidof ]; then
+                       kill -HUP `pidof /usr/libexec/gconfd-2` > /dev/null 2>&1
+               fi
+               echo "done."
+       fi
+       if [ -n "$_F_mate_glib" ]; then
+               echo -n "loading schema glib entries... "
+               glib-compile-schemas /usr/share/glib-2.0/schemas &>/dev/null
+               echo "done."
+       fi
+       if [ -n "$_F_mate_desktop" ]; then
+               UpdateDesktopDatabase
+       fi
+       if [ -n "$_F_mate_scrollkeeper" ]; then
+               echo -n "updating rarian database..."
+               if rarian-sk-update -q > /dev/null 2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+       if [ -n "$_F_mate_mime" ]; then
+               echo -n "updating mime database..."
+               if update-mime-database /usr/share/mime > /dev/null 2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+       if [ -n "$_F_mate_iconcache" ]; then
+               UpdateIconCache
+       fi
+       if [ -n "$_F_mate_gio" ]; then
+               echo -n "updating gio modules database..."
+               if /usr/bin/gio-querymodules /usr/lib/gio/modules > /dev/null 
2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+       if [ -n "$_F_mate_immodules" ]; then
+               UpdateGtkImmodules
+       fi
+}
+
+post_upgrade()
+{
+       post_install $1
+}
+
+pre_remove() {
+       if [ -n "$_F_mate_glib" ]; then
+               echo -n "loading schema glib entries... "
+               glib-compile-schemas /usr/share/glib-2.0/schemas &>/dev/null
+               echo "done."
+       fi
+       if [ ${#schemas[*]} -gt 0 ]; then
+               echo -n "updating gconf schemas... "
+               for schema in "${schemas[@]}" ; do
+                       MATECONF_CONFIG_SOURCE=`/usr/bin/mateconftool-2 
--get-default-source` \
+                               /usr/bin/mateconftool-2 --makefile-install-rule 
"$schema" > /dev/null 2>&1
+               done
+               if [ -e /bin/pidof ]; then
+                       kill -HUP `pidof /usr/libexec/gconfd-2` > /dev/null 2>&1
+               fi
+               echo "done."
+       fi
+       if [ ${#entries[*]} -gt 0 ]; then
+               echo -n "unloading gconf entries... "
+               for entry in "${entries[@]}" ; do
+                       mateconftool-2 --direct 
--config-source=`/usr/bin/mateconftool-2 --get-default-source` --unload $entry 
> /dev/null 2>&1
+               done
+               if [ -e /bin/pidof ]; then
+                       kill -HUP `pidof /usr/libexec/gconfd-2` > /dev/null 2>&1
+               fi
+               echo "done."
+       fi
+}
+
+post_remove()
+{
+       if [ -n "$_F_mate_desktop" ]; then
+               UpdateDesktopDatabase
+       fi
+       if [ -n "$_F_mate_scrollkeeper" ]; then
+               echo -n "updating rarian database..."
+               if rarian-sk-update -q > /dev/null 2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+       if [ -n "$_F_mate_mime" ]; then
+               echo -n "updating mime database..."
+               if update-mime-database /usr/share/mime > /dev/null 2>&1 ; then
+                       echo " done."
+               else
+                       echo " failed."
+               fi
+       fi
+       if [ -n "$_F_mate_iconcache" ]; then
+               UpdateIconCache
+       fi
+
+       if [ -n "$_F_mate_immodules" ]; then
+               UpdateGtkImmodules
+       fi
+}
+
+
+op=$1
+shift
+
+$op $*
diff --git a/source/include/mate-scriptlet.sh b/source/include/mate-scriptlet.sh
new file mode 100644
index 0000000..2ab1a73
--- /dev/null
+++ b/source/include/mate-scriptlet.sh
@@ -0,0 +1,181 @@
+#!/bin/sh
+
+###
+# = mate-scriptlet.sh(3)
+# Anthony Jorion <[email protected]>
+#
+# == NAME
+# mate-scriptlet.sh - for Frugalware
+#
+# == SYNOPSIS
+# Common schema for MATE packages using scriplets.
+#
+# == EXAMPLE
+# --------------------------------------------------
+# pkgname=notification-daemon
+# pkgver=0.3.6
+# pkgrel=1
+# pkgdesc="Galago Desktop Presence Framework - Desktop Notification Daemon"
+# url="http://www.galago-project.org";
+# depends=('libnotify>=0.4.3' 'libwnck' 'libsexy' 'gconf' 'dbus-glib>=0.71')
+# makedepends=('mate-doc-utils' 'intltool')
+# groups=('mate')
+# archs=('i686' 'x86_64')
+# source=($url/files/releases/source/$pkgname/$pkgname-$pkgver.tar.bz2)
+# up2date="lynx -dump 
http://www.galago-project.org/files/releases/source/$pkgname | Flasttar"
+# options=('scriptlet')
+# _F_mate_schemas=('/etc/gconf/schemas/notification-daemon.schemas')
+# _F_mate_desktop="y"
+# _F_mate_scrollkeeper="y"
+# Finclude mate-scriptlet
+# sha1sums=('e43940d202e6af08ac69ec8129fa52be2a99300d')
+# --------------------------------------------------
+# NOTE: Please don't forget to include the necessary packgages (rarian,
+# desktop-file-utils etc.) in the depends(). At the moment mate-scriptlet.sh
+# won't do this for you.
+#
+# == OPTIONS
+# * _F_mate_schemas() - if declared, gconf will be called to register them
+# * _F_mate_glib() - set to "y" for register schemas glib into 
/usr/share/glib-2.0/schemas
+# * _F_mate_entries() - same as above except for gconf .entries files
+# * _F_mate_desktop - set to "y" if your package provides a .desktop file
+# * _F_mate_scrollkeeper - set to "y" if you want to run rarian
+# * _F_mate_mime - set to "y" if your package provides a mime type
+# * _F_mate_iconcache - set to "y" if your package provides an icon in
+# /usr/share/icons/hicolor
+# * _F_mate_gio - set to "y" for update gio modules into /usr/lib/gio/modules
+# * _F_mate_immodules -set to "y" for update gtk.immodules
+# * _F_mate_scriptlet - name of the generated install script (defaults to
+# src/mate-scriptlet.install)
+###
+if [ -z "$_F_mate_scriptlet" ]; then
+       _F_mate_scriptlet="src/mate-scriptlet.install"
+fi
+
+if [ -n "$_F_mate_schemas" ]; then
+       Fconfopts+=" --disable-schemas-install"
+fi
+if [ -n "$_F_mate_scrollkeeper" ]; then
+       Fconfopts+=" --disable-scrollkeeper"
+fi
+if [ -n "$_F_mate_desktop" ]; then
+       Fconfopts+=" --enable-desktop-update=no"
+fi
+if [ -n "$_F_mate_mime" ]; then
+       Fconfopts+=" --disable-update-mimedb --enable-mime-update=no"
+fi
+if [ "$_F_mate_doc" = "y" ]; then
+       makedepends=(${makedepends[@]} 'gtk-doc')
+       subpkgs=("${subpkgs[@]}" "$pkgname-doc")
+       subdescs=("${subdescs[@]}" "$pkgname documention")
+       subrodepends=("${subrodepends[@]}" "$pkgname=$pkgver")
+       subdepends=("${subdepends[@]}" "gtk+3")
+       subgroups=("${subgroups[@]}" 'mate-docs')
+       subarchs=("${subarchs[@]}" 'i686 x86_64')
+       subreplaces=("${subreplaces[@]}" '')
+       subprovides=("${subprovides[@]}" '')
+
+fi
+
+#Split documentation
+_F_mate_split_doc()
+{
+       if [ -d "$Fdestdir/usr/share/mate/help" ]; then
+               Fsplit $pkgname-doc usr/share/mate/help
+       fi
+       if [ -d "$Fdestdir/usr/share/gtk-doc" ]; then
+               Fsplit $pkgname-doc usr/share/gtk-doc
+       fi
+       if [ -d "$Fdestdir/usr/share/doc" ]; then
+               Fsplit $pkgname-doc usr/share/doc
+       fi
+       if [ -d "$Fdestdir/usr/share/man" ]; then
+                Fsplit $pkgname-doc usr/share/man
+        fi
+
+}
+###
+# == OVERWRITTEN VARIABLES
+# * install
+###
+install="$_F_mate_scriptlet"
+
+###
+# == APPENDED VARIABLES
+# * genscriptlet to options()
+###
+options=(${options[@]} 'genscriptlet')
+
+###
+# == PROVIDED FUNCTIONS
+# * Fbuild_slice_scrollkeeper() removes scrollkeeper-update from Makefile.in
+# and omf.make
+###
+Fbuild_slice_scrollkeeper()
+{
+       find . -name Makefile.in -exec sed -i -e 's/-scrollkeeper-update.*//' 
{} \;
+       if [ -f omf.make ]; then
+               sed -i -e 's/-scrollkeeper-update.*//' omf.make
+       fi
+}
+
+###
+# * Fbuild_mate_scriptlet() generates a scriptlet for the given package from
+# the template according to the declared options
+###
+Fbuild_mate_scriptlet()
+{
+       local i str
+
+       cp $Fincdir/mate-scriptlet.install $Fsrcdir
+       if [ -n "$_F_mate_schemas" ]; then
+               for i in "${_F_mate_schemas[@]}"
+               do
+                       if [ -z "$str" ]; then
+                               str="'$i'\n"
+                       else
+                               str="$str\t'$i'\n"
+                       fi
+               done
+       fi
+       Fsed '$_F_mate_schemas' "$str" ${Fsrcdir%/src}/$_F_mate_scriptlet
+       str=''
+       if [ -n "$_F_mate_entries" ]; then
+               for i in "${_F_mate_entries[@]}"
+               do
+                       if [ -z "$str" ]; then
+                               str="'$i'\n"
+                       else
+                               str="$str\t'$i'\n"
+                       fi
+               done
+       fi
+       Fsed '$_F_mate_entries' "$str" ${Fsrcdir%/src}/$_F_mate_scriptlet
+       Fsed '$_F_mate_glib' "$_F_mate_glib" ${Fsrcdir%/src}/$_F_mate_scriptlet
+       Fsed '$_F_mate_desktop' "$_F_mate_desktop" 
${Fsrcdir%/src}/$_F_mate_scriptlet
+       Fsed '$_F_mate_scrollkeeper' "$_F_mate_scrollkeeper" 
${Fsrcdir%/src}/$_F_mate_scriptlet
+       Fsed '$_F_mate_mime' "$_F_mate_mime" ${Fsrcdir%/src}/$_F_mate_scriptlet
+       Fsed '$_F_mate_iconcache' "$_F_mate_iconcache" 
${Fsrcdir%/src}/$_F_mate_scriptlet
+       Fsed '$_F_mate_gio' "$_F_mate_gio" ${Fsrcdir%/src}/$_F_mate_scriptlet
+       Fsed '$_F_mate_immodules' "$_F_mate_immodules" 
${Fsrcdir%/src}/$_F_mate_scriptlet
+}
+
+###
+# * build() just includes Fbuild_slice_scrollkeeper and Fbuild_mate_scriptlet
+# in the default build() (and disables the schema installation on make install)
+###
+build()
+{
+       Fbuild_slice_scrollkeeper
+       Fpatchall
+       Fmake
+       if [ -n "$_F_mate_schemas" ]; then
+               Fmakeinstall GCONF_DISABLE_SCHEMA_INSTALL=1
+       else
+               Fmakeinstall
+       fi
+       if [ "$_F_mate_doc" = "y" ]; then
+               _F_mate_split_doc
+       fi
+       Fbuild_mate_scriptlet
+}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to