Changeset View
Changeset View
Standalone View
Standalone View
tools/tools/nanobsd/defaults.sh
| Show First 20 Lines • Show All 718 Lines • ▼ Show 20 Lines | if [ -n "${dir}" -a -d "${dir}" ]; then | ||||
| echo "Populating ${lbl} from ${dir}" | echo "Populating ${lbl} from ${dir}" | ||||
| cd "${dir}" | cd "${dir}" | ||||
| find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio ${CPIO_SYMLINK} -dumpv ${mnt} | find . -print | grep -Ev '/(CVS|\.svn|\.hg|\.git)/' | cpio ${CPIO_SYMLINK} -dumpv ${mnt} | ||||
| fi | fi | ||||
| df -i ${mnt} | df -i ${mnt} | ||||
| nano_umount ${mnt} | nano_umount ${mnt} | ||||
| } | } | ||||
| _populate_part() ( | |||||
| local dir fs lbl metalog size type | |||||
| type=$1 | |||||
| fs=$2 | |||||
| dir=$3 | |||||
| lbl=$4 | |||||
| size=$5 | |||||
| metalog=$6 | |||||
| echo "Creating ${fs}" | |||||
| # Use the directory provided, otherwise create an empty one temporarily. | |||||
| if [ -n "${dir}" ] && [ -d "${dir}" ]; then | |||||
| echo "Populating ${lbl} from ${dir}" | |||||
| else | |||||
| if [ "${type}" = "cfg" ]; then | |||||
| dir=$(mktemp -d -p "${NANO_OBJ}" -t "${type}") | |||||
| trap "rm -f ${dir}" 1 2 15 EXIT | |||||
| fi | |||||
| fi | |||||
| if [ -d "${dir}" ]; then | |||||
| # If there is no metalog, create one using the default | |||||
| # NANO_DEF_UNAME and NANO_DEF_GNAME for all entries in the spec. | |||||
| if [ -z "${metalog}" ]; then | |||||
| metalog=$(mktemp -p "${NANO_OBJ}" -t "${type}") | |||||
| trap "rm -f ${metalog}" 1 2 15 EXIT | |||||
| echo "/set type=dir uname=${NANO_DEF_UNAME}" \ | |||||
| "gname=${NANO_DEF_GNAME} mode=0755" > "${metalog}" | |||||
| echo ". type=dir uname=${NANO_DEF_UNAME}" \ | |||||
| "gname=${NANO_DEF_GNAME} mode=0755" >> "${metalog}" | |||||
| ( | |||||
| cd "${dir}" | |||||
| mtree -bc -k flags,gid,gname,link,mode,uid,uname | | |||||
| mtree -C | tail -n +2 | | |||||
| sed 's/uid=[[:digit:]]*/uname=root/g' | | |||||
| sed 's/gid=[[:digit:]]*/gname=wheel/g' >> "${metalog}" | |||||
| ) | |||||
| fi | |||||
| nano_makefs "-DxZ ${NANO_MAKEFS}" "${metalog}" "${size}" "${fs}" "${dir}" | |||||
| fi | |||||
| ) | |||||
| populate_cfg_slice() { | populate_cfg_slice() { | ||||
| populate_slice "$1" "$2" "$3" "$4" | populate_slice "$1" "$2" "$3" "$4" | ||||
| } | } | ||||
| populate_data_slice() { | populate_data_slice() { | ||||
| populate_slice "$1" "$2" "$3" "$4" | populate_slice "$1" "$2" "$3" "$4" | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 307 Lines • Show Last 20 Lines | |||||