#!/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 # # create-iso 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. _HELP=false _DIST="nodistro" _ARCH="amd64" while true; do case "$1" in -h | --help ) _HELP=true; shift ;; -d | --distro ) _DIST=$2; shift; shift ;; -a | --arch ) _ARCH=$2; shift; shift ;; -* ) echo "Unrecognized option. Try with --help."; exit 1 ;; * ) break ;; esac done if [ ${_HELP} = true ]; then echo "Usage: sudo $0 [OPTION] [ARGUMENT]..." echo "" echo "Examples:" echo " sudo $0 --distro le6/testing # Generate default arch (amd64) le6 iso image" echo " sudo $0 -d le6/testing -a i386 # Generate i386 architecture le6 iso image" echo "" echo "Options:" echo " -h, --help Show this help list" echo " -d, --distro [DIST] Select iso image's distro" echo " -a, --arch [amd64 | i386] Select iso image's architecture" exit 2 fi if [ ${_DIST} = "nodistro" ]; then echo "No distro. Try with --help." exit 1 fi if [ ${_ARCH} != "amd64" -a ${_ARCH} != "i386" ]; then echo "Unrecognized architecture. Try with --help." exit 1 fi if [ "$(id -u)" != "0" ]; then echo "You must have more power to run this script. Are you root?" exit -1 fi export PREFIX=$(pwd) source ${PREFIX}/conf/$_DIST/create-iso.conf \ || log ERROR "configuration file not found for dist: \"${_DIST}\"" source common.sh source lib/mktmpfs.sh source lib/overlay.sh sudo apt-get install syslinux squashfs-tools genisoimage xorriso \ || log ERROR "Failed to install basic tools: \"${_DIST}\"" mountTmpfs ${TMPFS} mountOverlay ${CHROOTDIR} ${TMPFS} mkdir -p ${TMP} 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} ${_ARCH} ${CHROOTDIR} ${CHROOTFILE} ${DISTRO} ${DPLIST} ${INSTLIST} ${ISOLINUX} ${MOUNTLIST} ${OURSOURCESLIST} ${RMDSKT} ${RMLIST} ${SCRIPTSDIR} ${SHORTNAME} ${SOURCESLISTDEFAULT} ${TMP} ${TMPFS} ${REPOPKGS}; 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 umountOverlay ${CHROOTDIR} ${TMPFS} umountTmpfs ${TMPFS} exit 0