initrd.scripts: move swsusp code to 00-suspend.sh

master
Fabio Erculiani 11 years ago
parent 55c809c090
commit 8dcf20f4b5

@ -0,0 +1,29 @@
#!/bin/sh
resume_init() {
if [ -z "${REAL_RESUME}" ]; then
return 0
fi
if [ "${NORESUME}" = "1" ]; then
return 0
fi
local resume_dev=$(find_real_device "${REAL_RESUME}")
if [ -n "${resume_dev}" ]; then
REAL_RESUME="${resume_dev}"
good_msg "Detected real_resume=${resume_dev}"
else
bad_msg "Cannot resolve real_resume=${REAL_RESUME}"
bad_msg "Something bad may happen, crossing fingers"
fi
swsusp_resume
}
swsusp_resume() {
# determine swap resume partition
local device=$(ls -lL "${REAL_RESUME}" | sed 's/\ */ /g' | \
cut -d \ -f 5-6 | sed 's/,\ */:/')
[ -f /sys/power/resume -a -n "${device}" ] && \
echo "${device}" > /sys/power/resume
}

@ -11,6 +11,7 @@
. /etc/initrd.d/00-nfs.sh . /etc/initrd.d/00-nfs.sh
. /etc/initrd.d/00-keymaps.sh . /etc/initrd.d/00-keymaps.sh
. /etc/initrd.d/00-crypt.sh . /etc/initrd.d/00-crypt.sh
. /etc/initrd.d/00-suspend.sh
real_root_init() { real_root_init() {
@ -84,34 +85,6 @@ start_iscsi() {
fi fi
} }
resume_init() {
if [ -z "${REAL_RESUME}" ]; then
return 0
fi
if [ "${NORESUME}" = "1" ]; then
return 0
fi
local resume_dev=$(find_real_device "${REAL_RESUME}")
if [ -n "${resume_dev}" ]; then
REAL_RESUME="${resume_dev}"
good_msg "Detected real_resume=${resume_dev}"
else
bad_msg "Cannot resolve real_resume=${REAL_RESUME}"
bad_msg "Something bad may happen, crossing fingers"
fi
swsusp_resume
}
swsusp_resume() {
# determine swap resume partition
local device=$(ls -lL "${REAL_RESUME}" | sed 's/\ */ /g' | \
cut -d \ -f 5-6 | sed 's/,\ */:/')
[ -f /sys/power/resume -a -n "${device}" ] && \
echo "${device}" > /sys/power/resume
}
getdvhoff() { getdvhoff() {
echo $(( $(hexdump -n 4 -s $((316 + 12 * $2)) -e '"%i"' $1) * 512)) echo $(( $(hexdump -n 4 -s $((316 + 12 * $2)) -e '"%i"' $1) * 512))
} }

Loading…
Cancel
Save