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 <mail@aparcar.org>
This commit is contained in:
Paul Spooren 2021-09-11 22:46:06 -10:00
parent 9c331a6a91
commit 70543aafb2
1 changed files with 20 additions and 18 deletions

View File

@ -161,24 +161,27 @@ define Package/base-files/install
$(1)/etc/preinit \ $(1)/etc/preinit \
$(1)/etc/profile $(1)/etc/profile
mkdir -p $(1)/CONTROL mkdir -p \
mkdir -p $(1)/dev $(1)/CONTROL \
mkdir -p $(1)/etc/config $(1)/dev \
mkdir -p $(1)/etc/crontabs $(1)/etc/config \
mkdir -p $(1)/etc/rc.d $(1)/etc/crontabs \
mkdir -p $(1)/overlay $(1)/etc/rc.d \
mkdir -p $(1)/lib/firmware $(1)/overlay \
$(if $(LIB_SUFFIX),-$(LN) lib $(1)/lib$(LIB_SUFFIX)) $(1)/lib/firmware \
mkdir -p $(1)/mnt $(1)/mnt \
mkdir -p $(1)/proc $(1)/proc \
mkdir -p $(1)/tmp $(1)/tmp \
mkdir -p $(1)/usr/lib $(1)/usr/lib \
$(if $(LIB_SUFFIX),-$(LN) lib $(1)/usr/lib$(LIB_SUFFIX)) $(1)/usr/bin \
mkdir -p $(1)/usr/bin $(1)/sys \
mkdir -p $(1)/sys $(1)/www \
mkdir -p $(1)/www $(1)/root
mkdir -p $(1)/root
$(LN) /proc/mounts $(1)/etc/mtab $(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) ifneq ($(CONFIG_TARGET_ROOTFS_PERSIST_VAR),y)
rm -f $(1)/var rm -f $(1)/var
$(LN) tmp $(1)/var $(LN) tmp $(1)/var
@ -186,7 +189,6 @@ else
mkdir -p $(1)/var mkdir -p $(1)/var
$(LN) /tmp/run $(1)/var/run $(LN) /tmp/run $(1)/var/run
endif endif
mkdir -p $(1)/etc
$(LN) /tmp/resolv.conf /tmp/TZ /tmp/localtime $(1)/etc/ $(LN) /tmp/resolv.conf /tmp/TZ /tmp/localtime $(1)/etc/
chmod 0600 $(1)/etc/shadow chmod 0600 $(1)/etc/shadow