1 From e35f809c435c224954a5c7bff3f5729c5b3bc0ba Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Thu, 21 Jan 2016 23:21:06 +0100
4 Subject: [PATCH] Sanitize the installation process
6 The installation process does two things that are not convenient when
9 - It uses install's -s option to strip binaries, but this option uses
10 the host strip and not the cross strip, which fails at stripping
11 binaries. In addition, we do not necessarily want cups to strip its
12 binaries, we may want to keep the debugging symbols.
14 - It enforces ownership (user, group) which isn't possible since
15 "make install" isn't executed as root when cross-compiling.
17 - It installs many files and directories with permissions that
18 prevent overwriting those files/directories, which meant calling
19 "make install" twice was failing.
21 [Vincent: tweak the patch for 2.2.2 release]
23 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
24 Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
26 Makedefs.in | 12 ++++++------
27 conf/Makefile | 6 +++---
28 notifier/Makefile | 2 +-
29 scheduler/Makefile | 15 +++++++--------
30 4 files changed, 17 insertions(+), 18 deletions(-)
32 diff --git a/Makedefs.in b/Makedefs.in
33 index 3afef0a..3e4f1bd 100644
36 @@ -40,14 +40,14 @@ SHELL = /bin/sh
37 # Installation programs...
40 -INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
41 -INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@
42 +INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 755
43 +INSTALL_COMPDATA = $(INSTALL) -c -m 644 @INSTALL_GZIP@
44 INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
45 -INSTALL_DATA = $(INSTALL) -c -m 444
46 +INSTALL_DATA = $(INSTALL) -c -m 644
47 INSTALL_DIR = $(INSTALL) -d
48 -INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
49 -INSTALL_MAN = $(INSTALL) -c -m 444
50 -INSTALL_SCRIPT = $(INSTALL) -c -m 555
51 +INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 755
52 +INSTALL_MAN = $(INSTALL) -c -m 644
53 +INSTALL_SCRIPT = $(INSTALL) -c -m 755
56 # Default user, group, and system groups for the scheduler...
57 diff --git a/conf/Makefile b/conf/Makefile
58 index 933d7d9..6ac5e19 100644
61 @@ -72,11 +72,11 @@ install: all install-data install-headers install-libs install-exec
63 for file in $(KEEP); do \
64 if test -r $(SERVERROOT)/$$file ; then \
65 - $(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.N ; \
66 + $(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
68 - $(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT) ; \
69 + $(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
71 - $(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.default; \
72 + $(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.default; \
74 $(INSTALL_DIR) -m 755 $(DATADIR)/mime
75 for file in $(REPLACE); do \
76 diff --git a/notifier/Makefile b/notifier/Makefile
77 index 3206dd0..c34a4d7 100644
78 --- a/notifier/Makefile
79 +++ b/notifier/Makefile
80 @@ -62,7 +62,7 @@ install: all install-data install-headers install-libs install-exec
84 - $(INSTALL_DIR) -m 775 -g $(CUPS_GROUP) $(CACHEDIR)/rss
85 + $(INSTALL_DIR) -m 775 $(CACHEDIR)/rss
89 diff --git a/scheduler/Makefile b/scheduler/Makefile
90 index 251f017..25f2f5f 100644
91 --- a/scheduler/Makefile
92 +++ b/scheduler/Makefile
93 @@ -146,28 +146,27 @@ install-data:
94 echo Creating $(SERVERBIN)/driver...
95 $(INSTALL_DIR) -m 755 $(SERVERBIN)/driver
96 echo Creating $(SERVERROOT)...
97 - $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)
98 + $(INSTALL_DIR) -m 755 $(SERVERROOT)
99 echo Creating $(SERVERROOT)/ppd...
100 - $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)/ppd
101 + $(INSTALL_DIR) -m 755 $(SERVERROOT)/ppd
102 if test "x`uname`" != xDarwin; then \
103 echo Creating $(SERVERROOT)/ssl...; \
104 - $(INSTALL_DIR) -m 700 -g $(CUPS_GROUP) $(SERVERROOT)/ssl; \
105 + $(INSTALL_DIR) -m 700 $(SERVERROOT)/ssl; \
107 if test "$(STATEDIR)" != "$(SERVERROOT)"; then \
108 echo Creating $(STATEDIR)...; \
109 $(INSTALL_DIR) -m 755 $(STATEDIR); \
111 echo Creating $(STATEDIR)/certs...
112 - $(INSTALL_DIR) -m 511 -o $(CUPS_USER) -g $(CUPS_PRIMARY_SYSTEM_GROUP) \
114 + $(INSTALL_DIR) -m 711 $(STATEDIR)/certs
115 echo Creating $(LOGDIR)...
116 $(INSTALL_DIR) -m 755 $(LOGDIR)
117 echo Creating $(REQUESTS)...
118 - $(INSTALL_DIR) -m 710 -g $(CUPS_GROUP) $(REQUESTS)
119 + $(INSTALL_DIR) -m 710 $(REQUESTS)
120 echo Creating $(REQUESTS)/tmp...
121 - $(INSTALL_DIR) -m 1770 -g $(CUPS_GROUP) $(REQUESTS)/tmp
122 + $(INSTALL_DIR) -m 1770 $(REQUESTS)/tmp
123 echo Creating $(CACHEDIR)...
124 - $(INSTALL_DIR) -m 770 -g $(CUPS_GROUP) $(CACHEDIR)
125 + $(INSTALL_DIR) -m 770 $(CACHEDIR)
126 if test "x$(INITDIR)" != x; then \
127 echo Installing init scripts...; \
128 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \