From c85f84bfded0a5638bdd4988515223c68eefcf8b Mon Sep 17 00:00:00 2001 From: Beginner <70857188+Beginner-Go@users.noreply.github.com> Date: Sat, 25 Sep 2021 01:40:03 +0800 Subject: [PATCH] base-files: reduce sed calls (#7924) * base-files: reduce `sed` calls The `sed`-script shouldn't be called multiple times, especially not with the same files. This commit merges all files together in a single `sed`-script call. Signed-off-by: Paul Spooren * base-files: reduce number of `mkdir` calls The `mkdir` commands supports passing multiple arguments to batch create multiple folders, instead of calling the tool every single time. If the creation of one of the folders fails, all other folder are still created and therefore doesn't change the error handling. Also stop creating `/etc/` explicitly after subfolders of `/etc/` were already created. Signed-off-by: Paul Spooren Co-authored-by: Paul Spooren --- package/base-files/Makefile | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 818ebd0f1..60111fd21 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -142,37 +142,38 @@ define Package/base-files/install $(VERSION_SED_SCRIPT) \ $(1)/etc/banner \ + $(1)/etc/device_info \ + $(1)/etc/openwrt_release \ $(1)/etc/openwrt_version \ $(1)/usr/lib/os-release - $(VERSION_SED_SCRIPT) \ - $(1)/etc/openwrt_release \ - $(1)/etc/device_info \ - $(1)/usr/lib/os-release $(SED) "s#%PATH%#$(TARGET_INIT_PATH)#g" \ $(1)/sbin/hotplug-call \ $(1)/etc/preinit \ $(1)/etc/profile - mkdir -p $(1)/CONTROL - mkdir -p $(1)/dev - mkdir -p $(1)/etc/config - mkdir -p $(1)/etc/crontabs - mkdir -p $(1)/etc/rc.d - mkdir -p $(1)/overlay - mkdir -p $(1)/lib/firmware - $(if $(LIB_SUFFIX),-$(LN) lib $(1)/lib$(LIB_SUFFIX)) - mkdir -p $(1)/mnt - mkdir -p $(1)/proc - mkdir -p $(1)/tmp - mkdir -p $(1)/usr/lib - $(if $(LIB_SUFFIX),-$(LN) lib $(1)/usr/lib$(LIB_SUFFIX)) - mkdir -p $(1)/usr/bin - mkdir -p $(1)/sys - mkdir -p $(1)/www - mkdir -p $(1)/root + mkdir -p \ + $(1)/CONTROL \ + $(1)/dev \ + $(1)/etc/config \ + $(1)/etc/crontabs \ + $(1)/etc/rc.d \ + $(1)/overlay \ + $(1)/lib/firmware \ + $(1)/mnt \ + $(1)/proc \ + $(1)/tmp \ + $(1)/usr/lib \ + $(1)/usr/bin \ + $(1)/sys \ + $(1)/www \ + $(1)/root + $(LN) /proc/mounts $(1)/etc/mtab + $(if $(LIB_SUFFIX),-$(LN) lib $(1)/lib$(LIB_SUFFIX)) + $(if $(LIB_SUFFIX),-$(LN) lib $(1)/usr/lib$(LIB_SUFFIX)) + ifneq ($(CONFIG_TARGET_ROOTFS_PERSIST_VAR),y) rm -f $(1)/var $(LN) tmp $(1)/var @@ -180,7 +181,6 @@ else mkdir -p $(1)/var $(LN) /tmp/run $(1)/var/run endif - mkdir -p $(1)/etc $(LN) /tmp/resolv.conf /tmp/TZ /tmp/localtime $(1)/etc/ chmod 0600 $(1)/etc/shadow