From ac97f36397fbf0ea02f986a21a5b64dad4c44c7d Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Sun, 27 Jun 2004 21:41:07 +0000 Subject: [PATCH] Add the gconf.pl and omf.pl scripts to automatically add GConf and OMF plist instructions respectively. --- en/gnome/Makefile | 4 ++-- en/gnome/gconf.pl | 58 +++++++++++++++++++++++++++++++++++++++++++++++ en/gnome/omf.pl | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 2 deletions(-) create mode 100755 en/gnome/gconf.pl create mode 100755 en/gnome/omf.pl diff --git a/en/gnome/Makefile b/en/gnome/Makefile index 97295eb2ce..3c3c061db2 100644 --- a/en/gnome/Makefile +++ b/en/gnome/Makefile @@ -1,4 +1,4 @@ -# $FreeBSD: www/en/gnome/Makefile,v 1.15 2004/06/06 20:31:29 marcus Exp $ +# $FreeBSD: www/en/gnome/Makefile,v 1.16 2004/06/17 00:28:54 adamw Exp $ .if exists(../Makefile.conf) .include "../Makefile.conf" @@ -13,7 +13,7 @@ SUBDIR+= images DOCS= screenshots.sgml DOCS+= contact.sgml -DATA= index.html newsflash.html news.rdf gnome_upgrade.sh gnomelogalyzer.sh builditinator.sh +DATA= index.html newsflash.html news.rdf gnome_upgrade.sh gnomelogalyzer.sh builditinator.sh omf.pl gconf.pl CLEANFILES= index.html CLEANFILES+= newsflash.html diff --git a/en/gnome/gconf.pl b/en/gnome/gconf.pl new file mode 100755 index 0000000000..08cdb203a8 --- /dev/null +++ b/en/gnome/gconf.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +# +# gconf.pl - a script to add proper gconf schema handling to port PLISTs +# usage: gconf.pl [plist] [plist] [...] +# +# $Id: gconf.pl,v 1.1 2004-06-27 21:41:07 marcus Exp $ +# + +use strict; + +if (scalar(@ARGV) == 0) { + + # If no arguments were given, assume we're using the pkg-plist in the + # current directory. + push @ARGV, "./pkg-plist"; +} + +foreach (@ARGV) { + unless (open(INFILE, $_)) { + warn "Unable to open $_: $!\n"; + next; + } + + my @file = ; + + close(INFILE); + + for (my $i = 0 ; $i < scalar(@file) ; $i++) { + my ($install, $uninstall); + next unless $file[$i] =~ /\.schemas?\n$/; + my $schema = $file[$i]; + chomp $schema; + $uninstall = + "\@unexec env GCONF_CONFIG_SOURCE=xml::\%D/etc/gconf/gconf.xml.defaults gconftool-2 --makefile-uninstall-rule \%D/$schema > /dev/null || /usr/bin/true\n"; + + if ($file[$i - 1] ne $uninstall) { + splice @file, $i, 0, $uninstall; + $i++ + } + + $install = + "\@exec env GCONF_CONFIG_SOURCE=xml::\%D/etc/gconf/gconf.xml.defaults gconftool-2 --makefile-install-rule \%D/$schema > /dev/null || /usr/bin/true\n"; + if ($file[$i + 1] ne $install) { + splice @file, $i + 1, 0, $install; + $i++; + } + } + + unless (open(OUTFILE, ">" . $_)) { + warn "Failed to open $_: $!\n"; + next; + } + + print OUTFILE @file; + + close(OUTFILE); +} diff --git a/en/gnome/omf.pl b/en/gnome/omf.pl new file mode 100755 index 0000000000..cf21b72b48 --- /dev/null +++ b/en/gnome/omf.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +# +# omf.pl - a script to add proper OMF handling to port PLISTs +# usage: omf.pl [plist] [plist] [...] +# +# $Id: omf.pl,v 1.1 2004-06-27 21:41:07 marcus Exp $ +# + +use strict; + +if (scalar(@ARGV) == 0) { + + # If no arguments were given, assume we're using the pkg-plist in the + # current directory. + push @ARGV, "./pkg-plist"; +} + +foreach (@ARGV) { + unless (open(INFILE, $_)) { + warn "Unable to open $_: $!\n"; + next; + } + + my @file = ; + + close(INFILE); + + my @omfs; + for (my $i = 0 ; $i < scalar(@file) ; $i++) { + next unless $file[$i] =~ /\.omf\n$/; + my $omf = $file[$i]; + chomp $omf; + my $install = + "\@exec scrollkeeper-install -q \%D/$omf 2>/dev/null || /usr/bin/true\n"; + if ($file[$i + 1] eq $install) { + next; + } + splice @file, $i + 1, 0, $install; + push (@omfs, $omf); + $i++; + } + + foreach my $omf (@omfs) { + my $uninstall = + "\@unexec scrollkeeper-uninstall -q \%D/$omf 2>/dev/null || /usr/bin/true\n"; + push @file, $uninstall; + } + + unless (open(OUTFILE, ">" . $_)) { + warn "Failed to open $_: $!\n"; + next; + } + + print OUTFILE @file; + + close(OUTFILE); +}