~ubuntu-branches/debian/stretch/grub2/stretch

« back to all changes in this revision

Viewing changes to util/grub-mkconfig.in

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-06-15 12:45:35 UTC
  • mto: (1.14.1 upstream) (17.3.18 experimental)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20100615124535-9vfbis4kzv0h5bgy
Tags: upstream-1.98+20100614
ImportĀ upstreamĀ versionĀ 1.98+20100614

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
sbindir=@sbindir@
24
24
libdir=@libdir@
25
25
sysconfdir=@sysconfdir@
26
 
package_version=@PACKAGE_VERSION@
 
26
PACKAGE_NAME=@PACKAGE_NAME@
 
27
PACKAGE_VERSION=@PACKAGE_VERSION@
27
28
host_os=@host_os@
28
29
datarootdir=@datarootdir@
29
30
datadir=@datadir@
31
32
grub_cfg=""
32
33
grub_mkconfig_dir=${sysconfdir}/grub.d
33
34
 
 
35
self=`basename $0`
 
36
 
34
37
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
35
38
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
36
39
 
38
41
# Print the usage.
39
42
usage () {
40
43
    cat <<EOF
41
 
Usage: $0 [OPTION]
 
44
Usage: $self [OPTION]
42
45
Generate a grub config file
43
46
 
44
47
  -o, --output=FILE       output generated config to FILE [default=stdout]
49
52
EOF
50
53
}
51
54
 
 
55
argument () {
 
56
  opt=$1
 
57
  shift
 
58
 
 
59
  if test $# -eq 0; then
 
60
      echo "$0: option requires an argument -- '$opt'" 1>&2
 
61
      exit 1
 
62
  fi
 
63
  echo $1
 
64
}
 
65
 
52
66
# Check the arguments.
53
 
next_grub_cfg=false
54
 
for option in "$@"; do
55
 
    if $next_grub_cfg; then
56
 
        grub_cfg=$option
57
 
        next_grub_cfg=false
58
 
        continue
59
 
    fi
 
67
while test $# -gt 0
 
68
do
 
69
    option=$1
 
70
    shift
 
71
 
60
72
    case "$option" in
61
73
    -h | --help)
62
74
        usage
63
75
        exit 0 ;;
64
76
    -v | --version)
65
 
        echo "$0 (GNU GRUB ${package_version})"
 
77
        echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
66
78
        exit 0 ;;
67
 
    -o)
68
 
        next_grub_cfg=:
69
 
        ;;
 
79
    -o | --output)
 
80
        grub_cfg=`argument $option "$@"`; shift;;
70
81
    --output=*)
71
82
        grub_cfg=`echo "$option" | sed 's/--output=//'`
72
83
        ;;
75
86
        usage
76
87
        exit 1
77
88
        ;;
 
89
    *)
 
90
        echo "Invalid parameter, $option" 1>&2
 
91
        exit 1
 
92
        ;;
78
93
    esac
79
94
done
80
 
if $next_grub_cfg; then
81
 
    echo "Missing argument to \`-o'" 1>&2
82
 
    usage
83
 
    exit 1
84
 
fi
85
95
 
86
96
. ${libdir}/grub/grub-mkconfig_lib
87
97
 
113
123
      done ;;
114
124
  esac
115
125
  if [ $root != t ] ; then
116
 
    echo "$0: You must run this as root" >&2
 
126
    echo "$self: You must run this as root" >&2
117
127
    exit 1
118
128
  fi
119
129
fi
284
294
#
285
295
# DO NOT EDIT THIS FILE
286
296
#
287
 
# It is automatically generated by $0 using templates
 
297
# It is automatically generated by $self using templates
288
298
# from ${grub_mkconfig_dir} and settings from ${sysconfdir}/default/grub
289
299
#
290
300
EOF