summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMarco Amadori <marco.amadori@gmail.com>2008-05-31 00:18:32 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 17:47:59 +0100
commit4285c224d7d2ad14b0aefa028c540e31a1e56f3c (patch)
tree5c9e0debbb5e2447829f52c0950a3336d6b267c3 /bin
parent8e528a99632ef0ae43826dd7a487c4a0c12010a6 (diff)
downloadlive-boot-4285c224d7d2ad14b0aefa028c540e31a1e56f3c.tar.gz
live-boot-4285c224d7d2ad14b0aefa028c540e31a1e56f3c.zip
Fixes "live-snapshot on reboot could not find a writable '/tmp' or '/mnt'" bug.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/live-snapshot19
1 files changed, 13 insertions, 6 deletions
diff --git a/bin/live-snapshot b/bin/live-snapshot
index c50bcc0..b5a7fa4 100755
--- a/bin/live-snapshot
+++ b/bin/live-snapshot
@@ -2,7 +2,7 @@
# live-snapshot - utility to manage Debian Live systems snapshots
#
-# This program mount a device (fallback to /tmpfs under /mnt/snapshot
+# This program mount a device (fallback to /tmpfs under $MOUNTP
# and save the /live/cow (or a different dir) filesystem in it for reusing
# in another live-initramfs session. Look at manpage for more info.
#
@@ -36,7 +36,11 @@ export USERNAME USERFULLNAME HOSTNAME
PROGRAM="$(basename $0)"
VERSION=0.0.2
-MOUNTP="/mnt/live-snapshot"
+# Needs to be available at run and reboot time
+SAFE_TMPDIR="/live"
+
+# Permits multiple runs
+MOUNTP="$(mktemp -d -p ${SAFE_TMPDIR} live-snapshot-mnt.XXXXXX)"
SNAP_COW="/live/cow"
SNAP_DEV=""
DEST="${MOUNTP}/live-sn.cpio.gz"
@@ -289,10 +293,13 @@ Do_snapshot ()
{
case "${SNAP_TYPE}" in
squashfs)
- echo "./tmp/exclude_list" > /tmp/exclude_list
- ( cd "${SNAP_COW}" && find . -name '*.wh.*' >> /tmp/exclude_list )
- mksquashfs "${SNAP_COW}" "${DEST}" -ef /tmp/exclude_list
- rm /tmp/exclude_list
+ EXCLUDE_LIST="$(mktemp -p ${SAFE_TMPDIR} live-snapshot-exclude-list.XXXXXX)"
+ echo "./${EXCLUDE_LIST}" > "${EXCLUDE_LIST}"
+ cd "${SNAP_COW}"
+ find . -name '*.wh.*' >> "${EXCLUDE_LIST}"
+ cd "${OLDPWD}"
+ mksquashfs "${SNAP_COW}" "${DEST}" -ef "${EXCLUDE_LIST}"
+ rm -f "${EXCLUDE_LIST}"
;;
cpio)