source: live-build/trunk/fuentes/scripts/build/lb_binary_iso @ 900

Last change on this file since 900 was 900, checked in by kbut, 3 years ago

add original source

  • Property svn:executable set to *
File size: 5.3 KB
Line 
1#!/bin/sh
2
3## live-build(7) - System Build Scripts
4## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
5##
6## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7## This is free software, and you are welcome to redistribute it
8## under certain conditions; see COPYING for details.
9
10
11set -e
12
13# Including common functions
14( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
15
16# Setting static variables
17DESCRIPTION="$(Echo 'build iso binary image')"
18HELP=""
19USAGE="${PROGRAM} [--force]"
20
21Arguments "${@}"
22
23# Reading configuration files
24Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25Set_defaults
26
27case "${LB_BINARY_IMAGES}" in
28        iso)
29                IMAGE="binary.iso"
30                ;;
31
32        iso-hybrid)
33                IMAGE="binary.hybrid.iso"
34                ;;
35
36        *)
37                exit 0
38                ;;
39esac
40
41Echo_message "Begin building binary iso image..."
42
43# Requiring stage file
44Require_stagefile .build/config .build/bootstrap
45
46# Checking stage file
47Check_stagefile .build/binary_iso
48
49# Checking lock file
50Check_lockfile .lock
51
52# Creating lock file
53Create_lockfile .lock
54
55# Checking depends
56Check_package chroot/usr/bin/genisoimage genisoimage
57
58if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ]
59then
60        Check_package chroot/usr/bin/isohybrid syslinux
61fi
62
63# Restoring cache
64Restore_cache cache/packages.binary
65
66# Installing depends
67Install_package
68
69# Remove old iso image
70if [ -f ${IMAGE} ]
71then
72        rm -f ${IMAGE}
73fi
74
75# Handle genisoimage generic options
76GENISOIMAGE_OPTIONS="-J -l -cache-inodes -allow-multidot"
77
78# Handle genisoimage live-build specific options
79if [ "${_QUIET}" = "true" ]
80then
81        GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet"
82fi
83
84if [ "${_VERBOSE}" = "true" ]
85then
86        GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v"
87fi
88
89if [ -n "${LB_ISO_APPLICATION}" ] && [ "${LB_ISO_APPLICATION}" != "none" ]
90then
91        GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LB_ISO_APPLICATION}\""
92fi
93
94if [ -n "${LB_ISO_PREPARER}" ] && [ "${LB_ISO_PREPARER}" != "none" ]
95then
96        GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LB_ISO_PREPARER}\""
97fi
98
99if [ -n "${LB_ISO_PUBLISHER}" ] && [ "${LB_ISO_PUBLISHER}" != "none" ]
100then
101        GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LB_ISO_PUBLISHER}\""
102fi
103
104if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ]
105then
106        GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LB_ISO_VOLUME}\""
107fi
108
109# Handle genisoimage architecture specific options
110case "${LB_BOOTLOADER}" in
111        grub)
112                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
113                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/stage2_eltorito"
114                GENISOIMAGE_EXCLUDE="boot/grub/stage2_eltorito"
115                ;;
116
117        grub2)
118                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
119                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/grub_eltorito -J"
120                GENISOIMAGE_EXCLUDE="boot/grub/grub_eltorito"
121                ;;
122
123        silo)
124                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -G boot/isofs.b -B ..."
125                GENISOIMAGE_EXCLUDE="boot/isofs.b"
126                ;;
127
128        syslinux)
129                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
130                case "${LB_MODE}" in
131                        progress)
132                                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/boot.bin -c boot/boot.cat"
133                                GENISOIMAGE_EXCLUDE="boot/boot.bin"
134                                ;;
135
136                        *)
137                                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b isolinux/isolinux.bin -c isolinux/boot.cat"
138                                GENISOIMAGE_EXCLUDE="isolinux/isolinux.bin"
139                                ;;
140                esac
141                ;;
142
143        yaboot)
144                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r --iso-level 2 --netatalk -hfs -probe -map"
145                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} binary/yaboot/hfs.map --chrp-boot -part -no-desktop"
146                GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -hfs-bless binary/yaboot -hfs-volid Debian/Live_powerpc"
147                GENISOIMAGE_EXCLUDE="yaboot/hfs.map"
148                ;;
149
150        *)
151                Echo_warning "Bootloader on your architecture not yet supported by live-build."
152                Echo_warning "This will produce a most likely not bootable image (Continuing in 5 seconds)."
153                sleep 5
154                ;;
155esac
156
157#if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
158#then
159#       GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}"
160#fi
161
162if [ "${LB_BOOTLOADER}" = "grub2" ]
163then
164
165cat > binary.sh << EOF
166#!/bin/sh
167
168input_dir=/usr/lib/grub/i386-pc
169
170# build core.img
171core_img=\$(mktemp)
172grub-mkimage -d \${input_dir} -o \${core_img} -O i386-pc biosdisk iso9660
173
174# build grub_eltorito image
175cat \${input_dir}/cdboot.img \${core_img} > binary/boot/grub/grub_eltorito
176
177rm -f \${core_img}
178
179for file in \${input_dir}/*.mod \${input_dir}/efiemu??.o \
180        \${input_dir}/command.lst \${input_dir}/moddep.lst \${input_dir}/fs.lst \
181        \${input_dir}/handler.lst \${input_dir}/parttool.lst
182do
183        if test -f "\$file"
184        then
185                cp -f "\$file" binary/boot/grub
186        fi
187done
188EOF
189
190else
191        echo "#!/bin/sh" > binary.sh
192fi
193
194cat >> binary.sh << EOF
195
196genisoimage ${GENISOIMAGE_OPTIONS} -o ${IMAGE} binary
197EOF
198
199if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ]
200then
201
202cat >> binary.sh << EOF
203
204isohybrid ${ISOHYBRID_OPTIONS} ${IMAGE}
205EOF
206
207fi
208
209case "${LB_BUILD_WITH_CHROOT}" in
210        true)
211                # Moving image
212                mv binary.sh chroot
213                mv binary chroot
214
215                Chroot chroot "sh binary.sh"
216
217                # Move image
218                mv chroot/binary chroot/${IMAGE} ./
219                rm -f chroot/binary.sh
220                ;;
221
222        false)
223                sh binary.sh
224                rm -f binary.sh
225                ;;
226esac
227
228# Saving cache
229Save_cache cache/packages.binary
230
231# Removing depends
232Remove_package
233
234# Creating stage file
235Create_stagefile .build/binary_iso
Note: See TracBrowser for help on using the repository browser.