From 61177952e054be9569ce011218ab032c03b4db5a Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Thu, 21 Jan 2016 23:21:06 +0100 Subject: [PATCH] Sanitize the installation process The installation process does two things that are not convenient when cross-compiling: - It uses install's -s option to strip binaries, but this option uses the host strip and not the cross strip, which fails at stripping binaries. In addition, we do not necessarily want cups to strip its binaries, we may want to keep the debugging symbols. - It enforces ownership (user, group) which isn't possible since "make install" isn't executed as root when cross-compiling. - It installs many files and directories with permissions that prevent overwriting those files/directories, which meant calling "make install" twice was failing. [Olivier: tweak the patch for 2.2.4 release] Signed-off-by: Thomas Petazzoni Signed-off-by: Olivier Schonken --- Makedefs.in | 12 ++++++------ conf/Makefile | 6 +++--- notifier/Makefile | 2 +- scheduler/Makefile | 15 +++++++-------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Makedefs.in b/Makedefs.in index a2342d5c0..0d8df733b 100644 --- a/Makedefs.in +++ b/Makedefs.in @@ -46,14 +46,14 @@ SHELL = /bin/sh # Installation programs... # -INSTALL_BIN = @LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@ -INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@ +INSTALL_BIN = @LIBTOOL_INSTALL@ $(INSTALL) -c -m 755 +INSTALL_COMPDATA = $(INSTALL) -c -m 644 @INSTALL_GZIP@ INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@ -INSTALL_DATA = $(INSTALL) -c -m 444 +INSTALL_DATA = $(INSTALL) -c -m 644 INSTALL_DIR = $(INSTALL) -d -INSTALL_LIB = @LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@ -INSTALL_MAN = $(INSTALL) -c -m 444 -INSTALL_SCRIPT = $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ +INSTALL_LIB = @LIBTOOL_INSTALL@ $(INSTALL) -c -m 755 +INSTALL_MAN = $(INSTALL) -c -m 644 +INSTALL_SCRIPT = $(INSTALL) -c -m 755 # # Default user, group, and system groups for the scheduler... diff --git a/conf/Makefile b/conf/Makefile index 62aa0c6fd..3cced869c 100644 --- a/conf/Makefile +++ b/conf/Makefile @@ -67,11 +67,11 @@ install: all install-data install-headers install-libs install-exec install-data: for file in $(KEEP); do \ if test -r $(SERVERROOT)/$$file ; then \ - $(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.N ; \ + $(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \ else \ - $(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT) ; \ + $(INSTALL_CONFIG) $$file $(SERVERROOT) ; \ fi ; \ - $(INSTALL_CONFIG) -g $(CUPS_GROUP) $$file $(SERVERROOT)/$$file.default; \ + $(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.default; \ done $(INSTALL_DIR) -m 755 $(DATADIR)/mime for file in $(REPLACE); do \ diff --git a/notifier/Makefile b/notifier/Makefile index fa2c7f2f7..34f7a0d6b 100644 --- a/notifier/Makefile +++ b/notifier/Makefile @@ -57,7 +57,7 @@ install: all install-data install-headers install-libs install-exec # install-data: - $(INSTALL_DIR) -m 775 -g $(CUPS_GROUP) $(CACHEDIR)/rss + $(INSTALL_DIR) -m 775 $(CACHEDIR)/rss # diff --git a/scheduler/Makefile b/scheduler/Makefile index 57b169387..aefa89719 100644 --- a/scheduler/Makefile +++ b/scheduler/Makefile @@ -142,28 +142,27 @@ install-data: echo Creating $(SERVERBIN)/driver... $(INSTALL_DIR) -m 755 $(SERVERBIN)/driver echo Creating $(SERVERROOT)... - $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT) + $(INSTALL_DIR) -m 755 $(SERVERROOT) echo Creating $(SERVERROOT)/ppd... - $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)/ppd + $(INSTALL_DIR) -m 755 $(SERVERROOT)/ppd if test "x`uname`" != xDarwin; then \ echo Creating $(SERVERROOT)/ssl...; \ - $(INSTALL_DIR) -m 700 -g $(CUPS_GROUP) $(SERVERROOT)/ssl; \ + $(INSTALL_DIR) -m 700 $(SERVERROOT)/ssl; \ fi if test "$(STATEDIR)" != "$(SERVERROOT)"; then \ echo Creating $(STATEDIR)...; \ $(INSTALL_DIR) -m 755 $(STATEDIR); \ fi echo Creating $(STATEDIR)/certs... - $(INSTALL_DIR) -m 511 -o $(CUPS_USER) -g $(CUPS_PRIMARY_SYSTEM_GROUP) \ - $(STATEDIR)/certs + $(INSTALL_DIR) -m 711 $(STATEDIR)/certs echo Creating $(LOGDIR)... $(INSTALL_DIR) -m 755 $(LOGDIR) echo Creating $(REQUESTS)... - $(INSTALL_DIR) -m 710 -g $(CUPS_GROUP) $(REQUESTS) + $(INSTALL_DIR) -m 710 $(REQUESTS) echo Creating $(REQUESTS)/tmp... - $(INSTALL_DIR) -m 1770 -g $(CUPS_GROUP) $(REQUESTS)/tmp + $(INSTALL_DIR) -m 1770 $(REQUESTS)/tmp echo Creating $(CACHEDIR)... - $(INSTALL_DIR) -m 770 -g $(CUPS_GROUP) $(CACHEDIR) + $(INSTALL_DIR) -m 770 $(CACHEDIR) if test "x$(INITDIR)" != x; then \ echo Installing init scripts...; \ $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \ -- 2.34.1