+ # XXX: If CONFIG_AUFS_ROBR is added to the Debian kernel we can
+ # ignore the loop below and set rofs_dest_backing=$dest
+ local rofs_dest_backing=""
+ if [ -n "${opt_linkfiles}"]
+ then
+ for d in ${rootmnt}/live/rofs/*
+ do
+ if [ -n "${rootmnt}" ]
+ then
+ rofs_dest_backing="${d}/$(echo ${dest} | sed -e "s|${rootmnt}||")"
+ else
+ rofs_dest_backing="${d}/${dest}"
+ fi
+ if [ -d "${rofs_dest_backing}" ]
+ then
+ break
+ else
+ rofs_dest_backing=""
+ fi
+ done
+ fi
+
+ if [ -n "${opt_linkfiles}" ] && [ -z "${PERSISTENT_READONLY}" ]
+ then
+ link_files ${source} ${dest} ${rootmnt}
+ elif [ -n "${opt_linkfiles}" ] && [ -n "${PERSISTENT_READONLY}" ]
+ then
+ mkdir -p ${rootmnt}/live/persistent
+ local links_source=$(mktemp -d ${rootmnt}/live/persistent/links-source-XXXXXX)
+ chown_ref ${source} ${links_source}
+ chmod_ref ${source} ${links_source}
+ # We put the cow dir in the below strange place to
+ # make it absolutely certain that the link source
+ # has its own directory and isn't nested with some
+ # other custom mount (if so that mount's files would
+ # be linked, causing breakage.