Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/pulseaudio-module-xrdp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt335672 <30179339+matt335672@users.noreply.github.com>2022-03-14 15:25:41 +0300
committermatt335672 <30179339+matt335672@users.noreply.github.com>2022-03-14 15:25:41 +0300
commit39ed564d0c23b0dac38377ef13ac79e0a846d30f (patch)
tree13dfb128f48fe309d2eb9911f5dd36419fb5bd9b
parent1905083e71b58263ffedcdce130ee8fb22f8190c (diff)
Add suite support to the wrapper script
-rwxr-xr-xscripts/install_pulseaudio_sources_apt.sh40
-rwxr-xr-xscripts/install_pulseaudio_sources_apt_wrapper.sh66
2 files changed, 86 insertions, 20 deletions
diff --git a/scripts/install_pulseaudio_sources_apt.sh b/scripts/install_pulseaudio_sources_apt.sh
index 94df25a..d2cfe6a 100755
--- a/scripts/install_pulseaudio_sources_apt.sh
+++ b/scripts/install_pulseaudio_sources_apt.sh
@@ -53,11 +53,47 @@ done
if [ ! -d "$PULSE_DIR" ]; then
# Operating system release ?
RELEASE="$(lsb_release -si)-$(lsb_release -sr)"
- echo "Building for : $RELEASE"
+ codename=$(lsb_release -cs)
+ echo "Building for : $RELEASE ($codename)"
+
+ # Do any special-case stuff related to repositories
+ case $(lsb_release -si) in
+ Ubuntu)
+ # Enable the universe repository. Don't use add-apt-repository
+ # as this has a huge number of dependencies.
+ if ! grep -q '^ *[^#].* universe *' /etc/apt/sources.list; then
+ echo "- Adding 'universe' repository" >&2
+ cp /etc/apt/sources.list /tmp/sources.list
+ while read type url suite rest; do
+ if [ "$type" = deb -a "$rest" = main ]; then
+ case "$suite" in
+ $codename | $codename-updates | $codename-security)
+ echo "deb $url $suite universe"
+ ;;
+ esac
+ fi
+ done </tmp/sources.list \
+ | sudo tee -a /etc/apt/sources.list >/dev/null
+ rm /tmp/sources.list
+ fi
+ ;;
+ esac
# Make sure sources are available
if ! grep -q '^ *deb-src' /etc/apt/sources.list; then
- sudo sed -i.bak -e 's|^# deb-src|deb-src|' /etc/apt/sources.list
+ echo "- Adding source repositories" >&2
+ cp /etc/apt/sources.list /tmp/sources.list
+ while read type url suite rest; do
+ if [ "$type" = deb ]; then
+ case "$suite" in
+ $codename | $codename-updates | $codename-security)
+ echo "deb-src $url $suite $rest"
+ ;;
+ esac
+ fi
+ done </tmp/sources.list \
+ | sudo tee -a /etc/apt/sources.list >/dev/null
+ rm /tmp/sources.list
fi
sudo apt-get update
diff --git a/scripts/install_pulseaudio_sources_apt_wrapper.sh b/scripts/install_pulseaudio_sources_apt_wrapper.sh
index 04d336f..7b6f531 100755
--- a/scripts/install_pulseaudio_sources_apt_wrapper.sh
+++ b/scripts/install_pulseaudio_sources_apt_wrapper.sh
@@ -18,10 +18,21 @@
#
# Wrapper to call install_pulseaudio_sources.sh and tidy up afterwards
-
-# The command line switches --mirror= and --keyring= can be specified if
-# these switches are needed for a system based on Debian (e.g. a Raspberry
-# Pi)
+#
+# The following command line switches are supported, for systems based on
+# Debian or Ubuntu:-
+#
+# 1) --mirror= Specify an alternative mirror for debootstrap
+# 2) --keyring= Specify an alternative keyring for debootstrap
+# 3) --suite= Specify an alternative suite for debootstrap
+#
+# The first two of these are are needed for systems with their own
+# mirrors and signing keys (i.e. Raspberry PI OS).
+#
+# --suite is useful for systems which report their own codename for
+# `lsb_release -c`, but are otherwise based on a standard distro. For
+# example Linux Mint 20.04 reports 'una', but is largely based on
+# Ubuntu 'focal'
# ---------------------------------------------------------------------------
# G L O B A L S
@@ -43,6 +54,16 @@ BUILDROOT=/var/lib/pa-build/$USER
WRAPPED_SCRIPT_DEPS="sudo lsb-release"
# -----------------------------------------------------------------------------
+# S U I T E E X I S T S
+#
+# Does the specified debootstrap suite exist?
+# -----------------------------------------------------------------------------
+SuiteExists()
+{
+ [ -f "/usr/share/debootstrap/scripts/$1" ]
+}
+
+# -----------------------------------------------------------------------------
# I N S T A L L R E Q U I R E D P A C K A G E S
#
# Installs packages required for the build on the host machine
@@ -101,9 +122,9 @@ RunWrappedScript()
# -----------------------------------------------------------------------------
# M A I N
# -----------------------------------------------------------------------------
-
debootstrap_mirror=""
debootstrap_switches=""
+debootstrap_suite=""
# Parse command line switches
while [ -n "$1" ]; do
@@ -119,6 +140,13 @@ while [ -n "$1" ]; do
echo "** Ignoring missing keyring $1" >&2
fi
;;
+ --suite=*)
+ debootstrap_suite="${1#--suite=}"
+ if ! SuiteExists "$debootstrap_suite"; then
+ echo "** Unsupported suite '$debootstrap_suite'" >&2
+ exit 1
+ fi
+ ;;
*) echo "** Unrecognised parameter '$1'" >&2
exit 1
esac
@@ -144,19 +172,27 @@ fi
# Do we need extra packages?
InstallRequiredPackages || exit $?
-# We should be able to determine the distro now
-distro=$(lsb_release -cs) ; # e.g. 'bullseye'
-if [ -z "$distro" ]; then
- echo "** Can't determine current distro" >&2
- exit 1
+# We should be able to determine the suite now, if it's not specified
+if [ -z "$debootstrap_suite" ]; then
+ debootstrap_suite=$(lsb_release -cs) ; # e.g. 'bullseye'
+ if [ -z "$debootstrap_suite" ]; then
+ echo "** Can't determine current suite" >&2
+ exit 1
+ fi
+
+ if ! SuiteExists "$debootstrap_suite" ; then
+ echo "** Current distro '$debootstrap_suite' does not appear to be supported by debootstrap" >&2
+ echo " Need --suite switch?" >&2
+ exit 1
+ fi
fi
# Create the build root
log=/var/tmp/pa-build-$USER-debootstrap.log
-echo "- Creating $distro build root. Log file in $log"
+echo "- Creating $debootstrap_suite build root. Log file in $log"
sudo debootstrap \
$debootstrap_switches \
- $distro $BUILDROOT "$debootstrap_mirror" >$log 2>&1 || {
+ $debootstrap_suite $BUILDROOT "$debootstrap_mirror" >$log 2>&1 || {
echo "** debootstrap failed. Check log file $log" >&2
exit 1
}
@@ -173,12 +209,6 @@ echo "- Creating schroot config file $schroot_conf"
echo "type=directory"
} | sudo tee $schroot_conf >/dev/null || exit $?
-# Copy some files to the build root
-for file in /etc/apt/sources.list; do
- echo "- Copying $file to the root"
- sudo cp $file $BUILDROOT/$file || exit $?
-done
-
# Copy the wrapped script to the buildroot root
echo "- Copying the wrapped script to the root"
sudo cp $WRAPPED_SCRIPT $BUILDROOT/wrapped_script || exit $?