append to the live filesystem the files in live path subdirectories, according to network cards MAC, hostname and ip addresses
diff -Naur initrd-110-7-orig.txt/scripts/live initrd.txt/scripts/live --- initrd-110-7-orig.txt/scripts/live 2007-11-19 10:58:26.000000000 +0100 +++ initrd.txt/scripts/live 2007-11-19 12:32:24.000000000 +0100 @@ -505,9 +599,8 @@ mount_images_in_directory () { - directory="${1}" - rootmnt="${2}" - mac="${3}" + local directory="${1}" + local rootmnt="${2}" if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" || @@ -515,8 +608,7 @@ match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" || match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir" then - [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}" - setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}" + setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" else : fi @@ -870,9 +962,13 @@ setup_unionfs () { - image_directory="${1}" - rootmnt="${2}" - addimage_directory="${3}" + local image_directory="${1}" + local rootmnt="${2}" + local mac=$(get_mac) + local addresses=$(get_ipaddresses) + local ropt image imagename image_string IMAGE FILESYSTEM address addimage_directory + local rofsstring cowprobe d + modprobe -q -b ${UNIONTYPE} # run-init can't deal with images in a subdir, but we're going to @@ -921,22 +1017,27 @@ done done - if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ] - then - for FILESYSTEM in squashfs ext2 ext3 xfs dir - do - for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}" - do - if [ -e "${IMAGE}" ] - then - image_string="${image_string} ${IMAGE}" - fi - done - done - fi - # Now sort the list image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )" + + for address in ${mac} ${HOSTNAME} ${addresses} + do + address="$( echo ${address} | sed 's/-//g' )" + addimage_directory="${image_directory}/${address}" + if [ -n "${addimage_directory}" -a -d "${addimage_directory}" ] + then + for FILESYSTEM in squashfs ext2 ext3 xfs dir + do + for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}" + do + if [ -e "${IMAGE}" ] + then + image_string="${image_string} ${IMAGE}" + fi + done + done + fi + done fi [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})" diff -Naur initrd-110-7-orig.txt/scripts/live-helpers initrd.txt/scripts/live-helpers --- initrd-110-7-orig.txt/scripts/live-helpers 2007-11-19 10:58:26.000000000 +0100 +++ initrd.txt/scripts/live-helpers 2007-11-19 12:34:54.000000000 +0100 @@ -287,22 +297,63 @@ fi done done } + +get_ipaddresses () +{ + echo $(ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{print $1}') } get_mac () { - mac="" + local mac="" + local address adaptor for adaptor in /sys/class/net/* do status="$(cat ${adaptor}/iflink)" - - if [ "${status}" -eq 2 ] + if [ ${status} -ge 2 ] then - mac="$(cat ${adaptor}/address)" - mac="$(echo ${mac} | sed 's/:/-/g' | tr '[a-z]' '[A-Z]')" + address=$(cat ${adaptor}/address) + log_warning_msg "Network card address ${address}" + mac=$(echo "${mac}${address} ") fi done - - echo ${mac} + echo ${mac} | sed 's/:/-/g' | tr '[a-z]' '[A-Z]' }
_______________________________________________ debian-live-devel mailing list debian-live-devel@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel