summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog8
-rw-r--r--man/install-xpi.13
-rwxr-xr-xsrc/install-xpi30
-rw-r--r--src/xpi.mk8
4 files changed, 46 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index df2a0b8..5baa4fd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,8 +19,14 @@ mozilla-devscripts (0.21) UNRELEASED; urgency=low
- update src/dh_xul-ext
* Use optparse instead of getopts.
- update src/install-xpi
+ * install-xpi will create a system preference file in /etc; add
+ --disable-system-prefs to disable the new behavior (Closes: #558490,
+ LP: #535544)
+ - update man/install-xpi.1
+ - update src/install-xpi
+ - update src/xpi.mk
- -- Benjamin Drung <bdrung@ubuntu.com> Wed, 24 Mar 2010 20:55:24 +0100
+ -- Benjamin Drung <bdrung@ubuntu.com> Tue, 06 Apr 2010 15:51:58 +0200
mozilla-devscripts (0.20) unstable; urgency=low
diff --git a/man/install-xpi.1 b/man/install-xpi.1
index c6b4109..698a922 100644
--- a/man/install-xpi.1
+++ b/man/install-xpi.1
@@ -34,6 +34,9 @@ will correct the file permissions unless \fR\-\-preserve\-permissions\fP is
specified.
.SH OPTIONS
.TP
+.B \-\-disable\-system\-prefs
+Do not create a system preference file in /etc.
+.TP
\fB\-x\fR \fIfile\fP, \fB\-\-exclude\fR=\fIfile\fP
The specified \fIfile\fP from the xpi file will not be installed. You can use
this parameter several times.
diff --git a/src/install-xpi b/src/install-xpi
index 74aae57..9b22644 100755
--- a/src/install-xpi
+++ b/src/install-xpi
@@ -87,7 +87,7 @@ def incompatible_apps(target_applications):
return incompatible_apps
def install_xpi(script_name, package, xpi_file, exclude, install_dir, links,
- correct_permissions, remove_licenses, verbose=False):
+ correct_permissions, remove_licenses, system_prefs, verbose=False):
# get xpi file content list
if not os.path.isfile(xpi_file):
print >> sys.stderr, "%s: Error: xpi file %s does not exist." % (script_name, xpi_file)
@@ -146,6 +146,29 @@ def install_xpi(script_name, package, xpi_file, exclude, install_dir, links,
print "%s: correct permission from %s to %s of %s" % (script_name, oct(mode), oct(0755), name)
os.chmod(filename, 0755)
+ # create a system preference file in /etc
+ if system_prefs:
+ # search for preference files
+ preferences = filter(lambda f: os.path.dirname(f) == os.path.join("defaults", "preferences") and f.endswith(".js"), xpi_content)
+ if len(preferences) > 0:
+ prefdir = os.path.join("etc", "xul-ext")
+ full_prefdir = os.path.join("debian", package, prefdir)
+ if not os.path.exists(full_prefdir):
+ os.makedirs(full_prefdir)
+ prefname = package.replace("xul-ext-", "") + ".js"
+ # create system preference file
+ f = open(os.path.join(full_prefdir, prefname), "w")
+ f.write("// Place your preferences for " + package + " in this file.\n")
+ f.write("// You can override here the preferences specified in\n")
+ map(lambda x: f.write("// " + os.path.join("/", install_dir, x) + "\n"), preferences)
+ f.close()
+ link_source = os.path.join(prefdir, prefname)
+ link_target = os.path.join(install_dir, "defaults", "preferences", "000system.js")
+ command = ["dh_link", "-p" + package, link_source, link_target]
+ if verbose:
+ print " ".join(command)
+ subprocess.call(command)
+
# get symlinks list
extension_id = get_extension_id(os.path.join(copy_dir, "install.rdf"))
target_applications = get_target_applications(script_name, os.path.join(copy_dir, "install.rdf"))
@@ -176,6 +199,9 @@ if __name__ == "__main__":
epilog = "See %s(1) for more info." % (os.path.basename(sys.argv[0]))
parser = optparse.OptionParser(usage=usage, epilog=epilog)
+ parser.add_option("--disable-system-prefs",
+ help="do not create a system preference file in /etc",
+ dest="system_prefs", action="store_false", default=True)
parser.add_option("-x", "--exclude", metavar="FILE",
help="do not install specified FILE",
dest="exclude", action="append", default=list())
@@ -213,4 +239,4 @@ if __name__ == "__main__":
install_xpi(script_name, options.package, args[0], options.exclude,
options.install_dir, set(options.links), options.correct_permissions,
- options.remove_licenses, options.verbose)
+ options.remove_licenses, options.system_prefs, options.verbose)
diff --git a/src/xpi.mk b/src/xpi.mk
index d7e8467..5ff0977 100644
--- a/src/xpi.mk
+++ b/src/xpi.mk
@@ -70,6 +70,10 @@
# This directory must be an absolute path. Use this parameter
# with care.
#
+# MOZ_XPI_DISABLE_SYSTEM_PREFS (OPTIONAL):
+# if defined (set to 1), no system preference file will be
+# created in /etc.
+#
# Unused variables (can be removed):
#
# MOZ_XPI_EMID (OPTIONAL):
@@ -93,6 +97,10 @@ ifneq (,$(MOZ_XPI_PRESERVE_PERMISSIONS))
install_xpi_extra_parameter += --preserve-permissions
endif
+ifneq (,$(MOZ_XPI_DISABLE_SYSTEM_PREFS))
+install_xpi_extra_parameter += --disable-system-prefs
+endif
+
ifneq (,$(MOZ_XPI_INSTALL_DIRECTORY))
install_xpi_extra_parameter += -i $(MOZ_XPI_INSTALL_DIRECTORY)
endif