* Included support for specifing a list of files/dirs to be explicitly
kept between reboots, enabled only for the "cpio" snapshot type.
Look at "/usr/share/doc/live-initramfs/examples/live-snapshot.list"
for hints.
cp -r COPYING docs/* $(DESTDIR)/usr/share/doc/live-initramfs
mkdir -p $(DESTDIR)/usr/share/doc/live-initramfs/examples
cp -r COPYING docs/* $(DESTDIR)/usr/share/doc/live-initramfs
mkdir -p $(DESTDIR)/usr/share/doc/live-initramfs/examples
- cp -r conf/live.conf $(DESTDIR)/usr/share/doc/live-initramfs/examples
+ cp -r conf/* $(DESTDIR)/usr/share/doc/live-initramfs/examples
# Installing manpages
set -e; for MANPAGE in manpages/*.en.1; \
# Installing manpages
set -e; for MANPAGE in manpages/*.en.1; \
# Permits multiple runs
MOUNTP="$(mktemp -d -p ${SAFE_TMPDIR} live-snapshot-mnt.XXXXXX)"
DEST="${MOUNTP}/live-sn.cpio.gz"
# Permits multiple runs
MOUNTP="$(mktemp -d -p ${SAFE_TMPDIR} live-snapshot-mnt.XXXXXX)"
DEST="${MOUNTP}/live-sn.cpio.gz"
+DEF_SNAP_COW="/live/cow"
+TMP_FILELIST="${PROGRAM}.list"
# Command line defaults and declarations
# Command line defaults and declarations
+SNAP_COW="${DEF_SNAP_COW}"
SNAP_DEV=""
SNAP_OUTPUT=""
SNAP_RESYNC_STRING=""
SNAP_TYPE="cpio"
SNAP_DEV=""
SNAP_OUTPUT=""
SNAP_RESYNC_STRING=""
SNAP_TYPE="cpio"
+SNAP_LIST="/etc/live-snapshot.list"
+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
+}
+
+ TMP_FILELIST=$(mktemp -p "${SAFE_TMPDIR}" "${TMP_FILELIST}.XXXXXX")
+
case "${SNAP_TYPE}" in
squashfs)
case "${SNAP_TYPE}" in
squashfs)
- EXCLUDE_LIST="$(mktemp -p ${SAFE_TMPDIR} live-snapshot-exclude-list.XXXXXX)"
- echo "./${EXCLUDE_LIST}" > "${EXCLUDE_LIST}"
+ echo ".${TMP_FILELIST}" > "${TMP_FILELIST}"
+ # Removing whiteheads of unionfs
- find . -name '*.wh.*' >> "${EXCLUDE_LIST}"
+ find . -name '*.wh.*' >> "${TMP_FILELIST}"
- mksquashfs "${SNAP_COW}" "${DEST}" -ef "${EXCLUDE_LIST}"
- rm -f "${EXCLUDE_LIST}"
+ mksquashfs "${SNAP_COW}" "${DEST}" -ef "${TMP_FILELIST}"
- ( cd "${SNAP_COW}" && find . -path '*.wh.*' -prune -o -print0 | cpio --quiet -o0 -H newc | gzip -9c > "${DEST}" ) || exit 1
+ WORKING_DIR=$(Do_filelist "${TMP_FILELIST}")
+ cd "${WORKING_DIR}"
+ cat "${TMP_FILELIST}" | cpio --quiet -o0 -H newc | gzip -9c > "${DEST}" || exit 1
+ cd "${OLDPWD}"
mkfs.jffs2 --root="${SNAP_COW}" --output="${DEST}"
;;
esac
mkfs.jffs2 --root="${SNAP_COW}" --output="${DEST}"
;;
esac
+
+ if [ -f "${TMP_FILELIST}" ]
+ then
+ rm -f "${TMP_FILELIST}"
+ fi
--- /dev/null
+# /etc/live-snapshot resync list example
+#
+# If this file is present, each uncommented not empty line will be parsed when
+# running live-snapshot and included in target snapshot.
+#
+# The syntax for the line is just a full file or directory pathname.
+# Those files and directories, and only those will be included on automatic persistence handling.
+
+# Include itself for reuse
+/etc/live-snapshot.list
+
+# Include networking setups
+/etc/network/interfaces
+/etc/resolv.conf
+/etc/hosts
+
+# Include the whole Desktop directory of the default user
+/home/user/Desktop
output version information and exit
output version information and exit
+Files
+-----
+
+ /etc/live-snapshot.list
+
+This optional file, if present changes the behaviour of live-snapshot, only files and directories listed there are included (integrally) in the snapshot.
+Beware, it is an experimental feature that only works for cpio targets now.
+
da informazioni sulla versione ed esce
da informazioni sulla versione ed esce
+Files
+-----
+
+ /etc/live-snapshot.list
+
+Facoltativo, se presente cambia completamente il funzionamento di live-snapshot; solo i files e le directory elencate verranno effettivamente inclusi nello snapshot.
+Attenzione, e` una funzionalita` sperimentale che funziona attualmente solo con gli snapshot di tipo "cpio".
+
+
fi
else
# cpio.gz snapshot
fi
else
# cpio.gz snapshot
- if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio -i -u -d 2>/dev/null)
+ if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories > /dev/null 2>&1)
then
log_warning_msg "Impossible to include the ${snapfile} Snapshot"
return 1
then
log_warning_msg "Impossible to include the ${snapfile} Snapshot"
return 1