...
 
Commits (4)
chroot
overlay
kernel
*.swp
iso/**/*.iso
src/preseed/.preseed.bkp
initrd
cache/*
iso/*
initrd/*
initrd.lz
chroot*.tar.gz
packages-needed
base
todos.txt
vmlinuz-*-generic
initrd.img-*-generic
.Trash-1000
\ No newline at end of file
......@@ -18,5 +18,6 @@ echo -e "$files"| xargs shellcheck -s bash && \
echo "AWESOME! No problems found." ; \
exit 0
#else
echo -e "Understand errors in: ${BLUE}https://github.com/koalaman/shellcheck/wiki${NC}"
echo -e "Understand errors in: \
${BLUE}https://github.com/koalaman/shellcheck/wiki${NC}"
exit 1
{
// sulzbach:
"editor.rulers": [80],
"editor.fontSize": 16
}
\ No newline at end of file
#!/bin/bash
# shellcheck disable=SC1090
#
# 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.
initChroot() {
local chrootdir="${1}"
local chrootdir="$1"
# Create the log file; this file will be bind to appear in "${VARLOG}"
# directory in the target machine that generates the iso.
......@@ -31,7 +51,7 @@ initChroot() {
}
closeChroot() {
local chrootdir="${1}"
local chrootdir="$1"
umount --lazy "${chrootdir}/etc/resolv.conf"
umount --lazy "${chrootdir}/${LOG_FILE}"
......@@ -39,7 +59,7 @@ closeChroot() {
}
function create_stub() {
local script="${1}"
local script="$1"
cat << EOF > "${script}"
#!/usr/bin/env bash
......@@ -53,31 +73,28 @@ EOF
}
addToChrootFile() {
local chrootdir="${1}"
local script_name="${2}"
local cmd="${3}"
local chrootdir="$1"
local cmd="${2}"
if [ ! -f "${chrootdir}/tmp/${script_name}" ]; then
create_stub "${chrootdir}/tmp/${script_name}"
if [ ! -f "${chrootdir}/tmp/exec.sh" ]; then
create_stub "${chrootdir}/tmp/exec.sh"
fi
echo "${cmd}" >> "${chrootdir}/tmp/${script_name}"
echo "${cmd}" >> "${chrootdir}/tmp/exec.sh"
}
execChroot() {
local chrootdir="${1}"
local script_name="${2}"
local chrootdir="$1"
[ ! -x "${chrootdir}/tmp/${script_name}" ] && chmod +x "${chrootdir}/tmp/${script_name}"
chroot "${chrootdir}" "/tmp/${script_name}"
rm --recursive --force "${chrootdir}/tmp/${script_name:?}" &>/dev/null
[ ! -x "${chrootdir}/tmp/exec.sh" ] && chmod +x "${chrootdir}/tmp/exec.sh"
chroot "${chrootdir}" "/tmp/exec.sh"
rm --recursive --force "${chrootdir:?}/tmp/exec.sh" &>/dev/null
return $?
}
function cleanup() {
local chrootdir="${1}"
local tmp="${2}"
local chrootdir="$1"
if mountpoint --quiet "${chrootdir}/etc/resolv.conf"; then
umount --lazy "${chrootdir}/etc/resolv.conf"
......@@ -97,5 +114,4 @@ function cleanup() {
if mountpoint --quiet "${chrootdir}/proc"; then
umount --lazy "${chrootdir}/proc"
fi
rm --recursive --force "${tmp:?}"
}
TMPFS="${PREFIX}/tmp"
TMPFS_SIZE="6291456k"
TMP="${TMPFS}/${_PROF}"
CHROOTDIR="${PREFIX}/overlay"
SCRIPTSDIR="${PREFIX}/scripts-enabled/${_PROF}"
ISODIR="${PREFIX}/iso"
CACHEDIR="${PREFIX}/cache/${_PROF}/${_REPO}"
PKGLIST="${PREFIX}/pkg-list/${_PROF}"
SOURCESLIST="${PREFIX}/sources-list"
LOG_PATH="/var/log"
NAME="Linux Comunicacoes"
WEBSITE="https://cidadesdigitais.c3sl.ufpr.br/linux-comunicacoes/"
ISOURL="http://cdimage.ubuntu.com/ubuntu-gnome/releases/16.04/release"
KEYURL="http://repo.c3sl.ufpr.br/lc2/lc.c3sl.ufpr.br.key"
NAME="Linux Educacional"
WEBSITE="https://linuxeducacional.c3sl.ufpr.br"
ISOURL="http://cdimage.ubuntu.com/ubuntu-gnome/releases/16.04/release"
KEYURL="http://repo.c3sl.ufpr.br/le6/le.c3sl.ufpr.br.key"
SHORTNAME=le6
TMP=${PREFIX}/${_DIST}
CHROOTDIR=${PREFIX}/overlay
TMPFS=${PREFIX}/tmp
DISTRO=Linux_Educacional_6.1.0
DPLIST=${PREFIX}/pkg-list/${_DIST}/dependencies.list
INSTLIST=${PREFIX}/pkg-list/${_DIST}/install.list
ISOLINUX=${PREFIX}/src/isolinux
MOUNTLIST=${TMP}/mountlist
OURSOURCESLIST=${PREFIX}/sources-list/${_DIST}/${SHORTNAME}.list
RMDSKT=${PREFIX}/pkg-list/${_DIST}/remove-desktop.list
RMLIST=${PREFIX}/pkg-list/${_DIST}/remove.list
REPOPKGS=${PREFIX}/pkg-list/${_DIST}/repo-local.list
SCRIPTSDIR=${PREFIX}/scripts-enabled/${_DIST}
SOURCESLISTDEFAULT=${PREFIX}/sources-list/${_DIST}/default.list
SCRIPT_NAME="exec.sh"
LOG_PATH="/var/log"
_HELP=false
_PROF=""
_INPUT=""
_OUTPUT=""
_REPO="stable"
_VERSION=""
_DEBUG=false
_MAIL=false
_HELP=false
_DIST=""
_ARCH="amd64"
_REPO="stable"
This diff is collapsed.
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "You must have more power to run this script. Are you root?"
exit -1
fi
SESSION="$(date +'%Y-%m-%d')"
DIR="/home/lucas/create-iso"
CMD="./create-iso.sh --profile le6 --version 6.1.1 --repo testing --debug --sendmail"
# Create GNU screen session
screen -dmS "${SESSION}" || exit 1
# Execute c3geniso in the main window
screen -S "${SESSION}" -X stuff "pushd ${DIR} && ${CMD} && exit\n" || exit 2
exit 0
#!/bin/bash
# shellcheck disable=SC1090
mount --bind /dev chroot/dev
mount --bind /dev/pts chroot/dev/pts
mount --bind /sys chroot/sys
mount --bind /proc chroot/proc
#chroot chroot dbus-uuidgen > chroot/var/lib/dbus/machine-id
chroot chroot
......@@ -7,30 +7,32 @@ readonly ALL=15
VERBOSE_FLAGS=${ALL}
mapType() {
case "${1}" in
case "$1" in
e | error ) echo "${ERROR}" ;;
w | warning ) echo "${WARNING}" ;;
i | info ) echo "${INFO}" ;;
d | debug ) echo "${DEBUG}" ;;
* ) createIsoLogger -m "Invalid type '${1}'" -T "LOGGER"; return 1 ;;
* ) createIsoLogger -m "Invalid type '$1'" -T "LOGGER"; return 1 ;;
esac
}
createIsoLogger() {
TYPE="${ERROR}"
TAG=""
MSG=""
SCRIPT="$(basename "${BASH_SOURCE[1]}")"
LINE="${BASH_LINENO[0]}"
while true; do
case "${1}" in
-t | --type ) TYPE="$(mapType "${2}")" || return; shift; shift ;;
-T | --tag ) TAG="${2}"; shift; shift ;;
-m | --message ) MSG="${2}"; shift; shift ;;
-s | --script ) SCRIPT="${2}"; shift; shift ;;
-l | --line ) LINE="${2}"; shift; shift ;;
-* ) createIsoLogger -m "Unrecognized option '${1}'" -T "LOGGER"; return ;;
-t | --type ) TYPE="$(mapType "$2")" || return; shift; shift ;;
-T | --tag ) TAG="$2"; shift; shift ;;
-m | --message ) MSG="$2"; shift; shift ;;
-s | --script ) SCRIPT="$2"; shift; shift ;;
-l | --line ) LINE="$2"; shift; shift ;;
-* ) createIsoLogger -m \
"Unrecognized option '$1'" -T "LOGGER"; return ;;
* ) break ;;
esac
done
......@@ -50,13 +52,17 @@ createIsoLogger() {
esac
echo -e "${LOG_LINE}" 1>&2
echo -e "${LOG_LINE}" >> "${LOG_FILE}"
if [ "${TYPE}" -eq "${ERROR}" ] || [ "${TYPE}" -eq "${DEBUG}" ]; then
[[ "${_MAIL}" == true ]] && sendmail -t <<< \
"$(sed "s/##SUBJECT##/${TIME_STAMP}/" < \
"${PREFIX}/mail.txt" && screen -ls; echo ""; \
tail --lines=20 "${LOG_FILE}")" || createIsoLogger -m \
"Unable to send mail"
/bin/bash
fi
else
createIsoLogger -m "Tried to use disabled type '${TYPE}'" -T "LOGGER"
return
fi
if [ "${TYPE}" -eq "${ERROR}" ]; then
/bin/bash
fi
}
......
#!/bin/bash
# shellcheck disable=SC1090
#
# 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.
mountTmpfs() {
local tmpfs="${1}"
if mountpoint --quiet "${tmpfs}"; then
return 1
fi
mkdir --parents "${tmpfs}"
if [ ! -d "${tmpfs}" ]; then
echo "overlay path: '${tmpfs}' has not been found."
exit 1
fi
mount --types tmpfs tmpfs --options suid,dev,size=6291456k "${tmpfs}"
}
umountTmpfs() {
local tmpfs="${1}"
if mountpoint --quiet "${tmpfs}"; then
umount "${tmpfs}"
fi
rm --recursive --force "${tmpfs:?}"
}
#!/bin/bash
# shellcheck disable=SC1090
#
# 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.
mountOverlay() {
local chrootdir="${1}"
local tmpfs="${2}"
local prefix="${PWD}"
mkdir --parents "${tmpfs}/upper"
mkdir --parents "${tmpfs}/work"
mkdir --parents "${chrootdir}"
if [ ! -d "${tmpfs}" ]; then
echo "overlay path: '${tmpfs}' has not been found."
exit 1
fi
if [ ! -d "${tmpfs}/upper" ]; then
echo "upperdir path: '${tmpfs}/upper' has not been found."
exit 1
fi
if [ ! -d "${tmpfs}/work" ]; then
echo "workdir path: '${tmpfs}/work' has not been found."
exit 1
fi
if [ ! -d "${chrootdir}" ]; then
echo "merge point path: '${chrootdir}' has not been found."
exit 1
fi
if [ ! -d "${prefix}/chroot" ]; then
echo "chroot path: '${prefix}/chroot' has not been found."
exit 1
fi
if ! mountpoint --quiet "${chrootdir}"; then
if ! mount --types overlay overlay --options rw,lowerdir="${prefix}"/chroot,upperdir="${tmpfs}"/upper,workdir="${tmpfs}"/work "${chrootdir}"; then
echo "Overlay could not be mounted:" >&2
echo " lowerdir: '${prefix}/chroot'" >&2
echo " upperdir: '${tmpfs}/upper'" >&2
echo " workdir: '${tmpfs}/work'" >&2
echo "mount point: '${chrootdir}'" >&2
exit 1
fi
fi
}
umountOverlay() {
local chrootdir="${1}"
local tmpfs="${2}"
if mountpoint --quiet "${chrootdir}"; then
umount "${chrootdir}"
fi
rm --recursive --force "${tmpfs}/{upper,work:?}"
rm --recursive --force "${chrootdir:?}"
}
To: ls17@c3sl.ufpr.br
Subject: ##SUBJECT##
lc-all-live
lc-all
#linux-generic
plymouth-x11
#plymouth-theme-lc-logo
numlockx
#webbrowser-app
#xserver-xorg
linux-generic-hwe-16.04
xserver-xorg-hwe-16.04
lc-all-live
ubiquity
ubiquity-frontend-gtk
ubiquity-frontend-kde
casper
lupin-casper
user-setup
discover
libdebian-installer4
lc-ubiquity-slideshow
lc-conf
lc-server-all
lc-client-all
ubuntu-standard
laptop-detect
dbus
wget
le-live-all
le-all
linux-generic-hwe-16.04
xserver-xorg-hwe-16.04
#!/usr/bin/env bash
# shellcheck disable=SC1090
# shellcheck disable=SC2091
#
# 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.
# WARNING: This script hasn't been used in a while. Probably won't just werk.
#set -x
_DIST="${1}"
_PROF="${1}"
PREFIX="${PWD}"
source "${PREFIX}/conf/${_DIST}/create-iso.conf"
source "${PREFIX}/conf/${_PROF}/create-iso.conf"
source "${PREFIX}/common.sh"
mkdir -p "${TMP}/bl/"
......
......@@ -21,25 +21,18 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
# _ARCH="${2}"
# _REPO="${3}"
CHROOTDIR="${4}"
# SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
# PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
# PKGLIST="$8"
# SOURCESLIST="$9"
# REPO="${10}"
# KEYURL="${11}"
PREFIX="${PWD}"
type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/common.sh"
......@@ -61,11 +54,14 @@ if mountpoint --quiet "${CHROOTDIR}/proc"; then
umount "${CHROOTDIR}/proc"
fi
mksquashfs "${CHROOTDIR}" "${TMP}/image/casper/filesystem.squashfs" -b 1M -no-recovery -processors "$(nproc)" || \
createIsoLogger --message "Failed to compress ${CHROOTDIR}" --tag "mksquashfs"
pushd "${TMP}/image" || createIsoLogger --message "Unable to change directory" --tag "pushd"
find . -type f -print0 | xargs -0 md5sum | grep --invert-match "\\./md5sum.txt" > md5sum.txt || createIsoLogger \
--message "Failed to generate md5sum" --tag "md5sum"
mksquashfs "${CHROOTDIR}" "${TMP}/image/casper/filesystem.squashfs" -b 1M \
-no-recovery -processors "$(nproc)" -noappend || createIsoLogger --message \
"Failed to compress ${CHROOTDIR}" --tag "mksquashfs"
pushd "${TMP}/image" || createIsoLogger --message "Unable to change directory" \
--tag "pushd"
find . -type f -print0 | xargs -0 md5sum | grep --invert-match \
"\\./md5sum.txt" > md5sum.txt || createIsoLogger --message \
"Failed to generate md5sum" --tag "md5sum"
popd || createIsoLogger --message "Unable to change directory" --tag "popd"
exit 0
......@@ -21,60 +21,61 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
_ARCH="${2}"
_REPO="${3}"
CHROOTDIR="${4}"
# SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
REPOPKGS="${19}"
# PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
PKGLIST="$8"
# SOURCESLIST="$9"
REPO="${10}"
# KEYURL="${11}"
PREFIX="${PWD}"
type addToChrootFile >/dev/null 2>&1 || source "${PREFIX}/common.sh"
type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/helper/logging.incsh"
mount --bind "/etc/resolv.conf" "${CHROOTDIR}/etc/resolv.conf"
fingerprint="$(gpg --list-keys --with-colons 'C3SL Live' | grep --max-count=1 'fpr' | cut --delimiter=':' --fields=10)"
mount --bind --options ro "/etc/resolv.conf" "${CHROOTDIR}/etc/resolv.conf"
fingerprint="$(gpg --list-keys --with-colons 'C3SL Live' | grep --max-count=1 \
'fpr' | cut --delimiter=':' --fields=10)"
if test -z "${fingerprint}"; then
gpg --batch --no-tty --gen-key "${PREFIX}/src/gpg-key/gen-key-script"
fingerprint="$(gpg --list-keys --with-colons 'C3SL Live' | grep --max-count=1 'fpr' | cut --delimiter=':' --fields=10)"
fingerprint="$(gpg --list-keys --with-colons 'C3SL Live' | grep \
--max-count=1 'fpr' | cut --delimiter=':' --fields=10)"
fi
cp --recursive --archive "${PREFIX}/src/local-repository/" "${PREFIX}/repo/"
sed -i "s/##ARCH##/ ${_ARCH}/" "${PREFIX}/repo/conf/distributions" || createIsoLogger --message \
"Unable to setup architecture of local repository" --type warning --tag "sed"
sed -i "s/##GPGKEY##/ ${fingerprint}/" "${PREFIX}/repo/conf/distributions" || createIsoLogger --message \
"Unable to setup the key of local repository" --type warning --tag "sed"
sed -i "s/##CODENAME##/ ${_REPO}/" "${PREFIX}/repo/conf/distributions" || createIsoLogger --message \
"Unable to setup the codename of local repository" --type warning --tag "sed"
sed -i "s/##GPGKEY##/ ${fingerprint}/" "${PREFIX}/repo/conf/distributions" || \
createIsoLogger --message "Unable to setup the key of local repository" --type \
warning --tag "sed"
sed -i "s/##CODENAME##/ ${REPO}/" "${PREFIX}/repo/conf/distributions" || \
createIsoLogger --message "Unable to setup the codename of local repository" \
--type warning --tag "sed"
chroot "${CHROOTDIR}" apt-get clean
# This disables the warning about word splitting (it is supposed to word split since each package has to be an argument):
# This disables the warning about word splitting (it is supposed to word split
# since each package has to be an argument):
# shellcheck disable=SC2046
chroot "${CHROOTDIR}" apt-get --download-only --yes install $(grep --invert-match '^#' < "${REPOPKGS}" | tr '\n' ' ') || \
createIsoLogger --message "Unable to download packages to local repository" --tag "apt-get"
reprepro --basedir "${PREFIX}/repo/" includedeb "${_REPO}" "${CHROOTDIR}"/var/cache/apt/archives/*.deb || \
createIsoLogger --message "Unable to include package to local repository" --tag "reprepro"
chroot "${CHROOTDIR}" apt-get --download-only --yes install $(grep \
--invert-match '^#' < "${PKGLIST}/repo.list" | tr '\n' ' ') || \
createIsoLogger --message "Unable to download packages to local repository" \
--tag "apt-get"
createIsoLogger -m "Breakpoint" -t d
reprepro --basedir "${PREFIX}/repo/" includedeb "${REPO}" \
"${CHROOTDIR}"/var/cache/apt/archives/*.deb || createIsoLogger --message \
"Unable to include package to local repository" --tag "reprepro"
chroot "${CHROOTDIR}" apt-get clean
mv repo/{dists,pool} "${TMP}/image/" || createIsoLogger --message "Unable to move local repository to image" --tag "mv"
cp --recursive repo/{dists,pool} "${TMP}/image/" || createIsoLogger --message \
"Unable to move local repository to image" --tag "mv"
rm --recursive --force "${PREFIX:?}/repo/"
gpg --armor --export 'C3SL Live' > "${CHROOTDIR}/tmp/public.key" || createIsoLogger --message "Unable to export key" \
--tag "gpg"
chroot "${CHROOTDIR}" apt-key add /tmp/public.key || createIsoLogger --message "Unable to add key of local repository" \
--tag "apt-key"
gpg --armor --export 'C3SL Live' > "${CHROOTDIR}/tmp/public.key" || \
createIsoLogger --message "Unable to export key" --tag "gpg"
chroot "${CHROOTDIR}" apt-key add /tmp/public.key || createIsoLogger --message \
"Unable to add key of local repository" --tag "apt-key"
rm "${CHROOTDIR:?}/tmp/public.key"
umount "${CHROOTDIR}/etc/resolv.conf"
......
......@@ -21,36 +21,33 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
# _ARCH="${2}"
# _REPO="${3}"
CHROOTDIR="${4}"
SCRIPT_NAME="${5}"
# DISTRO="${6}"
DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
# TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
# PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
# TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
PKGLIST="$8"
# SOURCESLIST="$9"
# REPO="${10}"
# KEYURL="${11}"
PREFIX="${PWD}"
type addToChrootFile >/dev/null 2>&1 || source "${PREFIX}/common.sh"
grep --invert-match '^#' < "${DPLIST}" | tr '\n' ' '
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "export PATH='/fakebin:${PATH}' || \
createIsoLogger --message \"Unable to export PATH\" --script \"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"export\""
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "export DEBIAN_FRONTEND=noninteractive || \
createIsoLogger --message \"Unable to export DEBIAN_FRONTEND\" --script \"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"export\""
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "apt-get update && apt-get --quiet --yes install \
$(grep --invert-match '^#' < "${DPLIST}" | tr '\n' ' ') || createIsoLogger --message \"Unable to install dependencies\" \
--script \"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
grep --invert-match '^#' < "${PKGLIST}/dependencies.list" | tr '\n' ' '
addToChrootFile "${CHROOTDIR}" "export PATH='/fakebin:${PATH}' createIsoLogger \
--message \"Unable to export PATH\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"export\""
addToChrootFile "${CHROOTDIR}" "export DEBIAN_FRONTEND=noninteractive || \
createIsoLogger --message \"Unable to export DEBIAN_FRONTEND\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"export\""
addToChrootFile "${CHROOTDIR}" "apt-get update && apt-get --quiet --yes \
install $(grep --invert-match '^#' < "${PKGLIST}/dependencies.list" | \
tr '\n' ' ') || createIsoLogger --message \"Unable to install dependencies\" \
--script \"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \
\"apt-get\""
exit 0
......@@ -21,40 +21,32 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
# _ARCH="${2}"
_REPO="${3}"
CHROOTDIR="${4}"
SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
# TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
# PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
# TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
PKGLIST="$8"
# SOURCESLIST="$9"
REPO="${10}"
# KEYURL="${11}"
PREFIX="${PWD}"
type addToChrootFile >/dev/null 2>&1 || source "${PREFIX}/common.sh"
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "export PATH='/fakebin:${PATH}' || \
createIsoLogger --message \"Unable to export PATH\" --script \"$(basename "${BASH_SOURCE[0]}")\" \
--line \"${LINENO}\" --tag \"export\""
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "export DEBIAN_FRONTEND=noninteractive || \
createIsoLogger --message \"Unable to export DEBIAN_FRONTEND\" --script \"$(basename "${BASH_SOURCE[0]}")\" \
--line \"${LINENO}\" --tag \"export\""
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "apt-get update && apt-get --quiet --yes --target-release ${_REPO} \
install le-live-all || createIsoLogger --message \"Unable to install le-live-all\" --script \"$(basename "${BASH_SOURCE[0]}")\" \
--line \"${LINENO}\" --tag \"apt-get\""
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "apt-get update && apt-get --quiet --yes --target-release ${_REPO} \
install $(grep --invert-match '^#' < "${INSTLIST}" | tr '\n' ' ') || createIsoLogger --message \"Unable to install listed packages\" \
--script \"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
addToChrootFile "${CHROOTDIR}" "export PATH='/fakebin:${PATH}' || \
createIsoLogger --message \"Unable to export PATH\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"export\""
addToChrootFile "${CHROOTDIR}" "export DEBIAN_FRONTEND=noninteractive || \
createIsoLogger --message \"Unable to export DEBIAN_FRONTEND\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"export\""
addToChrootFile "${CHROOTDIR}" "apt-get update && apt-get --quiet --yes \
--target-release ${REPO} install $(grep --invert-match '^#' < \
"${PKGLIST}/install.list" | tr '\n' ' ') || createIsoLogger --message \
\"Unable to install listed packages\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
exit 0
......@@ -21,52 +21,74 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
# _ARCH="${2}"
# _REPO="${3}"
CHROOTDIR="${4}"
# SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
# PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
# PKGLIST="$8"
# SOURCESLIST="$9"
# REPO="${10}"
# KEYURL="${11}"
CACHEDIR="${12}"
PREFIX="${PWD}"
type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/helper/logging.incsh"
# The most recent kernel available in the base system is used in the image
initrd_path="$(find "${CHROOTDIR}/boot/" -maxdepth 1 -regextype egrep -name "initrd.img-[0-9,.,-]*-generic" | \
sort --version-sort --reverse | head --lines=1)"
initrd_path="$(find "${CHROOTDIR}/boot/" -maxdepth 1 -regextype egrep -name \
"initrd.img-[0-9,.,-]*-generic" | sort --version-sort | tail --lines=1)"
NEWMD5="$(md5sum "${initrd_path}")"
echo "${NEWMD5}" > "${TMP}/MD5SUMS"
PREVIOUS="$(find "${CACHEDIR}" -mindepth 1 -maxdepth 1 -type d | sort \
--numeric | tail --lines=1)"
if [ -f "${PREVIOUS}/MD5SUMS" ]; then
OLDMD5="$(cat "${PREVIOUS}/MD5SUMS")"
if [ "${OLDMD5}" == "${NEWMD5}" ]; then
createIsoLogger --message \
"Caching '${PREVIOUS}/image/casper/initrd.lz'" --type info
exit 0
fi
fi
version="$(basename "${initrd_path}" | cut --delimiter='-' --fields=2,3)"
cp "${CHROOTDIR}/boot/vmlinuz-${version}-generic" "${TMP}/image/casper/vmlinuz" || createIsoLogger --message "Unable to copy kernel to image" --tag "cp"
cp "${CHROOTDIR}/boot/vmlinuz-${version}-generic" \
"${TMP}/image/casper/vmlinuz" || createIsoLogger --message \
"Unable to copy kernel to image" --tag "cp"
# The initrd is converted from gzip to lzma
createIsoLogger --message "Using '$(basename "${initrd_path}")'" --type info
initrd_type="$(file "${initrd_path}")"
mkdir "${PREFIX}/initrd"
pushd "${PREFIX}/initrd" || createIsoLogger --message "Unable to change directory" --tag "pushd"
pushd "${PREFIX}/initrd" || createIsoLogger --message \
"Unable to change directory" --tag "pushd"
if grep --quiet --ignore-case "gzip" <<< "${initrd_type}"; then
gzip --decompress --stdout "${initrd_path}" | cpio --extract || createIsoLogger --message "Unable to decompress initrd" --tag "gzip"
gzip --decompress --stdout "${initrd_path}" | cpio --extract \
--make-directories || createIsoLogger --message \
"Unable to decompress initrd" --tag "gzip"
elif grep --quiet --ignore-case "ascii" <<< "${initrd_type}"; then
block_size="$(binwalk --include="compressed data" "${initrd_path}" | cut --delimiter=" " --fields=1 | grep -E "[0-9]+")"
dd if="${initrd_path}" bs="${block_size}" skip=1 | gunzip | cpio --extract --make-directories
# TODO: Check what's happening here
block_size="$(binwalk --include="compressed data" "${initrd_path}" | cut \
--delimiter=" " --fields=1 | grep -E "[0-9]+" | head --lines=1)"
dd if="${initrd_path}" bs="${block_size}" skip=1 | gunzip | cpio --extract \
--make-directories || createIsoLogger --message \
"Unable to decompress initrd" --tag "gunzip"
else
createIsoLogger --message "Invalid initrd format"
fi
find . | cpio --quiet --create -H newc | lzma -7 > ../initrd.lz || createIsoLogger --message "Unable to compress initrd" --tag "lzma"
find . | cpio --quiet --create -H newc | lzma -7 > ../initrd.lz || \
createIsoLogger --message "Unable to compress initrd" --tag "lzma"
popd || createIsoLogger --message "Unable to change directory" --tag "popd"
rm --recursive --force "${PREFIX:?}/initrd" || createIsoLogger --message "Unable to remove dir \"${PREFIX}/initrd\"" --tag "rm"
mv initrd.lz "${TMP}/image/casper/initrd.lz" || createIsoLogger --message "Unable to move initrd to image" --tag "mv"
rm --recursive --force "${PREFIX:?}/initrd" || createIsoLogger --message \
"Unable to remove dir \"${PREFIX}/initrd\"" --tag "rm"
mv initrd.lz "${TMP}/image/casper/initrd.lz" || createIsoLogger --message \
"Unable to move initrd to image" --tag "mv"
exit 0
......@@ -21,40 +21,35 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
# _ARCH="${2}"
# _REPO="${3}"
# CHROOTDIR="${4}"
# SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
# PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
TMP="$5"
# CHROOTDIR="$6"
# SCRIPTSDIR="$7"
PKGLIST="$8"
# SOURCESLIST="$9"
# REPO="${10}"
# KEYURL="${11}"
PREFIX="${PWD}"
type createIsoLogger >/dev/nul 2>&1 || source "${PREFIX}/helper/logging.incsh"
# This packages must not appear in the manifest
cp "${TMP}/image/casper/filesystem.manifest" "${TMP}/image/casper/filesystem.manifest-desktop" || \
createIsoLogger --message "Unable to create desktop manifest" --tag "cp"
cp "${TMP}/image/casper/filesystem.manifest" \
"${TMP}/image/casper/filesystem.manifest-desktop" || createIsoLogger --message \
"Unable to create desktop manifest" --tag "cp"
IFS_OLD="${IFS}"
IFS=$'\n'
while IFS= read -r package
do
sed --in-place "/${package}/d" "${TMP}/image/casper/filesystem.manifest-desktop" || \
createIsoLogger --message "Unable to remove package \"${package}\" from desktop manifest" --type \
warning --tag "sed"
done < "${RMDSKT}"
sed --in-place "/${package}/d" \
"${TMP}/image/casper/filesystem.manifest-desktop" || createIsoLogger \
--message "Unable to remove package \"${package}\" from desktop manifest" \
--type warning --tag "sed"
done < "${PKGLIST}/remove-desktop.list"
IFS="${IFS_OLD}"
exit 0
......@@ -21,32 +21,28 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
# _ARCH="${2}"
# _REPO="${3}"
CHROOTDIR="${4}"
# SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
# PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
# PKGLIST="$8"
# SOURCESLIST="$9"
# REPO="${10}"
# KEYURL="${11}"
export PREFIX="${PWD}"
type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/helper/logging.incsh"
# This disables the variable referencing warning as this is actually the command usage:
# This disables the variable referencing warning as this is actually the command
# usage:
# shellcheck disable=SC2154
chroot "${CHROOTDIR}" dpkg-query --show --showformat="\${Package} \${Version}\\n" > "${TMP}/image/casper/filesystem.manifest" || \
createIsoLogger --message "Unable to create manifest" --tag "dpkg-query"
chroot "${CHROOTDIR}" dpkg-query --show \
--showformat="\${Package} \${Version}\\n" > \
"${TMP}/image/casper/filesystem.manifest" || createIsoLogger --message \
"Unable to create manifest" --tag "dpkg-query"
exit 0
......@@ -21,34 +21,28 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
# _ARCH="${2}"
# _REPO="${3}"
CHROOTDIR="${4}"
SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
# TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
# PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
# TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
PKGLIST="$8"
# SOURCESLIST="$9"
# REPO="${10}"
# KEYURL="${11}"
PREFIX="${PWD}"
type addToChrootFile >/dev/null 2>&1 || source "${PREFIX}/common.sh"
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "apt-get --yes purge $(grep --invert-match "^#" < "${RMLIST}") || \
createIsoLogger --message \"Unable to purge listed packages\" --script \"$(basename "${BASH_SOURCE[0]}")\" --line \
\"${LINENO}\" --tag \"apt-get\""
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "apt-get --yes autoremove || \
createIsoLogger --message \"Unable to autoremove unused packages\" --script \"$(basename "${BASH_SOURCE[0]}")\" --line \
\"${LINENO}\" --tag \"apt-get\""
addToChrootFile "${CHROOTDIR}" "apt-get --yes purge \
$(grep --invert-match "^#" < "${PKGLIST}/remove.list") || createIsoLogger \
--message \"Unable to purge listed packages\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
addToChrootFile "${CHROOTDIR}" "apt-get --yes autoremove || createIsoLogger \
--message \"Unable to autoremove unused packages\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
exit 0
......@@ -21,25 +21,20 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
_ARCH="${2}"
# _REPO="${3}"
CHROOTDIR="${4}"
# SCRIPT_NAME="${5}"
DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
# OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
PROFILE="$1"
NAME="$2"
WEBSITE="$3"
# TMPFS="$4"
TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
# PKGLIST="$8"
# SOURCESLIST="$9"
# REPO="${10}"
# KEYURL="${11}"
# CACHEDIR="${12}"
_DEBUG="${13}"
PREFIX="${PWD}"
type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/helper/logging.incsh"
......@@ -51,45 +46,72 @@ if test -z "${CHROOTDIR}"; then
fi
mkdir --parents "${TMP}"/image/{casper,isolinux,install,preseed,.disk} || \
createIsoLogger --message "Unable to create necessary directories" --tag "mkdir"
cp /usr/lib/ISOLINUX/isolinux.bin "${TMP}/image/isolinux/" || \
createIsoLogger --message "Unable to copy isolinux.bin to image" --tag "cp"
cp /usr/lib/ISOLINUX/isolinux.bin "${TMP}/image/isolinux/" || createIsoLogger \
--message "Unable to copy isolinux.bin to image" --tag "cp"
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 "${TMP}/image/isolinux/" || \
createIsoLogger --message "Unable to copy ldlinux.c32 to image" --tag "cp"
cp "${PREFIX}"/src/isolinux/* "${TMP}/image/isolinux/" || \
createIsoLogger --message "Unable to copy isolinux files to image" --tag "cp"
cp "${PREFIX}/src/preseed/preseed.cfg" "${TMP}/image/preseed/" || \
cp "${PREFIX}"/src/isolinux/* "${TMP}/image/isolinux/" || createIsoLogger \
--message "Unable to copy isolinux files to image" --tag "cp"
cp "${PREFIX}/src/${PROFILE}/preseed.cfg" "${TMP}/image/preseed/" || \
createIsoLogger --message "Unable to copy preseed to image" --tag "cp"
cp "${PREFIX}/src/keyboard" "${CHROOTDIR}/etc/default/" || \
createIsoLogger --message "Unable to copy default keyboard layout" --type warning --tag "cp"
if [[ "${_DEBUG}" == true ]]; then
# Enables apport in live session
sed --in-place 's/enabled=.*/enabled=1/' "${CHROOTDIR}/etc/default/apport" \
|| createIsoLogger --message "Unable to enable apport"
# Enables apport after installation
sed --in-place "s/##APPORT##/1/" "${TMP}/image/preseed/preseed.cfg" || \
createIsoLogger --message "Unable to set up preseed to enable apport"
createIsoLogger -m "apport should be enabled now" -t i
else
# Disables apport in live session
sed --in-place 's/enabled=.*/enabled=0/' "${CHROOTDIR}/etc/default/apport" \
|| createIsoLogger --message "Unable to disable apport"
# Disables apport after installation
sed --in-place "s/##APPORT##/0/" "${TMP}/image/preseed/preseed.cfg" || \
createIsoLogger --message "Unable to set up preseed to disable apport"
createIsoLogger -m "apport should be disabled now" -t i
fi
cp "${PREFIX}/src/keyboard" "${CHROOTDIR}/etc/default/" || createIsoLogger \
--message "Unable to copy default keyboard layout" --type warning --tag "cp"
size="$(du --summarize --block-size=1 "${CHROOTDIR}" | cut --fields=1)" || \
createIsoLogger --message "Unable to get the size of chroot" --tag "du"
if test "${size}" -eq 0; then
createIsoLogger --message "The chroot returns size 0" --tag "du"
fi
echo "${size}" > "${TMP}/image/casper/filesystem.size"
cp "${PREFIX}/src/README.diskdefines-${_ARCH}" "${TMP}/image/README.diskdefines" || \
createIsoLogger --message "Unable to copy README.diskdefines to image" --tag "cp"
pushd "${TMP}/image/" || createIsoLogger --message "Unable to change directory" --tag "pushd"
ln --symbolic . ubuntu || \
createIsoLogger --message "Unable to create ${TMP}/image/ubuntu symbolic link" --tag "ln"
cp "${PREFIX}/src/README.diskdefines" "${TMP}/image/" || createIsoLogger \
--message "Unable to copy README.diskdefines to image" --tag "cp"
sed --in-place "s/##DISKNAME##/${NAME}/" "${TMP}/image/README.diskdefines" || \
createIsoLogger --message "Unable to set up DISKNAME on README.diskdefines"
pushd "${TMP}/image/" || createIsoLogger --message \
"Unable to change directory" --tag "pushd"
ln --symbolic --force --no-dereference . ubuntu || createIsoLogger --message \
"Unable to create ${TMP}/image/ubuntu symbolic link" --tag "ln"
popd || createIsoLogger --message "Unable to change directory" --tag "popd"
touch "${TMP}/image/.disk/base_installable" || \
createIsoLogger --message "Unable to create ${TMP}/image/.disk/base_installable" --tag "touch"
touch "${TMP}/image/.disk/base_installable" || createIsoLogger --message \
"Unable to create ${TMP}/image/.disk/base_installable" --tag "touch"
echo "full_cd/single" > "${TMP}/image/.disk/cd_type" || \
createIsoLogger --message "Unable to set ${TMP}/image/.disk/cd_type" --tag "echo"
echo "Linux-Educacional 6.1.0" > "${TMP}/image/.disk/info" || \
createIsoLogger --message "Unable to set ${TMP}/image/.disk/cd_type" --tag \
"echo"
sed 's/ /-/' <<< "${NAME}" > "${TMP}/image/.disk/info" || \
createIsoLogger --message "Unable to set ${TMP}/image/.disk/info" --tag "echo"
echo "https://linuxeducacional.c3sl.ufpr.br" > "${TMP}/image/.disk/release_notes_url" || \
createIsoLogger --message "Unable to set ${TMP}/image/.disk/release_notes/url" --tag "echo"
echo "${WEBSITE}" > "${TMP}/image/.disk/release_notes_url" || createIsoLogger \
--message "Unable to set ${TMP}/image/.disk/release_notes/url" --tag "echo"
#Change label on grub menu
sed --in-place "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DISTRO//_/ }\"/" "${CHROOTDIR}/etc/default/grub" || \
createIsoLogger --message "Unable to change distributor in grub default file" --type warning --tag "sed"
# Change label on grub menu
sed --in-place "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${NAME}\"/" \
"${CHROOTDIR}/etc/default/grub" || createIsoLogger --message \
"Unable to change distributor in grub default file" --type warning --tag "sed"
sed --in-place "s/PRETTY_NAME=.*/PRETTY_NAME=\"${DISTRO//_/ }\"/" "${CHROOTDIR}/usr/lib/os-release" || \
createIsoLogger --message "Unable to change pretty name in os-release file" --type warning --tag "sed"
sed --in-place "s/PRETTY_NAME=.*/PRETTY_NAME=\"${NAME}\"/" \
"${CHROOTDIR}/usr/lib/os-release" || createIsoLogger --message \
"Unable to change pretty name in os-release file" --type warning --tag "sed"
cp "${PREFIX}/src/lsb-release" "${CHROOTDIR}/etc/" || \
createIsoLogger --message "Unable to copy lsb-release file to chroot" --type warning --tag "cp"
createIsoLogger --message "Unable to copy lsb-release file to chroot" --type \
warning --tag "cp"
sed --in-place "s/##DESCRIPTION##/${NAME}/" "${CHROOTDIR}/etc/lsb-release" || \
createIsoLogger --message "Unable to change description in lsb-release file" \
--type warning --tag "sed"
exit 0
......@@ -21,44 +21,43 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# _DIST="${1}"
# _ARCH="${2}"
_REPO="${3}"
CHROOTDIR="${4}"
SCRIPT_NAME="${5}"
# DISTRO="${6}"
# DPLIST="${7}"
# INSTLIST="${8}"
# ISOLINUX="${9}"
# MOUNTLIST="${10}"
OURSOURCESLIST="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
SOURCESLISTDEFAULT="${16}"
# TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
PROFILE="$1"
# NAME="$2"
# WEBSITE="$3"
# TMPFS="$4"
# TMP="$5"
CHROOTDIR="$6"
# SCRIPTSDIR="$7"
# PKGLIST="$8"
SOURCESLIST="$9"
REPO="${10}"
KEYURL="${11}"
PREFIX="${PWD}"
type addToChrootFile >/dev/null 2>&1 || source "${PREFIX}/common.sh"
type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/helper/logging.incsh"
cp "${SOURCESLISTDEFAULT}" "${CHROOTDIR}/etc/apt/sources.list" || createIsoLogger --message \
"Unable to copy default sources.list" --type warning --tag "cp"
cp "${SOURCESLIST}/default.list" "${CHROOTDIR}/etc/apt/sources.list" || \
createIsoLogger --message "Unable to copy default sources.list" --type warning \
--tag "cp"
if [ ! -d "${CHROOTDIR}/etc/apt/sources.list.d" ]; then
mkdir "${CHROOTDIR}/etc/apt/sources.list.d"
fi
cp "${OURSOURCESLIST}" "${CHROOTDIR}/etc/apt/sources.list.d/" || createIsoLogger --message "Unable to copy custom sources.list"
sed --in-place "s/##CODENAME##/${_REPO}/g" "${CHROOTDIR}/etc/apt/sources.list.d/$(basename "${OURSOURCESLIST}")"
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "(wget -O- http://repo.c3sl.ufpr.br/le6/le.c3sl.ufpr.br.key | apt-key add -) || \
createIsoLogger --message \"Unable to add a key to custom repository\" --script \"$(basename "${BASH_SOURCE[0]}")\" --line \
\"${LINENO}\" --tag \"apt-key\""
cp "${SOURCESLIST}/${PROFILE}.list" "${CHROOTDIR}/etc/apt/sources.list.d/" \
|| createIsoLogger --message "Unable to copy custom sources.list"
sed --in-place "s/##CODENAME##/${REPO}/g" \
"${CHROOTDIR}/etc/apt/sources.list.d/${PROFILE}.list"
addToChrootFile "${CHROOTDIR}" "(wget -O- \"${KEYURL}\" | apt-key add -) || \
createIsoLogger --message \"Unable to add a key to custom repository\" \
--script \"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \
\"apt-key\""
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "apt-get update || createIsoLogger --message \"Unable to reach all repositories\" \
--script \"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
addToChrootFile "${CHROOTDIR}" "${SCRIPT_NAME}" "apt-get --yes upgrade || createIsoLogger --message \"Unable to upgrade packages\" \
--script \"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
addToChrootFile "${CHROOTDIR}" "apt-get update || createIsoLogger --message \
\"Unable to reach all repositories\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
addToChrootFile "${CHROOTDIR}" "apt-get --yes upgrade || createIsoLogger \
--message \"Unable to upgrade packages\" --script \
\"$(basename "${BASH_SOURCE[0]}")\" --line \"${LINENO}\" --tag \"apt-get\""
exit 0
../../scripts-available/install-dependencies.sh
\ No newline at end of file
../../scripts-available/update-sourceslist.sh
\ No newline at end of file
../../scripts-available/remove.sh
\ No newline at end of file
../../scripts-available/install.sh
\ No newline at end of file
../../scripts-available/setup.sh
\ No newline at end of file
../../scripts-available/create-local-repository.sh
\ No newline at end of file
../../scripts-available/pre-manifest.sh
\ No newline at end of file
../../scripts-available/manifest.sh
\ No newline at end of file
../../scripts-available/make-initrd.sh
\ No newline at end of file
../../scripts-available/compress.sh
\ No newline at end of file
../../scripts-available/install-dependencies.sh
\ No newline at end of file
../../scripts-available/update-sourceslist.sh
\ No newline at end of file
../../scripts-available/remove.sh
\ No newline at end of file
../../scripts-available/install.sh
\ No newline at end of file
../../scripts-available/setup.sh
\ No newline at end of file
../../scripts-available/create-local-repository.sh
\ No newline at end of file
../../scripts-available/pre-manifest.sh
\ No newline at end of file
../../scripts-available/manifest.sh
\ No newline at end of file
../../scripts-available/make-initrd.sh
\ No newline at end of file
../../scripts-available/compress.sh
\ No newline at end of file
../../../scripts-available/install-dependencies.sh
\ No newline at end of file
../../../scripts-available/update-sourceslist.sh
\ No newline at end of file
../../../scripts-available/remove.sh
\ No newline at end of file
../../../scripts-available/install.sh
\ No newline at end of file
../../../scripts-available/setup.sh
\ No newline at end of file
../../../scripts-available/create-local-repository.sh
\ No newline at end of file
../../../scripts-available/pre-manifest.sh
\ No newline at end of file
../../../scripts-available/manifest.sh
\ No newline at end of file
../../../scripts-available/make-initrd.sh
\ No newline at end of file
../../../scripts-available/compress.sh
\ No newline at end of file
deb http://repo.c3sl.ufpr.br/lc2/ ##CODENAME## main
deb-src http://repo.c3sl.ufpr.br/lc2/ ##CODENAME## main
#define DISKNAME Linux-Educacional 6.0
#define DISKNAME ##DISKNAME##
#define TYPE binary
#define TYPEbinary 1
#define ARCH amd64
......
#define DISKNAME Linux-Educacional 6.0
#define TYPE binary
#define TYPEbinary 1
#define ARCH i386
#define ARCHi386 1
#define DISKNUM 1
#define DISKNUM1 1
#define TOTALNUM 0
#define TOTALNUM0 1
ubiquity ubiquity/use_nonfree boolean true
d-i apt-setup/backports boolean false
ubiquity ubiquity/success_command \
string if [ ! -f "/target/cdrom/.disk/info" ]; then \
if ! mount --bind /cdrom /target/cdrom; then \
echo "Failed binding /cdrom in /target/cdrom!" 1>&2; \
fi; \
if [ ! -f "/target/media/cdrom" ]; then \
cd "/target/media"; \
ln --symbolic "/cdrom"; \
cd -; \
fi; \
fi; \
in-target apt-cdrom add --fast --no-mount </dev/null; \
in-target apt-get update --yes; \
in-target apt-get install --yes lc-conf; \
if grep -qi "server" "/etc/default/version"; then \
in-target env DEBIAN_FRONTEND=noninteractive apt-get install --yes -o \
Dpkg::Options::="--force-confnew" lc-server-all; \
else \
in-target env DEBIAN_FRONTEND=noninteractive apt-get install --yes -o \
Dpkg::Options::="--force-confnew" lc-client-all; \
fi; \
umount "/target/cdrom"; \
unlink "/target/media/cdrom"; \
sed -i "/^deb cdrom:/s/^/#/" /target/etc/apt/sources.list; \
sed -i 's/enabled=.*/enabled=##APPORT##/' /target/etc/default/apport; \
in-target apt-get autoremove --yes; \
in-target apt-get clean
ubiquity ubiquity/use_nonfree boolean true
d-i apt-setup/backports boolean false
ubiquity ubiquity/success_command \
string in-target apt-get update --yes; \
if [ ! -f "/target/cdrom/.disk/info" ]; then \
string if [ ! -f "/target/cdrom/.disk/info" ]; then \
if ! mount --bind /cdrom /target/cdrom; then \
echo "Failed binding /cdrom in /target/cdrom!" 1>&2; \
fi; \
......@@ -13,13 +12,14 @@ ubiquity ubiquity/success_command \
fi; \
fi; \
in-target apt-cdrom add --fast --no-mount </dev/null; \