projects
/
live-boot-grml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
live-snapshot: nicer default auto unmount logic.
[live-boot-grml.git]
/
bin
/
live-snapshot
diff --git
a/bin/live-snapshot
b/bin/live-snapshot
index
b523c4a
..
5837f5d
100755
(executable)
--- a/
bin/live-snapshot
+++ b/
bin/live-snapshot
@@
-42,6
+42,7
@@
SAFE_TMPDIR="/live"
MOUNTP="$(mktemp -d -p ${SAFE_TMPDIR} live-snapshot-mnt.XXXXXX)"
SNAP_COW="/live/cow"
SNAP_DEV=""
MOUNTP="$(mktemp -d -p ${SAFE_TMPDIR} live-snapshot-mnt.XXXXXX)"
SNAP_COW="/live/cow"
SNAP_DEV=""
+SNAP_OUTPUT=""
DEST="${MOUNTP}/live-sn.cpio.gz"
SNAP_TYPE="cpio"
DESKTOP_LINK="/home/${USERNAME}/Desktop/live-snapshot"
DEST="${MOUNTP}/live-sn.cpio.gz"
SNAP_TYPE="cpio"
DESKTOP_LINK="/home/${USERNAME}/Desktop/live-snapshot"
@@
-125,19
+126,6
@@
Version ()
exit 0
}
exit 0
}
-Is_same_mount ()
-{
- dir1="$(Base_path ${1})"
- dir2="$(Base_path ${2})"
-
- if [ "${dir1}" = "${dir2}" ]
- then
- return 0
- else
- return 1
- fi
-}
-
Parse_args ()
{
# Parse command line
Parse_args ()
{
# Parse command line
@@
-228,7
+216,8
@@
Defaults ()
Error "unrecognized resync string"
;;
esac
Error "unrecognized resync string"
;;
esac
- else
+ elif [ -z "${SNAP_OUTPUT}" ]
+ then
# Set target file based on image
case "${SNAP_TYPE}" in
cpio)
# Set target file based on image
case "${SNAP_TYPE}" in
cpio)
@@
-243,6
+232,8
@@
Defaults ()
DEST="${MOUNTP}/live-sn.ext2"
;;
esac
DEST="${MOUNTP}/live-sn.ext2"
;;
esac
+ else
+ DEST="${SNAP_OUTPUT}"
fi
}
fi
}
@@
-270,8
+261,6
@@
Validate_input ()
Mount_device ()
{
Mount_device ()
{
- mkdir -p "${MOUNTP}"
-
case "${SNAP_DEV}" in
"")
# create a temp
case "${SNAP_DEV}" in
"")
# create a temp
@@
-318,7
+307,7
@@
Do_snapshot ()
Clean ()
{
Clean ()
{
- if echo "${DEST}" | grep -q "${MOUNTP}"
+ if
[ -z "${SNAP_RESYNC_STRING}" ] &&
echo "${DEST}" | grep -q "${MOUNTP}"
then
echo "${DEST} is present on ${MOUNTP}, therefore no automatic unmounting the latter." > /dev/null 1>&2
else
then
echo "${DEST} is present on ${MOUNTP}, therefore no automatic unmounting the latter." > /dev/null 1>&2
else