Commit 0428e85e authored by sulzbach's avatar sulzbach

SCRUM#617: Enable apport in debug mode only

parent 130bbe48
......@@ -36,7 +36,7 @@ initChroot() {
mount --bind "${LOG_FILE}" "${chrootdir}/${LOG_FILE}"
mount --bind --options ro "/etc/resolv.conf" "${chrootdir}/etc/resolv.conf"
mount --bind "/etc/resolv.conf" "${chrootdir}/etc/resolv.conf"
# Prevent services from being started in the chrooted environment
rm -rf "${chrootdir:?}/fakebin"
......
......@@ -111,8 +111,9 @@ source "${PREFIX}/helper/logging.incsh"
# [ "${_DEBUG}" == false ] && let VERBOSE_FLAGS="${ALL} ^ ${DEBUG}"
# Installation of create-iso's dependencies
apt-get install isolinux syslinux squashfs-tools genisoimage xorriso --yes || \
createIsoLogger --message "Failed to install basic tools" --tag "apt-get"
apt-get install isolinux syslinux squashfs-tools genisoimage xorriso reprepro \
binwalk --yes || createIsoLogger --message "Failed to install basic tools" \
--tag "apt-get"
if [ -z "${_INPUT}" ]; then
NEWMD5="$(wget "${ISOURL}/MD5SUMS" -O- | grep "amd64" | sort \
......@@ -155,6 +156,7 @@ mkdir --parents "${TMPFS}"
--options "suid,dev,size=${TMPFS_SIZE}") || createIsoLogger --message \
"Unable to mount tmpfs" --tag "mount"
# TODO: Decide what to do when generating for production. Cache is being currently used here, but the generated entry is being discarded.
mkdir --parents "${CACHEDIR}"
find="$(find "${CACHEDIR}" -mindepth 1 -maxdepth 1 -type d | sort --numeric)"
if [ -z "${find}" ]; then
......@@ -227,7 +229,8 @@ for script in "${SCRIPTSDIR}"/*; do
"${SOURCESLIST}" \
"${_REPO}" \
"${KEYURL}" \
"${CACHEDIR}"; then
"${CACHEDIR}" \
"${_DEBUG}"; then
cleanup "${CHROOTDIR}"
createIsoLogger --message "Failed to run script"
exit 1
......@@ -242,7 +245,6 @@ for script in "${SCRIPTSDIR}"/*; do
if [[ "$(basename "${script}")" =~ [0-9]+\-chroot\.* ]]; then
initChroot "${CHROOTDIR}" "${LOG_FILE}"
execChroot "${CHROOTDIR}" "${SCRIPT_NAME}"
# [[ "$(basename "${script}")" =~ [0-9]+\-chroot\.update-sourceslist\.sh ]] && createIsoLogger -m "Breakpoint" -t d
closeChroot "${CHROOTDIR}" "${LOG_FILE}"
fi
fi
......
lc-conf
lc-server-all
lc-client-all
......@@ -62,6 +62,7 @@ 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"
......
......@@ -32,6 +32,8 @@ CHROOTDIR="$6"
# SOURCESLIST="$9"
# REPO="${10}"
# KEYURL="${11}"
# CACHEDIR="${12}"
_DEBUG="${13}"
PREFIX="${PWD}"
......@@ -52,6 +54,23 @@ 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"
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)" || \
......
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,15 +12,18 @@ ubiquity ubiquity/success_command \
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 apt-get install --yes lc-server-all; \
else; \
in-target apt-get install --yes lc-client-all; \
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=0/' /target/etc/default/apport; \
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,6 +12,7 @@ ubiquity ubiquity/success_command \
fi; \
fi; \
in-target apt-cdrom add --fast --no-mount </dev/null; \
in-target apt-get update --yes; \
in-target apt-get install --yes le-conf; \
if grep -qi "multiseat" "/etc/default/multiseat"; then \
in-target apt-get install --yes le-multiterminal; \
......@@ -20,6 +20,6 @@ ubiquity ubiquity/success_command \
umount "/target/cdrom"; \
unlink "/target/media/cdrom"; \
sed -i "/^deb cdrom:/s/^/#/" /target/etc/apt/sources.list; \
sed -i 's/enabled=.*/enabled=0/' /target/etc/default/apport; \
sed -i 's/enabled=.*/enabled=##APPORT##/' /target/etc/default/apport; \
in-target apt-get autoremove --yes; \
in-target apt-get clean
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment