summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/local-premount/resume33
1 files changed, 30 insertions, 3 deletions
diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume
index 6bf95e5..b2b0e1d 100755
--- a/scripts/local-premount/resume
+++ b/scripts/local-premount/resume
@@ -20,10 +20,37 @@ if [ -z "${resume}" ]; then
fi
case $resume in
- LABEL=*)
- resume="/dev/disk/by-label/${resume#LABEL=}"
+LABEL=*)
+ resume="${resume#LABEL=}"
+
+ # support any / in LABEL= path (escape to \x2f)
+ case "${resume}" in
+ *[/]*)
+ if [ -x "$(command -v sed)" ]; then
+ resume="$(echo ${resume} | sed 's,/,\\x2f,g')"
+ else
+ if [ "${resume}" != "${resume#/}" ]; then
+ resume="\x2f${resume#/}"
+ fi
+ if [ "${resume}" != "${resume%/}" ]; then
+ resume="${resume%/}\x2f"
+ fi
+ IFS='/'
+ newresume=
+ for s in $resume; do
+ if [ -z "${newresume}" ]; then
+ newresume="${s}"
+ else
+ newresume="${newresume}\\x2f${s}"
+ fi
+ done
+ unset IFS
+ resume="${newresume}"
+ fi
+ esac
+ resume="/dev/disk/by-label/${resume}"
;;
- UUID=*)
+UUID=*)
resume="/dev/disk/by-uuid/${resume#UUID=}"
;;
esac