From 317de06ffe39f1c67fffdc0121b968b2a96a0b75 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 7 Dec 2017 12:10:55 -0600 Subject: Create /run/config in the /etc/init.d/config, if it does not exist --- recipes-core/multitech/config/config.init | 5 ++++ recipes-core/multitech/config_2.0.bb | 40 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 recipes-core/multitech/config_2.0.bb diff --git a/recipes-core/multitech/config/config.init b/recipes-core/multitech/config/config.init index 5046050..ad36c2e 100644 --- a/recipes-core/multitech/config/config.init +++ b/recipes-core/multitech/config/config.init @@ -3,6 +3,7 @@ CONFIG_MTDC=/dev/mtd6 CONFIG_MTDB=/dev/mtdblock6 CONFIG_DIR=/var/config +RUN_CONF_DIR=/run/config OEM_MTDC=/dev/mtd7 OEM_MTDB=/dev/mtdblock7 @@ -60,6 +61,10 @@ mount_oem() { case $1 in start) + if ! [[ -f /run/config/device_info.json ]] ; then + [[ -d /run/config ]] || mkdir -m 755 -p /run/config + /sbin/get-eeprom-device-info + fi # mount config if not already mounted if ! grep -q "^${CONFIG_MTDB} " /proc/mounts; then mount_config diff --git a/recipes-core/multitech/config_2.0.bb b/recipes-core/multitech/config_2.0.bb new file mode 100644 index 0000000..5137206 --- /dev/null +++ b/recipes-core/multitech/config_2.0.bb @@ -0,0 +1,40 @@ +DESCRIPTION = "Provides default system config files and /var/config fs" +SECTION = "base" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +PR = "r0" + +inherit update-rc.d + +INITSCRIPT_NAME = "config" +INITSCRIPT_PARAMS = "start 31 S ." + +SRC_URI = "\ + file://network \ + file://ppp \ + file://config.init \ +" + +CONFIGFILES = "network ppp" + +fakeroot do_install () { + cd ${WORKDIR} + + # default config files + rm -f defaults.tar.gz + chown root:root -R ${CONFIGFILES} + tar czf defaults.tar.gz ${CONFIGFILES} + install -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/defaults.tar.gz ${D}${sysconfdir}/defaults.tar.gz + + # save root password for resetting to defaults + echo -n '${ROOT_PASSWORD_HASH}' > ${D}${sysconfdir}/default_pass + chmod 400 ${D}${sysconfdir}/default_pass + + # init script + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/config.init ${D}${sysconfdir}/init.d/config +} + +FILES_${PN} = "${sysconfdir}/defaults.tar.gz ${sysconfdir}/default_pass" +FILES_${PN} += "${sysconfdir}/init.d/config" -- cgit v1.2.3