recipes: tde/tdelibs: reconfigured
[dragora.git] / stages / 2 / 04-iso
blobba4c7dfbe2f85a23d58b6d3b14ff7101687e9056
1 # Build script to compose the Live CD image.
3 # Copyright (c) 2017 MMPG.
4 # Copyright (c) 2017-2019 Matias Fonzo <selk@dragora.org>.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 #    http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # ISO file name
19 ISONAME="${ISONAME:-dragora-3.0_$(date +%Y%m%d)-${arch}}"
21 # Default mkisofs(8) invocation name
22 MKISOFS=mkisofs
24 # Perform sanity checks (requirements)
26 if ! test -e "${rootdir}/squashfs-tools_lzip/mksquashfs"
27 then
28     echo "Local \`${rootdir}/squashfs-tools_lzip/mksquashfs' does not exist." 1>&2
29     exit 2;
31 if ! type mkisofs > /dev/null
32 then
33     echo "" 1>&2
34     echo "\`mkisofs' is not found in your PATH." 1>&2
35     if type genisoimage > /dev/null
36     then
37         MKISOFS=genisoimage
38     else
39         echo "\`genisoimage' was not found in your PATH." 1>&2
40         echo "" 1>&2
41         echo "Please install one of these programs to make the ISO image." 1>&2
42         echo "" 1>&2
43         exit 2;
44     fi
47 # This depends on the existence of the stage 1
49 if test ! -d "${output}/stage1/usr/pkg"
50 then
51     echo "The stage number 1 does not exist or is incomplete." 1>&2
52     echo "Build (completely) the stage 1 before processing '$stage'." 1>&2
53     exit 1;
55 if test ! -f "${rootdir}/initrd/initrd.img"
56 then
57     echo "${rootdir}/initrd/initrd.img: No such initramfs file" 1>&2
58     exit 1;
61 STAGE1="${output}/stage1"
62 CDROM="${rootdir}/cdrom"
64 # Re-create CD tree
66 echo "Re-creating CD tree (${CDROM}) ..."
67 rm -rf -- "$CDROM"
68 mkdir -p -- "${CDROM}/isolinux"
70 # Copy kernel installation to isolinux/
72 cd -- "${STAGE1}/boot"
74 for file in System.map-* config-* vmlinuz-*
76     cp -p "${STAGE1}/boot/$file" "${CDROM}/isolinux/${file%%-*}"
77 done
78 unset file
80 # Copy local isolinux files and initramfs for ISOLINUX
82 cp -p "${worktree}"/archive/isolinux/* "${CDROM}/isolinux/"
83 rm -f "${CDROM}/isolinux/isohybrid.pl" \
84       "${CDROM}/isolinux/generate-keymap"
86 cp -p "${rootdir}/initrd/initrd.img" "${CDROM}/isolinux/"
88 # Produce compressed image using mksquashfs(1)
89 cd -- "$STAGE1"
90 rm -f ./dragora.sfs
92 "${rootdir}"/squashfs-tools_lzip/mksquashfs ./* "${CDROM}/dragora.sfs" \
93  -comp lzip -b 128K -Xcompression-level 0 -Xdict-size 100% \
94  -noappend -e ./tools ./var/cache/qi/packages ./root/.ash_history \
95   ./*-log* ./usr/pkg/kernel-buildtree-* ./usr/src/linux-* ./usr/src/qi
97 # Produce hybrid ISO-9660 image
99 cd -- "$CDROM"
101 rm -f ./${ISONAME}*
102 $MKISOFS -v -o ${ISONAME}.iso                                     \
103          -iso-level 3                                             \
104          -no-emul-boot -boot-load-size 4 -boot-info-table         \
105          -b "isolinux/isolinux.bin"                               \
106          -c "isolinux/boot.cat"                                   \
107          -V "Dragora Live ${arch}"                                \
108          .
109 unset MKISOFS
111 echo "Applying \"hybrid booting\" to the ISO image ..."
112 "${worktree}"/archive/isolinux/isohybrid.pl ${ISONAME}.iso
114 echo "Making .sha256 sum ..."
115 sha256sum ${ISONAME}.iso > ${ISONAME}.iso.sha256
117 echo "Finish ..."
118 echo ""
119 echo "***"
120 echo "The ISO image has been produced at"
121 echo "    ${CDROM}/${ISONAME}.iso"
122 echo "***"
123 echo ""
124 exit 0