create-iso.sh 2.62 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
#
# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of create-iso
#
# le6-conf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.

set -x

if [ "$(id -u)" != "0" ]; then
    echo You must have more power to run this script
    exit -1
fi
if [ $# -ne 1 ]; then
    echo "Usage: $0 [dist]"
    exit 1
fi
if [ "$1"  == '--help' ]; then
    echo "Usage: $0 [dist]"
    exit 2
fi

_DIST=$1

export PREFIX=$(pwd)
source "${PREFIX}/conf/$_DIST/create-iso.conf" \
|| log ERROR "configuration file not found for dist: \"${_DIST}\""

source common.sh

TIME_STAMP="`date +'%Y-%m-%dT%H:%M:%S'`"
LOG_FILE="${LOG_PATH}/create-iso-${TIME_STAMP}.log"

mkdir -p ${TMP}

sudo apt-get install syslinux squashfs-tools genisoimage xorriso \
|| log ERROR "Failed to install basic tools: \"${_DIST}\""

for file in $(ls ${SCRIPTSDIR}); do
    if [ -x "${SCRIPTSDIR}/${file}" ] && egrep -q '^[0-9]{2}-[a-z-]+' <<< "$file"; then
        echo "$file"
        if ! "${SCRIPTSDIR}/${file}"\
             ${_DIST} \
             ${CHROOTDIR} \
             ${CHROOTFILE} \
             ${DISTRO} \
             ${DPLIST} \
             ${INSTLIST} \
             ${ISOLINUX} \
             ${MOUNTLIST} \
             ${OURSOURCESLIST} \
             ${RMDSKT} \
             ${RMLIST} \
             ${SCRIPTSDIR} \
             ${SHORTNAME} \
             ${SOURCESLISTDEFAULT} \
             ${TMP} \
             ${LOG_FILE}; then
            log ERROR "While running \"${SCRIPTSDIR}/${file}\""
        fi
    fi
done

NAME="LinuxEducacional6-$(echo ${_DIST} | cut -d'/' -f2).iso"

cd ${TMP}/image
sudo xorriso -as mkisofs -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 -no-emul-boot -isohybrid-gpt-basdat -o ${PREFIX}/iso/${_DIST}/${NAME} \
     . ||\
     log ERROR "Failed to generate iso image."
cd -

cleanTmpFiles

exit 0