diff options
author | ccsmart <ccsmart@smartpal.de> | 2005-07-16 13:19:11 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-07-16 13:19:11 +0000 |
commit | 1b882f8f93dac097297da0c8baa4ca0da2b4e2c1 (patch) | |
tree | 5644608fb6046d2239c0411c7edf7b290bcec0b8 | |
parent | b4b75016228d263d9b5f76584f7295422b596594 (diff) | |
parent | a9aec71a176d39a01e691b22156ca1a1dc49034c (diff) |
merge of 64742a6240c7bfc0d8e2211cc677ed7556a6ddf8
and 685decee8e00db19102306be91759691218d20b5
-rwxr-xr-x | packages/initscripts/initscripts-1.0/populate-volatile.sh | 64 | ||||
-rw-r--r-- | packages/initscripts/initscripts-1.0/volatiles | 29 |
2 files changed, 93 insertions, 0 deletions
diff --git a/packages/initscripts/initscripts-1.0/populate-volatile.sh b/packages/initscripts/initscripts-1.0/populate-volatile.sh new file mode 100755 index 0000000000..311a2764da --- /dev/null +++ b/packages/initscripts/initscripts-1.0/populate-volatile.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +. /etc/default/rcS +CFGFILE="/etc/default/volatiles" + +[ "${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}-." + + [ "${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 + diff --git a/packages/initscripts/initscripts-1.0/volatiles b/packages/initscripts/initscripts-1.0/volatiles new file mode 100644 index 0000000000..45d373cedc --- /dev/null +++ b/packages/initscripts/initscripts-1.0/volatiles @@ -0,0 +1,29 @@ +# This configuration file lists filesystem objects that should get verified +# during startup and be created if missing. +# +# Every line must either be a comment starting with # +# or a definition of format: +# <type> <owner> <group> <mode> <path> [<linksource>] +# where the items are separated by whitespace ! +# +# <type> : d|f|l : (d)irectory|(f)ile|(l)ink +# +# A linking example: +# l root root 0777 /var/test /tmp/testfile +# f root root 0644 /var/test +# +d root root 0775 /var +d root root 0755 /var/backups +d root root 0755 /var/cache +d root root 0755 /var/lib +d root root 0755 /var/lib/misc +d root root 2775 /var/local +d root root 1777 /var/lock +d root root 0755 /var/lock/subsys +d root root 0755 /var/log +d root root 0755 /var/run +d root root 0755 /var/spool +d root root 1777 /var/tmp +f root root 0664 /var/run/utmp +f root root 0664 /var/log/wtmp +f root root 0664 /var/log/lastlog |