From 6eb624f2ea2133cfb5d8f9a6e8633c386a75a8f9 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 12 Jan 2012 19:36:25 +0100 Subject: Allow leaving /etc as untouched as possible For customized setups, it's hard to control what files get installed into /etc since in addition to the base-files package, any other package may install a sample config. When two packages provide the same file, which one of them makes it into the image depends on the order of them being installed. Solving this problem is not as trivial, as there are packages which must be allowed to install stuff into /etc. Best examples are base-files and ca-certificates. This patch solves the problem by adding another PKG_template flag "force_etc", which one can define in order to override the as well new Config.in symbol "ADK_LEAVE_ETC_ALONE". --- Config.in | 18 ++++++++++++++++++ mk/package.mk | 7 +++++++ package/base-files/Makefile | 4 +--- package/ca-certificates/Makefile | 2 +- package/ppp/Makefile | 4 ---- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Config.in b/Config.in index 1b3868d6b..8febb3313 100644 --- a/Config.in +++ b/Config.in @@ -45,9 +45,26 @@ endmenu menu "Package selection" depends on !ADK_CHOOSE_TARGET_ARCH && !ADK_CHOOSE_TARGET_KERNEL && !ADK_CHOOSE_TARGET_SYSTEM +config ADK_LEAVE_ETC_ALONE + boolean "do not install anything into /etc" + default n + help + Enabling this option will prevent the ADK from installing anything + into /etc. This is useful for highly customised setups with custom + base-files packages. + + Package Makefiles can override this setting by passing "force_etc" to + the package-template. to a non-empty value. This is useful for + packages traditionally installing non-config stuff into /etc, like + e.g. ca-certificates. + + Note that without further customisation, turning this option + on will almost certainly render the resulting system unusable. + config ADK_INSTALL_PACKAGE_INIT_SCRIPTS boolean "ship custom init-scripts along with packages" default y + depends on !ADK_LEAVE_ETC_ALONE help Turning this option to false will prevent the ADK from installing init-scripts (i.e. files in /etc/init.d) for @@ -59,6 +76,7 @@ config ADK_INSTALL_PACKAGE_INIT_SCRIPTS config ADK_INSTALL_PACKAGE_NETWORK_SCRIPTS boolean "ship custom network-scripts along with packages" default y + depends on !ADK_LEAVE_ETC_ALONE help Turning this option to false will prevent the ADK from installing network-scripts (i.e. files in /etc/network/) for diff --git a/mk/package.mk b/mk/package.mk index 07f53aa34..e69b7866f 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -159,6 +159,9 @@ endif ifeq ($(ADK_DEBUG_STRIP),y) $${RSTRIP} $${IDIR_$(1)} $(MAKE_TRACE) endif +ifeq (${ADK_LEAVE_ETC_ALONE}$(filter force_etc,$(7)),y) + -rm -rf $${IDIR_$(1)}/etc +else ifeq (${ADK_INSTALL_PACKAGE_INIT_SCRIPTS},y) @for file in $$$$(ls ./files/*.init 2>/dev/null); do \ fname=$$$$(echo $$$$file| sed -e "s#.*/##" -e "s#.init##"); \ @@ -171,6 +174,10 @@ ifeq (${ADK_INSTALL_PACKAGE_INIT_SCRIPTS},y) [[ -e $$$$script ]] || continue; \ chmod 0755 "$$$$script"; \ done +endif +ifneq (${ADK_INSTALL_PACKAGE_NETWORK_SCRIPTS},y) + -rm -rf $${IDIR_$(1)}/etc/network +endif endif @mkdir -p $${PACKAGE_DIR} '$${STAGING_PKG_DIR}' \ '$${STAGING_DIR}/scripts' diff --git a/package/base-files/Makefile b/package/base-files/Makefile index cb2b2430b..d7a3f38ea 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -15,7 +15,7 @@ NO_DISTFILES:= 1 include $(TOPDIR)/mk/package.mk -$(eval $(call PKG_template,BASE_FILES,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,BASE_FILES,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},force_etc)) CONFIG_STYLE:= manual BUILD_STYLE:= manual @@ -45,9 +45,7 @@ endif mkdir -p $(IDIR_BASE_FILES)/usr/lib/ipkg/lists mkdir -p $(IDIR_BASE_FILES)/etc/crontabs mkdir -p $(IDIR_BASE_FILES)/{dev,boot,root,sys,proc,tmp,mnt} -ifeq (${ADK_INSTALL_PACKAGE_NETWORK_SCRIPTS},y) mkdir -p $(IDIR_BASE_FILES)/etc/network/{if-pre-up.d,if-up.d,if-down.d,if-post-down.d} -endif mkdir -p $(IDIR_BASE_FILES)/usr/{lib,bin} chmod 755 $(IDIR_BASE_FILES)/lib/mdev/init chmod 600 $(IDIR_BASE_FILES)/etc/shadow diff --git a/package/ca-certificates/Makefile b/package/ca-certificates/Makefile index 228f30203..8c327aabd 100644 --- a/package/ca-certificates/Makefile +++ b/package/ca-certificates/Makefile @@ -20,7 +20,7 @@ PKGFD_SMALL:= Minimal set of CA certificates include $(TOPDIR)/mk/package.mk -$(eval $(call PKG_template,CA_CERTIFICATES,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,CA_CERTIFICATES,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},force_etc)) CONFIG_STYLE:= manual diff --git a/package/ppp/Makefile b/package/ppp/Makefile index 250089b4b..cc0928f20 100644 --- a/package/ppp/Makefile +++ b/package/ppp/Makefile @@ -57,11 +57,9 @@ post-install: ${INSTALL_BIN} ./files/pon ${IDIR_PPP}/usr/sbin/ ${INSTALL_BIN} ./files/poff ${IDIR_PPP}/usr/sbin/ ${INSTALL_DIR} ${IDIR_PPP}/etc/ppp/peers -ifeq (${ADK_INSTALL_PACKAGE_NETWORK_SCRIPTS},y) $(INSTALL_DIR) ${IDIR_PPP}/etc/network/if-pre-up.d $(INSTALL_BIN) ./files/ppp.pre-up \ ${IDIR_PPP}/etc/network/if-pre-up.d/05-ppp -endif ppp-mod-radius-install: ${INSTALL_DIR} ${IDIR_PPP_MOD_RADIUS}/etc/radiusclient @@ -104,13 +102,11 @@ ppp-mod-pppumts-install: ${INSTALL_DIR} ${IDIR_PPP_MOD_PPPUMTS}/etc/ppp/templates ${INSTALL_DATA} ./files/etc/ppp/templates/umts \ ${IDIR_PPP_MOD_PPPUMTS}/etc/ppp/templates/ -ifeq (${ADK_INSTALL_PACKAGE_NETWORK_SCRIPTS},y) $(INSTALL_DIR) ${IDIR_PPP_MOD_PPPUMTS}/etc/network/if-pre-up.d $(INSTALL_DIR) ${IDIR_PPP_MOD_PPPUMTS}/etc/network/if-post-down.d $(INSTALL_BIN) ./files/hso.if-up \ ${IDIR_PPP_MOD_PPPUMTS}/etc/network/if-pre-up.d/06-hso $(INSTALL_BIN) ./files/hso.if-down \ ${IDIR_PPP_MOD_PPPUMTS}/etc/network/if-post-down.d/06-hso -endif include ${TOPDIR}/mk/pkg-bottom.mk -- cgit v1.2.3