Live Scan Grub Menu
lsgm.rwx.work
1function env {
2 action="${1}"
3 setparams \
4 'check_squashfs' \
5 'live_from' \
6 'pause' \
7 'time_out'
8 if [ "${action}" == 'load' ] ; then
9 load_env \
10 --file "${env}" \
11 --skip-sig \
12 "${@}"
13 fi
14 if [ "${action}" == 'save' ] ; then
15 save_env \
16 --file "${env}" \
17 "${@}"
18 fi
19 if [ "${action}" == 'set' ] ; then
20 load_env \
21 "${@}"
22 fi
23 unset action
24}
25
26function env_apply {
27 if [ "${default}" ] ; then
28 timeout=${time_out}
29 else
30 unset timeout
31 fi
32}
33
34function env_get {
35 unset get
36 if [ "${1}" == 'check_squashfs' ] ; then get="${check_squashfs}" ; fi
37 if [ "${1}" == 'live_from' ] ; then get="${live_from}" ; fi
38 if [ "${1}" == 'pause' ] ; then get="${pause}" ; fi
39 if [ "${1}" == 'time_out' ] ; then get="${time_out}" ; fi
40 if [ ! "${get}" ] ; then false ; fi
41}
42
43function env_init {
44 grub_init
45 sys_set
46 env set
47 env_mod
48 env load
49 env_apply
50}
51
52function env_list {
53 list_env \
54 --skip-sig \
55 --file "${env}"
56}
57
58function env_mod {
59 env_mod='---'
60 if [ -f "${env}" ] ; then
61 env_mod='--x'
62 if env 'load' ; then
63 env_mod='r-x'
64 if env 'save' ; then
65 env_mod='rwx'
66 fi
67 fi
68 fi
69}