mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-01-24 02:22:15 +08:00
08895fc72d
This reverts commit 57618a09cf
.
48 lines
1.6 KiB
Diff
48 lines
1.6 KiB
Diff
--- burg-mkconfig~ 2011-05-23 15:40:01.000000000 +0200
|
|
+++ burg-mkconfig 2011-05-23 15:40:01.000000000 +0200
|
|
@@ -29,6 +29,7 @@ datarootdir=${prefix}/share
|
|
datadir=${datarootdir}
|
|
pkgdatadir=${datadir}/`echo burg | sed "${transform}"`
|
|
grub_cfg=""
|
|
+resume_hook=1
|
|
grub_mkconfig_dir=${sysconfdir}/burg.d
|
|
|
|
grub_mkdevicemap=${sbindir}/`echo burg-mkdevicemap | sed ${transform}`
|
|
@@ -44,6 +45,7 @@ Generate a grub config file
|
|
-o, --output=FILE output generated config to FILE [default=stdout]
|
|
-h, --help print this message and exit
|
|
-v, --version print the version information and exit
|
|
+ -s, --skip-resume disable resume hook setup
|
|
|
|
Report bugs to <bug-grub@gnu.org>.
|
|
EOF
|
|
@@ -65,6 +67,9 @@ for option in "$@"; do
|
|
--output=*)
|
|
grub_cfg=`echo "$option" | sed 's/--output=//'`
|
|
;;
|
|
+ -s | --skip-resume)
|
|
+ resume_hook=0
|
|
+ ;;
|
|
-*)
|
|
echo "Unrecognized option \`$option'" 1>&2
|
|
usage
|
|
@@ -305,6 +310,18 @@ for i in ${grub_mkconfig_dir}/* ; do
|
|
esac
|
|
done
|
|
|
|
+if [ "${resume_hook}" == 1 ]; then
|
|
+ echo "Setup resume hook" >&2
|
|
+ SWAP=`swapon -a | cat /proc/swaps | grep /dev | cut -d" " -f1`
|
|
+ if [ -z "${SWAP}" ]; then
|
|
+ echo "No swap partition found. Create one to enable hibernation..." >&2
|
|
+ else
|
|
+ echo "Adding swap partition $SWAP" >&2
|
|
+ SWAPUUID=`blkid $SWAP -s UUID -o value`
|
|
+ sed -i -e "s~root=/dev~resume=/dev/disk/by-uuid/${SWAPUUID} root=/dev~g" ${grub_cfg}.new
|
|
+ fi
|
|
+fi
|
|
+
|
|
if test "x${grub_cfg}" != "x" ; then
|
|
# none of the children aborted with error, install the new grub.cfg
|
|
mv -f ${grub_cfg}.new ${grub_cfg}
|