summaryrefslogtreecommitdiff
path: root/debian/patches/move-cupsd-conf-default-to-share.patch
blob: bfc6386b1f46f7803b096cdf8a222c030fc19151 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From bfc4c5409bd72c49eac5c35bd95f0d90a58204d0 Mon Sep 17 00:00:00 2001
From: Didier Raboud <odyx@debian.org>
Date: Tue, 9 Aug 2016 18:11:24 +0200
Subject: Move cupsd.conf.default from SERVERROOT to DATADIR

Origin: vendor
Bug: https://cups.org/str.php?L4342
Bug-Debian: http://bugs.debian.org/640124
Last-Update: 2015-02-10

Patch-Name: move-cupsd-conf-default-to-share.patch
---
 cgi-bin/admin.c | 6 +++++-
 conf/Makefile   | 5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c
index f8c57639f..fa4d82c2d 100644
--- a/cgi-bin/admin.c
+++ b/cgi-bin/admin.c
@@ -1629,6 +1629,7 @@ do_config_server(http_t *http)		/* I - HTTP connection */
     int		ch;			/* Character from file */
     char	filename[1024];		/* Filename */
     const char	*server_root;		/* Location of config files */
+    const char	*data_dir;		/* Location of data files */
 
 
    /*
@@ -1712,7 +1713,10 @@ do_config_server(http_t *http)		/* I - HTTP connection */
     * well...
     */
 
-    strlcat(filename, ".default", sizeof(filename));
+    if ((data_dir = getenv("CUPS_DATADIR")) == NULL)
+      data_dir = CUPS_DATADIR;
+
+    snprintf(filename, sizeof(filename), "%s/cupsd.conf.default",data_dir);
 
     if (!stat(filename, &info) && info.st_size < (1024 * 1024) &&
         (cupsd = cupsFileOpen(filename, "r")) != NULL)
diff --git a/conf/Makefile b/conf/Makefile
index e249e6069..42a123f75 100644
--- a/conf/Makefile
+++ b/conf/Makefile
@@ -70,7 +70,7 @@ install-data:
 		else \
 			$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT) ; \
 		fi ; \
-		$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.default; \
+		$(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(DATADIR)/$$file.default; \
 	done
 	$(INSTALL_DIR) -m 755 $(DATADIR)/mime
 	for file in $(REPLACE); do \
@@ -118,9 +118,10 @@ install-libs:
 #
 
 uninstall:
-	for file in $(KEEP) $(REPLACE) cupsd.conf.default; do \
+	for file in $(KEEP) $(REPLACE); do \
 		$(RM) $(SERVERROOT)/$$file; \
 	done
+	$(RM) $(DATADIR)/cupsd.conf.default
 	-$(RMDIR) $(SERVERROOT)
 	for file in $(REPLACE); do \
 		$(RM) $(DATADIR)/mime/$$file; \