source: lliurex-maker/trunk/fuentes/new/usr/share/lliurex-maker/auto/lliurexbuildiso

Last change on this file was 1410, checked in by kbut, 4 years ago

build repository

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