diff options
Diffstat (limited to 'packages/initscripts')
-rwxr-xr-x | packages/initscripts/initscripts-1.0/populate-volatile.sh | 168 | ||||
-rw-r--r-- | packages/initscripts/initscripts-openslug_1.0.bb | 4 | ||||
-rw-r--r-- | packages/initscripts/initscripts_1.0.bb | 7 |
3 files changed, 127 insertions, 52 deletions
diff --git a/packages/initscripts/initscripts-1.0/populate-volatile.sh b/packages/initscripts/initscripts-1.0/populate-volatile.sh index 311a2764da..99a469d576 100755 --- a/packages/initscripts/initscripts-1.0/populate-volatile.sh +++ b/packages/initscripts/initscripts-1.0/populate-volatile.sh @@ -1,64 +1,138 @@ #!/bin/sh . /etc/default/rcS -CFGFILE="/etc/default/volatiles" + +CFGDIR="/etc/default/volatiles" +TMPROOT="/var/tmp" +COREDEF="00_core" [ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems." -cat ${CFGFILE} | grep -v "^#" | \ -while read LINE; do - TTYPE=`echo ${LINE} | cut -d " " -f 1` - TUSER=`echo ${LINE} | cut -d " " -f 2` - TGROUP=`echo ${LINE} | cut -d " " -f 3` - TMODE=`echo ${LINE} | cut -d " " -f 4` - TNAME=`echo ${LINE} | cut -d " " -f 5` - [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." +check_requirements() { - [ "${TTYPE}" = "l" ] && { - [ -e "${TNAME}" ] && { - echo "Cannot create link over existing -${TNAME}-." >&2 - } || { - TSOURCE=`echo ${LINE} | cut -d " " -f 6` - [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-." - ln -s "${TSOURCE}" "${TNAME}" - } - continue + cleanup() { + rm "${TMP_INTERMED}" + rm "${TMP_DEFINED}" + rm "${TMP_COMBINED}" } + + CFGFILE="$1" - [ -L "${TNAME}" ] && { - [ "${VERBOSE}" != "no" ] && echo "Found link." - NEWNAME=`ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/'` - echo ${NEWNAME} | grep -v "^/" >/dev/null && { - TNAME="`echo ${TNAME} | sed -e 's@\(.*\)/.*@\1@'`/${NEWNAME}" - [ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-." - } || { - TNAME="${NEWNAME}" - [ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-." - } + [ `basename "${CFGFILE}"` = "${COREDEF}" ] && return 0 + + TMP_INTERMED="${TMPROOT}/tmp.$$" + TMP_DEFINED="${TMPROOT}/tmpdefined.$$" + TMP_COMBINED="${TMPROOT}/tmpcombined.$$" + + + cat /etc/passwd | sed 's@\(^:\)*:.*@\1@' | sort | uniq > "${TMP_DEFINED}" + cat ${CFGFILE} | grep -v "^#" | cut -d " " -f 2 > "${TMP_INTERMED}" + cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}" + + NR_DEFINED_USERS="`cat "${TMP_DEFINED}" | wc -l`" + NR_COMBINED_USERS="`cat "${TMP_COMBINED}" | wc -l`" + + [ "${NR_DEFINED_USERS}" -ne "${NR_COMBINED_USERS}" ] && { + echo "Undefined users:" + diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>" + cleanup + return 1 + } + + + cat /etc/group | sed 's@\(^:\)*:.*@\1@' | sort | uniq > "${TMP_DEFINED}" + cat ${CFGFILE} | grep -v "^#" | cut -d " " -f 3 > "${TMP_INTERMED}" + cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}" + + NR_DEFINED_GROUPS="`cat "${TMP_DEFINED}" | wc -l`" + NR_COMBINED_GROUPS="`cat "${TMP_COMBINED}" | wc -l`" + + [ "${NR_DEFINED_GROUPS}" -ne "${NR_COMBINED_GROUPS}" ] && { + echo "Undefined groups:" + diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>" + cleanup + return 1 } - [ -e "${TNAME}" ] && { - [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." - continue + # Add checks for required directories here + + cleanup + return 0 + } + +apply_cfgfile() { + + CFGFILE="$1" + + check_requirements "${CFGFILE}" || { + echo "Skipping ${CFGFILE}" + return 1 } - case "${TTYPE}" in - "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." - touch "${TNAME}" - ;; - "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." - mkdir -p "${TNAME}" - # Add check to see if there's an entry in fstab to mount. - ;; - *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-." - continue - ;; - esac - - chown ${TUSER} ${TNAME} || echo "Failed to set owner -${TUSER}- for -${TNAME}-." >&2 - chgrp ${TGROUP} ${TNAME} || echo "Failed to set group -${TGROUP}- for -${TNAME}-." >&2 - chmod ${TMODE} ${TNAME} || echo "Failed to set mode -${TMODE}- for -${TNAME}-." >&2 + cat ${CFGFILE} | grep -v "^#" | \ + while read LINE; do + TTYPE=`echo ${LINE} | cut -d " " -f 1` + TUSER=`echo ${LINE} | cut -d " " -f 2` + TGROUP=`echo ${LINE} | cut -d " " -f 3` + TMODE=`echo ${LINE} | cut -d " " -f 4` + TNAME=`echo ${LINE} | cut -d " " -f 5` + + [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." + + [ "${TTYPE}" = "l" ] && { + [ -e "${TNAME}" ] && { + echo "Cannot create link over existing -${TNAME}-." >&2 + } || { + TSOURCE=`echo ${LINE} | cut -d " " -f 6` + [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-." + ln -s "${TSOURCE}" "${TNAME}" + } + continue + } + + [ -L "${TNAME}" ] && { + [ "${VERBOSE}" != "no" ] && echo "Found link." + NEWNAME=`ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/'` + echo ${NEWNAME} | grep -v "^/" >/dev/null && { + TNAME="`echo ${TNAME} | sed -e 's@\(.*\)/.*@\1@'`/${NEWNAME}" + [ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-." + } || { + TNAME="${NEWNAME}" + [ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-." + } + } + + [ -e "${TNAME}" ] && { + [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." + continue + } + + case "${TTYPE}" in + "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." + touch "${TNAME}" + ;; + "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." + mkdir -p "${TNAME}" + # Add check to see if there's an entry in fstab to mount. + ;; + *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-." + continue + ;; + esac + + chown ${TUSER} ${TNAME} || echo "Failed to set owner -${TUSER}- for -${TNAME}-." >&2 + chgrp ${TGROUP} ${TNAME} || echo "Failed to set group -${TGROUP}- for -${TNAME}-." >&2 + chmod ${TMODE} ${TNAME} || echo "Failed to set mode -${TMODE}- for -${TNAME}-." >&2 + + done + + return 0 + + } + +for file in `ls -1 "${CFGDIR}" | sort`; do + apply_cfgfile "${CFGDIR}/${file}" done diff --git a/packages/initscripts/initscripts-openslug_1.0.bb b/packages/initscripts/initscripts-openslug_1.0.bb index b5252bfdeb..4e82022876 100644 --- a/packages/initscripts/initscripts-openslug_1.0.bb +++ b/packages/initscripts/initscripts-openslug_1.0.bb @@ -11,7 +11,7 @@ RCONFLICTS = "initscripts" # All other standard definitions inherited from initscripts # Except the PR which is hacked here. The format used is # a suffix -PR := "${PR}.2" +PR := "${PR}.3" FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/${P}', '${FILE_DIRNAME}/initscripts-${PV}', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}" @@ -96,7 +96,7 @@ do_install_append() { # checkfs.sh is currently disabled from S 30 (and won't work on OpenSlug) # ramdisk is not used on OpenSlug, would run at S 30 update-rc.d -r ${D} mountall.sh start 35 S . - # base-files populate-var.sh runs at S37 + # base-files populate-volatile.sh runs at S37 update-rc.d -r ${D} devpts.sh start 38 S . # openslug file syslog starts here (39) diff --git a/packages/initscripts/initscripts_1.0.bb b/packages/initscripts/initscripts_1.0.bb index 76755e1744..5e7d6fe44c 100644 --- a/packages/initscripts/initscripts_1.0.bb +++ b/packages/initscripts/initscripts_1.0.bb @@ -6,7 +6,7 @@ DEPENDS = "makedevs" DEPENDS_openzaurus = "makedevs virtual/kernel" RDEPENDS = "makedevs" LICENSE = "GPL" -PR = "r51" +PR = "r52" SRC_URI = "file://halt \ file://ramdisk \ @@ -66,7 +66,8 @@ do_install () { ${D}${sysconfdir}/rc4.d \ ${D}${sysconfdir}/rc5.d \ ${D}${sysconfdir}/rc6.d \ - ${D}${sysconfdir}/default + ${D}${sysconfdir}/default \ + ${D}${sysconfdir}/default/volatiles install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/checkroot.sh ${D}${sysconfdir}/init.d @@ -86,7 +87,7 @@ do_install () { install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d - install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core if [ "${TARGET_ARCH}" = "arm" ]; then install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d fi |