2015-02-05 02:33:14 -01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
## live-build(7) - System Build Scripts
|
2020-03-11 09:07:21 -01:00
|
|
|
## Copyright (C) 2016-2020 The Debian Live team
|
|
|
|
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
2015-02-05 02:33:14 -01:00
|
|
|
##
|
|
|
|
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
|
|
|
## This is free software, and you are welcome to redistribute it
|
|
|
|
## under certain conditions; see COPYING for details.
|
|
|
|
|
|
|
|
|
|
|
|
Create_apt_sources_list ()
|
|
|
|
{
|
|
|
|
local PARENT_MIRROR
|
|
|
|
local MIRROR
|
|
|
|
local PARENT_MIRROR_SECURITY
|
|
|
|
local MIRROR_SECURITY
|
|
|
|
local PARENT_DISTRIBUTION
|
|
|
|
local DISTRIBUTION
|
|
|
|
|
|
|
|
case "${1}" in
|
|
|
|
chroot)
|
|
|
|
PARENT_MIRROR=${LB_PARENT_MIRROR_CHROOT}
|
|
|
|
MIRROR=${LB_MIRROR_CHROOT}
|
|
|
|
PARENT_MIRROR_SECURITY=${LB_PARENT_MIRROR_CHROOT_SECURITY}
|
|
|
|
MIRROR_SECURITY=${LB_MIRROR_CHROOT_SECURITY}
|
|
|
|
PARENT_DISTRIBUTION=${LB_PARENT_DISTRIBUTION_CHROOT}
|
|
|
|
DISTRIBUTION=${LB_DISTRIBUTION_CHROOT}
|
|
|
|
;;
|
|
|
|
binary)
|
|
|
|
PARENT_MIRROR=${LB_PARENT_MIRROR_BINARY}
|
|
|
|
MIRROR=${LB_MIRROR_BINARY}
|
|
|
|
PARENT_MIRROR_SECURITY=${LB_PARENT_MIRROR_BINARY_SECURITY}
|
|
|
|
MIRROR_SECURITY=${LB_MIRROR_BINARY_SECURITY}
|
|
|
|
PARENT_DISTRIBUTION=${LB_PARENT_DISTRIBUTION_BINARY}
|
|
|
|
DISTRIBUTION=${LB_DISTRIBUTION_BINARY}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
Echo_error "Invalid mode '${1}' specified for source list creation!"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-03-18 15:55:37 -01:00
|
|
|
local _PASS="${2}"
|
|
|
|
|
2015-02-05 02:33:14 -01:00
|
|
|
local PARENT_FILE
|
|
|
|
case "${LB_DERIVATIVE}" in
|
|
|
|
true)
|
|
|
|
PARENT_FILE="sources.list.d/debian.list"
|
|
|
|
;;
|
|
|
|
|
|
|
|
false)
|
|
|
|
PARENT_FILE="sources.list"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
local LIST_FILE="chroot/etc/apt/sources.list.d/${LB_MODE}.list"
|
|
|
|
local PARENT_LIST_FILE="chroot/etc/apt/${PARENT_FILE}"
|
|
|
|
|
|
|
|
local _DISTRIBUTION
|
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]; then
|
|
|
|
_DISTRIBUTION="$(echo ${DISTRIBUTION} | sed -e 's|-backports||')"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Clear out existing lists
|
|
|
|
rm -f ${PARENT_LIST_FILE} ${LIST_FILE}
|
|
|
|
|
|
|
|
# Set general repo
|
|
|
|
echo "deb ${PARENT_MIRROR} ${PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> ${PARENT_LIST_FILE}
|
2020-02-25 01:33:50 -01:00
|
|
|
echo "deb-src ${PARENT_MIRROR} ${PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
2015-02-05 02:33:14 -01:00
|
|
|
|
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]; then
|
|
|
|
echo "deb ${MIRROR} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> "${LIST_FILE}"
|
2020-02-25 01:33:50 -01:00
|
|
|
echo "deb-src ${MIRROR} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> "${LIST_FILE}"
|
2015-02-05 02:33:14 -01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Set security repo
|
|
|
|
if [ "${LB_SECURITY}" = "true" ]; then
|
|
|
|
case "${LB_MODE}" in
|
2020-03-18 23:19:26 -01:00
|
|
|
debian)
|
2015-02-05 02:33:14 -01:00
|
|
|
case "${PARENT_DISTRIBUTION}" in
|
2021-01-08 08:32:01 -01:00
|
|
|
sid|unstable)
|
2015-02-05 02:33:14 -01:00
|
|
|
# do nothing
|
|
|
|
;;
|
|
|
|
|
2021-03-11 10:55:44 -01:00
|
|
|
buster|jessie|stretch)
|
2015-02-05 02:33:14 -01:00
|
|
|
echo "deb ${PARENT_MIRROR_SECURITY} ${PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
2020-02-25 01:33:50 -01:00
|
|
|
echo "deb-src ${PARENT_MIRROR_SECURITY} ${PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
2015-02-05 02:33:14 -01:00
|
|
|
;;
|
2021-03-11 10:55:44 -01:00
|
|
|
*)
|
2021-03-30 14:30:32 +00:00
|
|
|
echo "deb ${PARENT_MIRROR_SECURITY} ${PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
|
|
|
echo "deb-src ${PARENT_MIRROR_SECURITY} ${PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
2021-03-11 10:55:44 -01:00
|
|
|
;;
|
2015-02-05 02:33:14 -01:00
|
|
|
esac
|
|
|
|
|
2020-03-18 23:19:26 -01:00
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]; then
|
|
|
|
echo "deb ${MIRROR_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> "${LIST_FILE}"
|
|
|
|
echo "deb-src ${MIRROR_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> "${LIST_FILE}"
|
2015-02-05 02:33:14 -01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set updates repo
|
|
|
|
if [ "${LB_UPDATES}" = "true" ]; then
|
|
|
|
echo "deb ${PARENT_MIRROR} ${PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
2020-02-25 01:33:50 -01:00
|
|
|
echo "deb-src ${PARENT_MIRROR} ${PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
2015-02-05 02:33:14 -01:00
|
|
|
|
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]; then
|
|
|
|
echo "deb ${MIRROR} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> "${LIST_FILE}"
|
2020-02-25 01:33:50 -01:00
|
|
|
echo "deb-src ${MIRROR} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> "${LIST_FILE}"
|
2015-02-05 02:33:14 -01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set backports repo
|
|
|
|
if [ "${LB_BACKPORTS}" = "true" ]; then
|
|
|
|
case "${LB_MODE}" in
|
|
|
|
debian)
|
2021-01-08 08:32:01 -01:00
|
|
|
if [ "${PARENT_DISTRIBUTION}" != "sid" ] && [ "${PARENT_DISTRIBUTION}" != "unstable" ]; then
|
2015-02-05 02:33:14 -01:00
|
|
|
echo "deb ${PARENT_MIRROR} ${PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
2020-02-25 01:33:50 -01:00
|
|
|
echo "deb-src ${PARENT_MIRROR} ${PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> "${PARENT_LIST_FILE}"
|
2015-02-05 02:33:14 -01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]; then
|
|
|
|
echo "deb ${MIRROR} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> "${LIST_FILE}"
|
2020-02-25 01:33:50 -01:00
|
|
|
echo "deb-src ${MIRROR} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> "${LIST_FILE}"
|
|
|
|
fi
|
|
|
|
fi
|
2015-02-05 02:33:14 -01:00
|
|
|
|
2020-02-25 01:33:50 -01:00
|
|
|
# Disable deb-src entries?
|
|
|
|
if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" != "true" ]; then
|
2020-02-25 01:33:50 -01:00
|
|
|
sed -i "s/^deb-src/#deb-src/g" "${PARENT_LIST_FILE}"
|
2020-02-25 01:33:50 -01:00
|
|
|
if [ "${LB_DERIVATIVE}" = "true" ]; then
|
2020-02-25 01:33:50 -01:00
|
|
|
sed -i "s/^deb-src/#deb-src/g" "${LIST_FILE}"
|
2015-02-05 02:33:14 -01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|