aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorLeah Rowe <info@minifree.org>2017-05-19 13:41:32 +0000
committerGogs <gogitservice@gmail.com>2017-05-19 13:41:32 +0000
commitb1d07d003be28ac649581f30bdb2dfb9bab7672a (patch)
treec5256bb42e77aa48ec2f955ee478b71a4ce9eecf /resources
parent0d6d379469fcc1f3f17f55a93e0b5bddc5a27f64 (diff)
parentf32844adeaa97662f2671ae4510054974a0cc90b (diff)
downloadlibrebootfr-b1d07d003be28ac649581f30bdb2dfb9bab7672a.tar.gz
librebootfr-b1d07d003be28ac649581f30bdb2dfb9bab7672a.zip
Merge branch 'master' of zyliwax/libreboot into master
Diffstat (limited to 'resources')
-rw-r--r--resources/scripts/misc/grubeditor.sh28
1 files changed, 24 insertions, 4 deletions
diff --git a/resources/scripts/misc/grubeditor.sh b/resources/scripts/misc/grubeditor.sh
index 832e0dc6..f6ccb728 100644
--- a/resources/scripts/misc/grubeditor.sh
+++ b/resources/scripts/misc/grubeditor.sh
@@ -45,6 +45,7 @@
#
# -D | --differ [/path/to/]differ: use /path/to/differ instead of "diff", can
# be an interactive program like vimdiff
+#
# THIS BLOCK IS EXPERIMENTAL
# Allow debugging by running DEBUG= ${0}.
@@ -53,6 +54,9 @@
# -e kills the script if any function returns not-zero
#set -u
+# Version number of script
+geversion="0.1.1"
+
# Define the list of available option in both short and long form.
shortopts="hrie:sdD:"
longopts="help,realcfg,inplace,editor:,swapcfgs,diffcfgs,differ:"
@@ -101,9 +105,14 @@ get_options() {
case "$1" in
-h|--help)
show_help
- # I return non-zero here just so nobody thinks we successfully edited grub.cfg
+ # I return non-zero here just so nobody thinks we successfully edited grub{,test}.cfg
exit 200
;;
+ -v|--version)
+ show_version
+ # I return non-zero here just so nobody thinks we successfully edited grub{,test}.cfg
+ exit 201
+ ;;
-r|--realcfg)
edit_realcfg=1
shift
@@ -307,6 +316,10 @@ existing file
HELPSCREEN
}
+show_version() {
+ echo "${geversion}"
+}
+
swap_configs() {
# Procedure:
# 1. Call cbfstool twice, once each to extract grub.cfg and grubtest.cfg.
@@ -356,12 +369,19 @@ diff_configs() {
# Determine the differ command to use.
find_differ
+ grubcfg="$(random_filer "grubcfg")"
+ testcfg="$(random_filer "testcfg")"
+
# Extract config files from provided romfile.
- "${cbfstool}" "${romfile}" extract -n grub.cfg -f /tmp/grub_tmpdiff.cfg
- "${cbfstool}" "${romfile}" extract -n grubtest.cfg -f /tmp/grubtest_tmpdiff.cfg
+ "${cbfstool}" "${romfile}" extract -n grub.cfg -f "${grubcfg}"
+ "${cbfstool}" "${romfile}" extract -n grubtest.cfg -f "${testcfg}"
# Run the differ command with real as first option, test as second option.
- "${use_differ}" /tmp/grub_tmpdiff.cfg /tmp/grubtest_tmpdiff.cfg
+ "${use_differ}" "${grubcfg}" "${testcfg}"
+
+ # Delete the temporary copies of the configuration files.
+ rm "${grubcfg}"
+ rm "${testcfg}"
}
edit_config() {