~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to util/powerpc/ieee1275/grub-mkrescue.in

Tags: upstream-1.99~20101122
ImportĀ upstreamĀ versionĀ 1.99~20101122

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh -e
 
1
#! /bin/sh
 
2
set -e
2
3
 
3
4
# Make GRUB rescue image
4
5
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
30
31
platform=@platform@
31
32
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
32
33
 
33
 
grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
 
34
self=`basename $0`
 
35
 
 
36
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
34
37
 
35
38
# Usage: usage
36
39
# Print the usage.
37
40
usage () {
38
41
    cat <<EOF
39
 
Usage: grub-mkrescue [OPTION] output_image
 
42
Usage: $self [OPTION] output_image
40
43
Make GRUB rescue image.
41
44
 
42
45
  -h, --help              print this message and exit
46
49
                          default: ${pkglibdir}
47
50
  --grub-mkimage=FILE     use FILE as grub-mkimage
48
51
 
49
 
grub-mkimage generates a bootable rescue CD image for PowerMac and CHRP.
 
52
$self generates a bootable rescue CD image for PowerMac and CHRP.
50
53
 
51
54
Report bugs to <bug-grub@gnu.org>.
52
55
EOF
53
56
}
54
57
 
 
58
argument () {
 
59
  opt=$1
 
60
  shift
 
61
 
 
62
  if test $# -eq 0; then
 
63
      echo "$0: option requires an argument -- '$opt'" 1>&2
 
64
      exit 1
 
65
  fi
 
66
  echo $1
 
67
}
 
68
 
55
69
input_dir=${pkglibdir}
56
70
 
57
71
# Check the arguments.
58
 
for option in "$@"; do
 
72
while test $# -gt 0
 
73
do
 
74
    option=$1
 
75
    shift
 
76
 
59
77
    case "$option" in
60
78
    -h | --help)
61
79
        usage
62
80
        exit 0 ;;
63
81
    -v | --version)
64
 
        echo "grub-mkrescue (GNU GRUB ${PACKAGE_VERSION})"
 
82
        echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
65
83
        exit 0 ;;
 
84
 
 
85
    --modules)
 
86
        modules=`argument $option "$@"`; shift ;;
66
87
    --modules=*)
67
88
        modules=`echo "$option" | sed 's/--modules=//'` ;;
 
89
 
 
90
    --pkglibdir)
 
91
        input_dir=`argument $option "$@"`; shift ;;
68
92
    --pkglibdir=*)
69
93
        input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
 
94
 
 
95
    --grub-mkimage)
 
96
        grub_mkimage=`argument $option "$@"`; shift ;;
70
97
    --grub-mkimage=*)
71
98
        grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
 
99
 
72
100
    -*)
73
101
        echo "Unrecognized option \`$option'" 1>&2
74
102
        usage
93
121
  modules=`cd ${input_dir}/ && ls *.mod`
94
122
fi
95
123
 
96
 
map_file=`mktemp`
 
124
map_file=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
97
125
cat >${map_file} <<EOF
98
126
# EXTN          XLate   CREATOR   TYPE     Comment
99
127
grub.img        Raw     'UNIX'    'tbxi'   "bootstrap"
100
128
EOF
101
129
 
102
 
iso_dir=`mktemp -d`
 
130
iso_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
103
131
boot_dir=${iso_dir}/boot/grub
104
132
mkdir ${iso_dir}/boot
105
133
mkdir ${boot_dir}
106
134
core_img=${boot_dir}/grub.img
107
 
${grub_mkimage} -n -d ${input_dir}/ -o ${core_img} ${modules}
 
135
${grub_mkimage} -O powerpc-ieee1275 -n -d ${input_dir}/ -o ${core_img} ${modules}
108
136
genisoimage -hfs -part -no-desktop -r -J -o ${output_image} \
109
137
 -map ${map_file} -hfs-bless ${boot_dir} -chrp-boot -sysid PPC \
110
138
 ${iso_dir}