Commit 130bbe48 authored by sulzbach's avatar sulzbach

WIP: SCRUM#601

parent 6df32bda
chroot chroot
overlay overlay
kernel
*.swp *.swp
iso/**/*.iso cache/*
src/preseed/.preseed.bkp iso/*
initrd initrd/*
initrd.lz initrd.lz
chroot*.tar.gz .Trash-1000
packages-needed \ No newline at end of file
base
todos.txt
vmlinuz-*-generic
initrd.img-*-generic
...@@ -18,5 +18,6 @@ echo -e "$files"| xargs shellcheck -s bash && \ ...@@ -18,5 +18,6 @@ echo -e "$files"| xargs shellcheck -s bash && \
echo "AWESOME! No problems found." ; \ echo "AWESOME! No problems found." ; \
exit 0 exit 0
#else #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 exit 1
{
// sulzbach:
"editor.rulers": [80],
"editor.fontSize": 16
}
\ No newline at end of file
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1090 # 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() { initChroot() {
local chrootdir="${1}" local chrootdir="$1"
# Create the log file; this file will be bind to appear in "${VARLOG}" # Create the log file; this file will be bind to appear in "${VARLOG}"
# directory in the target machine that generates the iso. # directory in the target machine that generates the iso.
...@@ -16,7 +36,7 @@ initChroot() { ...@@ -16,7 +36,7 @@ initChroot() {
mount --bind "${LOG_FILE}" "${chrootdir}/${LOG_FILE}" mount --bind "${LOG_FILE}" "${chrootdir}/${LOG_FILE}"
mount --bind "/etc/resolv.conf" "${chrootdir}/etc/resolv.conf" mount --bind --options ro "/etc/resolv.conf" "${chrootdir}/etc/resolv.conf"
# Prevent services from being started in the chrooted environment # Prevent services from being started in the chrooted environment
rm -rf "${chrootdir:?}/fakebin" rm -rf "${chrootdir:?}/fakebin"
...@@ -31,7 +51,7 @@ initChroot() { ...@@ -31,7 +51,7 @@ initChroot() {
} }
closeChroot() { closeChroot() {
local chrootdir="${1}" local chrootdir="$1"
umount --lazy "${chrootdir}/etc/resolv.conf" umount --lazy "${chrootdir}/etc/resolv.conf"
umount --lazy "${chrootdir}/${LOG_FILE}" umount --lazy "${chrootdir}/${LOG_FILE}"
...@@ -39,7 +59,7 @@ closeChroot() { ...@@ -39,7 +59,7 @@ closeChroot() {
} }
function create_stub() { function create_stub() {
local script="${1}" local script="$1"
cat << EOF > "${script}" cat << EOF > "${script}"
#!/usr/bin/env bash #!/usr/bin/env bash
...@@ -53,31 +73,28 @@ EOF ...@@ -53,31 +73,28 @@ EOF
} }
addToChrootFile() { addToChrootFile() {
local chrootdir="${1}" local chrootdir="$1"
local script_name="${2}" local cmd="${2}"
local cmd="${3}"
if [ ! -f "${chrootdir}/tmp/${script_name}" ]; then if [ ! -f "${chrootdir}/tmp/exec.sh" ]; then
create_stub "${chrootdir}/tmp/${script_name}" create_stub "${chrootdir}/tmp/exec.sh"
fi fi
echo "${cmd}" >> "${chrootdir}/tmp/${script_name}" echo "${cmd}" >> "${chrootdir}/tmp/exec.sh"
} }
execChroot() { execChroot() {
local chrootdir="${1}" local chrootdir="$1"
local script_name="${2}"
[ ! -x "${chrootdir}/tmp/${script_name}" ] && chmod +x "${chrootdir}/tmp/${script_name}" [ ! -x "${chrootdir}/tmp/exec.sh" ] && chmod +x "${chrootdir}/tmp/exec.sh"
chroot "${chrootdir}" "/tmp/${script_name}" chroot "${chrootdir}" "/tmp/exec.sh"
rm --recursive --force "${chrootdir}/tmp/${script_name:?}" &>/dev/null rm --recursive --force "${chrootdir:?}/tmp/exec.sh" &>/dev/null
return $? return $?
} }
function cleanup() { function cleanup() {
local chrootdir="${1}" local chrootdir="$1"
local tmp="${2}"
if mountpoint --quiet "${chrootdir}/etc/resolv.conf"; then if mountpoint --quiet "${chrootdir}/etc/resolv.conf"; then
umount --lazy "${chrootdir}/etc/resolv.conf" umount --lazy "${chrootdir}/etc/resolv.conf"
...@@ -97,5 +114,4 @@ function cleanup() { ...@@ -97,5 +114,4 @@ function cleanup() {
if mountpoint --quiet "${chrootdir}/proc"; then if mountpoint --quiet "${chrootdir}/proc"; then
umount --lazy "${chrootdir}/proc" umount --lazy "${chrootdir}/proc"
fi 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 _HELP=false
_DIST="" _PROF=""
_ARCH="amd64" _INPUT=""
_OUTPUT=""
_REPO="stable" _REPO="stable"
_VERSION=""
_DEBUG=false
This diff is collapsed.
#!/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 ...@@ -7,30 +7,32 @@ readonly ALL=15
VERBOSE_FLAGS=${ALL} VERBOSE_FLAGS=${ALL}
mapType() { mapType() {
case "${1}" in case "$1" in
e | error ) echo "${ERROR}" ;; e | error ) echo "${ERROR}" ;;
w | warning ) echo "${WARNING}" ;; w | warning ) echo "${WARNING}" ;;
i | info ) echo "${INFO}" ;; i | info ) echo "${INFO}" ;;
d | debug ) echo "${DEBUG}" ;; d | debug ) echo "${DEBUG}" ;;
* ) createIsoLogger -m "Invalid type '${1}'" -T "LOGGER"; return 1 ;; * ) createIsoLogger -m "Invalid type '$1'" -T "LOGGER"; return 1 ;;
esac esac
} }
createIsoLogger() { createIsoLogger() {
TYPE="${ERROR}" TYPE="${ERROR}"
TAG=""
MSG="" MSG=""
SCRIPT="$(basename "${BASH_SOURCE[1]}")" SCRIPT="$(basename "${BASH_SOURCE[1]}")"
LINE="${BASH_LINENO[0]}" LINE="${BASH_LINENO[0]}"
while true; do while true; do
case "${1}" in case "${1}" in
-t | --type ) TYPE="$(mapType "${2}")" || return; shift; shift ;; -t | --type ) TYPE="$(mapType "$2")" || return; shift; shift ;;
-T | --tag ) TAG="${2}"; shift; shift ;; -T | --tag ) TAG="$2"; shift; shift ;;
-m | --message ) MSG="${2}"; shift; shift ;; -m | --message ) MSG="$2"; shift; shift ;;
-s | --script ) SCRIPT="${2}"; shift; shift ;; -s | --script ) SCRIPT="$2"; shift; shift ;;
-l | --line ) LINE="${2}"; shift; shift ;; -l | --line ) LINE="$2"; shift; shift ;;
-* ) createIsoLogger -m "Unrecognized option '${1}'" -T "LOGGER"; return ;; -* ) createIsoLogger -m \
"Unrecognized option '$1'" -T "LOGGER"; return ;;
* ) break ;; * ) break ;;
esac esac
done done
...@@ -50,13 +52,12 @@ createIsoLogger() { ...@@ -50,13 +52,12 @@ createIsoLogger() {
esac esac
echo -e "${LOG_LINE}" 1>&2 echo -e "${LOG_LINE}" 1>&2
echo -e "${LOG_LINE}" >> "${LOG_FILE}" echo -e "${LOG_LINE}" >> "${LOG_FILE}"
if [ "${TYPE}" -eq "${ERROR}" ] || [ "${TYPE}" -eq "${DEBUG}" ]; then
/bin/bash
fi
else else
createIsoLogger -m "Tried to use disabled type '${TYPE}'" -T "LOGGER" createIsoLogger -m "Tried to use disabled type '${TYPE}'" -T "LOGGER"
return
fi
if [ "${TYPE}" -eq "${ERROR}" ]; then
/bin/bash
fi 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:?}"
}
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-server-all
lc-client-all
ubuntu-standard
laptop-detect
dbus
wget
le-live-all
le-all le-all
linux-generic-hwe-16.04 linux-generic-hwe-16.04
xserver-xorg-hwe-16.04 xserver-xorg-hwe-16.04
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 # 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 #set -x
_DIST="${1}" _PROF="${1}"
PREFIX="${PWD}" PREFIX="${PWD}"
source "${PREFIX}/conf/${_DIST}/create-iso.conf" source "${PREFIX}/conf/${_PROF}/create-iso.conf"
source "${PREFIX}/common.sh" source "${PREFIX}/common.sh"
mkdir -p "${TMP}/bl/" mkdir -p "${TMP}/bl/"
......
...@@ -21,25 +21,18 @@ ...@@ -21,25 +21,18 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA. # USA.
# _DIST="${1}" # PROFILE="$1"
# _ARCH="${2}" # NAME="$2"
# _REPO="${3}" # WEBSITE="$3"
CHROOTDIR="${4}" # TMPFS="$4"
# SCRIPT_NAME="${5}" TMP="$5"
# DISTRO="${6}" CHROOTDIR="$6"
# DPLIST="${7}" # SCRIPTSDIR="$7"
# INSTLIST="${8}" # PKGLIST="$8"
# ISOLINUX="${9}" # SOURCESLIST="$9"
# MOUNTLIST="${10}" # REPO="${10}"
# OURSOURCESLIST="${11}" # KEYURL="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
# REPOPKGS="${19}"
PREFIX="${PWD}" PREFIX="${PWD}"
type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/common.sh" type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/common.sh"
...@@ -61,11 +54,14 @@ if mountpoint --quiet "${CHROOTDIR}/proc"; then ...@@ -61,11 +54,14 @@ if mountpoint --quiet "${CHROOTDIR}/proc"; then
umount "${CHROOTDIR}/proc" umount "${CHROOTDIR}/proc"
fi fi
mksquashfs "${CHROOTDIR}" "${TMP}/image/casper/filesystem.squashfs" -b 1M -no-recovery -processors "$(nproc)" || \ mksquashfs "${CHROOTDIR}" "${TMP}/image/casper/filesystem.squashfs" -b 1M \
createIsoLogger --message "Failed to compress ${CHROOTDIR}" --tag "mksquashfs" -no-recovery -processors "$(nproc)" -noappend || createIsoLogger --message \
pushd "${TMP}/image" || createIsoLogger --message "Unable to change directory" --tag "pushd" "Failed to compress ${CHROOTDIR}" --tag "mksquashfs"
find . -type f -print0 | xargs -0 md5sum | grep --invert-match "\\./md5sum.txt" > md5sum.txt || createIsoLogger \ pushd "${TMP}/image" || createIsoLogger --message "Unable to change directory" \
--message "Failed to generate md5sum" --tag "md5sum" --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" popd || createIsoLogger --message "Unable to change directory" --tag "popd"
exit 0 exit 0
...@@ -21,60 +21,60 @@ ...@@ -21,60 +21,60 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA. # USA.
# _DIST="${1}" # PROFILE="$1"
_ARCH="${2}" # NAME="$2"
_REPO="${3}" # WEBSITE="$3"
CHROOTDIR="${4}" # TMPFS="$4"
# SCRIPT_NAME="${5}" TMP="$5"
# DISTRO="${6}" CHROOTDIR="$6"
# DPLIST="${7}" # SCRIPTSDIR="$7"
# INSTLIST="${8}" PKGLIST="$8"
# ISOLINUX="${9}" # SOURCESLIST="$9"
# MOUNTLIST="${10}" REPO="${10}"
# OURSOURCESLIST="${11}" # KEYURL="${11}"
# RMDSKT="${12}"
# RMLIST="${13}"
# SCRIPTSDIR="${14}"
# SHORTNAME="${15}"
# SOURCESLISTDEFAULT="${16}"
TMP="${17}"
# TMPFS="${18}"
REPOPKGS="${19}"
PREFIX="${PWD}" PREFIX="${PWD}"
type addToChrootFile >/dev/null 2>&1 || source "${PREFIX}/common.sh" type addToChrootFile >/dev/null 2>&1 || source "${PREFIX}/common.sh"
type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/helper/logging.incsh" type createIsoLogger >/dev/null 2>&1 || source "${PREFIX}/helper/logging.incsh"
mount --bind "/etc/resolv.conf" "${CHROOTDIR}/etc/resolv.conf" 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)" fingerprint="$(gpg --list-keys --with-colons 'C3SL Live' | grep --max-count=1 \
'fpr' | cut --delimiter=':' --fields=10)"
if test -z "${fingerprint}"; then if test -z "${fingerprint}"; then
gpg --batch --no-tty --gen-key "${PREFIX}/src/gpg-key/gen-key-script" 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 fi
cp --recursive --archive "${PREFIX}/src/local-repository/" "${PREFIX}/repo/" cp --recursive --archive "${PREFIX}/src/local-repository/" "${PREFIX}/repo/"
sed -i "s/##ARCH##/ ${_ARCH}/" "${PREFIX}/repo/conf/distributions" || createIsoLogger --message \ sed -i "s/##GPGKEY##/ ${fingerprint}/" "${PREFIX}/repo/conf/distributions" || \
"Unable to setup architecture of local repository" --type warning --tag "sed" createIsoLogger --message "Unable to setup the key of local repository" --type \
sed -i "s/##GPGKEY##/ ${fingerprint}/" "${PREFIX}/repo/conf/distributions" || createIsoLogger --message \ warning --tag "sed"
"Unable to setup the key of local repository" --type warning --tag "sed" sed -i "s/##CODENAME##/ ${REPO}/" "${PREFIX}/repo/conf/distributions" || \
sed -i "s/##CODENAME##/ ${_REPO}/" "${PREFIX}/repo/conf/distributions" || createIsoLogger --message \ createIsoLogger --message "Unable to setup the codename of local repository" \
"Unable to setup the codename of local repository" --type warning --tag "sed" --type warning --tag "sed"
chroot "${CHROOTDIR}" apt-get clean 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 # shellcheck disable=SC2046
chroot "${CHROOTDIR}" apt-get --download-only --yes install $(grep --invert-match '^#' < "${REPOPKGS}" | tr '\n' ' ') || \ chroot "${CHROOTDIR}" apt-get --download-only --yes install $(grep \
createIsoLogger --message "Unable to download packages to local repository" --tag "apt-get" --invert-match '^#' < "${PKGLIST}/repo.list" | tr '\n' ' ') || \
reprepro --basedir "${PREFIX}/repo/" includedeb "${_REPO}" "${CHROOTDIR}"/var/cache/apt/archives/*.deb || \ createIsoLogger --message "Unable to download packages to local repository" \
createIsoLogger --message "Unable to include package to local repository" --tag "reprepro" --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 clean 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/" rm --recursive --force "${PREFIX:?}/repo/"
gpg --armor --export 'C3SL Live' > "${CHROOTDIR}/tmp/public.key" || createIsoLogger --message "Unable to export key" \ gpg --armor --export 'C3SL Live' > "${CHROOTDIR}/tmp/public.key" || \
--tag "gpg" 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" \ chroot "${CHROOTDIR}" apt-key add /tmp/public.key || createIsoLogger --message \
--tag "apt-key" "Unable to add key of local repository" --tag "apt-key"
rm "${CHROOTDIR:?}/tmp/public.key" rm "${CHROOTDIR:?}/tmp/public.key"
umount "${CHROOTDIR}/etc/resolv.conf" umount "${CHROOTDIR}/etc/resolv.conf"
......
...@@ -21,36 +21,33 @@ ...@@ -21,36 +21,33 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA. # USA.
# _DIST="${1}" # PROFILE="$1"
# _ARCH="${2}" # NAME="$2"
# _REPO="${3}" # WEBSITE="$3"