DESCRIPTION = "Startup scripts" LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD" LIC_FILES_CHKSUM = "file://../LICENSE;md5=eef71d57c191bf0563e2407afc838f99" require blackbox.inc # Recipe revision - don't forget to 'bump' when a new revision is created ! PR = "r0" RPROVIDES_${PN}="blackbox" # Runtime dependencies # # Add a line similar to the following to ensure any packages needed for the scripts to run are installed in the image. # #RDEPENDS_${PN} = "net-snmp" # SRC_URI specifies the files that are to be used as the scripts. # # Any valid src_uri format can be used - this example assumes the # scripts are stored in the 'files' directory below the one in # which this file is located. # SRC_URI = " \ file://LICENSE \ file://askco.json \ file:///home/xool/AskcoVisionBox/latest.zip \ " inherit useradd USERADD_PACKAGES = "${PN}" GROUPADD_PACKAGES = "${PN}" GROUPADD_PARAM_${PN} = "configuration" USERADD_PARAM_${PN} = "-d /tmp -G configuration blackbox; -m -d /tmp -s /usr/sbin/generate_config.sh -G configuration -p wtmoOHy.mTsUk technicien" # This function is responsible for: # 1) Ensuring the required directories exist in the image; # 2) Installing the scripts in to the image; # 3) Creating the desired runlevel links to the scripts. do_compile() { make -C .. clean make -C .. CC='arm-poky-linux-gnueabi-gcc' AR='arm-poky-linux-gnueabi-ar' } do_install() { # # Create directories: # ${D}${sysconfdir}/init.d - will hold the scripts # ${D}${sysconfdir}/rcS.d - will contain a link to the script that runs at startup # ${D}${sysconfdir}/rc5.d - will contain a link to the script that runs at runlevel=5 # ${D}${sbindir} - scripts called by the above # # ${D} is effectively the root directory of the target system. # ${D}${sysconfdir} is where system configuration files are to be stored (e.g. /etc). # ${D}${sbindir} is where executable files are to be stored (e.g. /sbin). # install -d ${D}${sysconfdir}/init.d install -d ${D}${sysconfdir}/rcS.d install -d ${D}${sysconfdir}/rc1.d install -d ${D}${sysconfdir}/rc2.d install -d ${D}${sysconfdir}/rc3.d install -d ${D}${sysconfdir}/rc4.d install -d ${D}${sysconfdir}/rc5.d install -d ${D}${sbindir} # # Install files in to the image # # The files fetched via SRC_URI (above) will be in ${WORKDIR}. # install -m 0544 ${WORKDIR}/scripts/initscript.sh ${D}${sysconfdir}/init.d/blackbox install -m 0700 ${WORKDIR}/blackbox_client ${D}${sbindir}/blackbox_client install -o technicien -m 0500 ${WORKDIR}/scripts/generate_config.sh ${D}${sbindir}/ install -o blackbox -g configuration -m 0660 ${WORKDIR}/askco.json ${D}${sysconfdir}/ install -d ${D}${sysconfdir}/dnsmasq.d echo "/usr/sbin/generate_config.sh" >> ${D}${sysconfdir}/shells echo "/bin/sh" >> ${D}${sysconfdir}/shells # # Symbolic links can also be installed. e.g. # # ln -s support-script-link ${D}${sbindir}/support-script # # Create symbolic links from the runlevel directories to the script files. # Links of the form S... and K... mean the script when be called when # entering / exiting the runlevel designated by the containing directory. # For example: # rc5.d/S90run-script will be called (with %1='start') when entering runlevel 5. # rc5.d/K90run-script will be called (with %1='stop') when exiting runlevel 5. # ln -sf ../init.d/blackbox ${D}${sysconfdir}/rcS.d/S90blackbox ln -sf ../init.d/blackbox ${D}${sysconfdir}/rc1.d/K90run-script ln -sf ../init.d/blackbox ${D}${sysconfdir}/rc2.d/K90run-script ln -sf ../init.d/blackbox ${D}${sysconfdir}/rc3.d/K90run-script ln -sf ../init.d/blackbox ${D}${sysconfdir}/rc4.d/K90run-script ln -sf ../init.d/blackbox ${D}${sysconfdir}/rc5.d/S90run-script ln -sf /etc/init.d/snmpd ${D}${sysconfdir}/rcS.d/S90snmpd echo "blackbox ALL = NOPASSWD: /sbin/reboot" >> ${D}${sysconfdir}/sudoers echo "blackbox ALL = NOPASSWD: /mnt/legato/system/bin/fwupdate" >> ${D}${sysconfdir}/sudoers }