Commit c4e8744a authored by anonym's avatar anonym
Browse files

Refactor code for generating fake packages during build.

parent c1db9895
......@@ -13,6 +13,8 @@ echo "Install the Tor Browser"
# a new browser profile we can simply copy the profile directory
# without duplicating all extensions.
. /usr/local/lib/tails-shell-library/tor-browser.sh
# Import install_fake_package
. /usr/local/lib/tails-shell-library/build.sh
download_and_verify_files() {
local base_url bundles destination apt_proxy
......@@ -130,35 +132,6 @@ get_firefox_version() {
sed -n 's/^Version=\(.*\)$/\1/p' "${appini}"
}
# Create and install a fake iceweasel package so we can install our
# desired Debian-packaged Iceweasel addons
install_fake_iceweasel_pkg() {
local fake_version tmp
fake_version="${1}"
tmp="$(mktemp -d)"
apt-get install --yes equivs
cat > "${tmp}"/iceweasel.control << EOF
Section: web
Priority: optional
Homepage: https://tails.boum.org/
Standards-Version: 3.6.2
Package: iceweasel
Version: ${fake_version}
Maintainer: Tails developers <amnesia@boum.org>
Architecture: all
Description: (Fake) Iceweasel
Make it possible to install Debian's Iceweasel addons without having to
install a real Iceweasel.
EOF
(
cd "${tmp}"
equivs-build "${tmp}"/iceweasel.control
dpkg -i "${tmp}"/iceweasel_"${fake_version}"_all.deb
)
rm -R "${tmp}"
}
install_debian_extensions() {
local destination
destination="${1}"
......@@ -218,7 +191,7 @@ rmdir "${TBB_INSTALL}"/TorBrowser/Data/Browser/profile.default/extensions
# Iceweasel equivs package to satisfy the dependencies.
FIREFOX_VERSION=$(get_firefox_version "${TBB_INSTALL}"/application.ini)
FAKE_ICEWEASEL_VERSION=${FIREFOX_VERSION}+fake1
install_fake_iceweasel_pkg "${FAKE_ICEWEASEL_VERSION}"
install_fake_package iceweasel "${FAKE_ICEWEASEL_VERSION}" web
install_debian_extensions "${TBB_EXT}" ${DEBIAN_EXT_PKGS}
mkdir -p "${TBB_PROFILE}"
......
......@@ -5,31 +5,9 @@ set -u
echo "Install a fake gnome-backgrounds package"
tmp="$(mktemp -d)"
apt-get install --yes equivs
# Import install_fake_package
. /usr/local/lib/tails-shell-library/build.sh
REAL_PKG_VERSION=$(dpkg-query -W -f='${Version}\n' gnome-backgrounds)
FAKE_PKG_VERSION=${REAL_PKG_VERSION}+tails.fake1
cat > "${tmp}"/gnome-backgrounds.control << EOF
Section: gnome
Priority: optional
Homepage: https://tails.boum.org/
Standards-Version: 3.9.6
Package: gnome-backgrounds
Version: ${FAKE_PKG_VERSION}
Maintainer: Tails developers <amnesia@boum.org>
Architecture: all
Description: (Fake) gnome-backgrounds
Make it possible to install gnome-shell without having to
install a real gnome-backgrounds package.
EOF
(
cd "${tmp}"
equivs-build "${tmp}"/gnome-backgrounds.control
dpkg -i "${tmp}"/gnome-backgrounds_"${FAKE_PKG_VERSION}"_all.deb
)
rm -R "${tmp}"
install_fake_package gnome-backgrounds "${FAKE_PKG_VERSION}" gnome
......@@ -4,6 +4,9 @@ set -u
echo "Installing libdvd-pkg"
# Import install_fake_package
. /usr/local/lib/tails-shell-library/build.sh
apt-get --yes install libdvd-pkg
dpkg-reconfigure libdvd-pkg
......@@ -12,31 +15,8 @@ dpkg-reconfigure libdvd-pkg
# libdvd-pkg. libdvd-pkg however depends on build-essential, which is
# explicitly removed. So instead we build/install a fake libdvd-pkg
# without the build-essential dependency to satisfy libdvdcss2.
tmp="$(mktemp -d)"
apt-get install --yes equivs
LIBDVD_PKG_VERSION="$(dpkg-query -s libdvd-pkg | grep Version | cut -d ' ' -f2)+fake1"
cat > "${tmp}/libdvd-pkg-${LIBDVD_PKG_VERSION}.control" << EOF
Section: multimedia
Priority: optional
Homepage: https://tails.boum.org/
Standards-Version: 3.6.2
Package: libdvd-pkg
Version: ${LIBDVD_PKG_VERSION}
Maintainer: Tails developers <amnesia@boum.org>
Architecture: all
Description: (Fake) libdvd-pkg package
Provide placeholder to keep libdvdcss2 happy.
EOF
(
cd "${tmp}"
equivs-build "libdvd-pkg-${LIBDVD_PKG_VERSION}.control"
dpkg -i "libdvd-pkg_${LIBDVD_PKG_VERSION}_all.deb"
)
rm -r "${tmp}" /usr/src/libdvd-pkg
install_fake_package libdvd-pkg "${LIBDVD_PKG_VERSION}" multimedia
# Verify installed packages:
for x in libdvd-pkg
......
......@@ -18,6 +18,9 @@ rm $POTFILES_DOT_IN
# (by the 10-tbb hook)
rm /usr/share/tails/tbb-*.txt
# This shell library is only used during build
rm /usr/local/lib/tails-shell-library/build.sh
# Prevent races between MAC spoofing and interface naming
rm /lib/udev/rules.d/75-persistent-net-generator.rules
......
#!/bin/sh
# Import is_package_installed
. /usr/local/lib/tails-shell-library/common.sh
install_fake_package() {
local name version section tmp control_file
name="${1}"
version="${2}"
section="${3:-misc}"
if ! is_package_installed equivs; then
apt-get install --yes equivs
fi
tmp="$(mktemp -d)"
control_file="${tmp}/${name}_${version}.control"
cat > "${control_file}" << EOF
Section: ${section}
Priority: optional
Homepage: https://tails.boum.org/
Standards-Version: 3.9.6
Package: ${name}
Version: ${version}
Maintainer: Tails developers <tails@boum.org>
Architecture: all
Description: (Fake) ${name}
Dummy packaged used to meet some dependency without installing the
real ${name} package.
EOF
(
cd "${tmp}"
equivs-build "${control_file}"
dpkg -i "${tmp}/${name}_${version}_all.deb"
)
rm -R "${tmp}"
}
......@@ -79,3 +79,12 @@ no_abort() {
fi
return 0
}
is_package_installed() {
local status
package_name="${1}"
package_status="$(no_abort dpkg-query --show \
--showformat='${db:Status-Status}' "${package_name}" \
2>/dev/null)"
[ "${package_status}" = "installed" ]
}
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