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