+Do_filelist ()
+{
+ # BUGS: supports only cpio.gz types right now
+ TMP_FILELIST=$1
+ if [ -f "${SNAP_LIST}" ]
+ then
+ # Generate include list
+ for entry in $(cat "${SNAP_LIST}" | grep -v '^#.*$' | grep -v '^ *$')
+ do
+ if [ -f "${entry}" ]
+ then
+ printf "%s\000" "${entry}" >> "${TMP_FILELIST}"
+ elif [ -d "${entry}" ]
+ then
+ cd /
+ find "${entry}" -print0 >> "${TMP_FILELIST}"
+ cd "${OLDPWD}"
+ fi
+ done
+
+ if [ "${SNAP_COW}" = "${DEF_SNAP_COW}" ]
+ then
+ # Relative to rootfs
+ echo "/"
+ else
+ # Mostly "/home"
+ echo "${SNAP_COW}"
+ fi
+ else
+ cd "${SNAP_COW}"
+ find . -path '*.wh.*' -prune -o -print0 >> "${TMP_FILELIST}"
+ cd "${OLDPWD}"
+ echo "${SNAP_COW}"
+ fi
+}
+