HEX
Server: Apache
System: Linux vps37023 6.8.0-83-generic #83~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Sep 9 18:19:47 UTC 2 x86_64
User: alternativsm (5771646)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: //var/lib/dpkg/info/mpg123.postinst
#!/bin/sh

set -e

remove_alternative()
{
	test -n "$1" || continue

	FILENAME="$1"

	update-alternatives --remove mpg123 "/usr/bin/$FILENAME"
	update-alternatives --remove mp3-decoder "/usr/bin/$FILENAME"
}

install_alternative()
{
	test -n "$1" || continue
	test -n "$2" || continue

	FILENAME="$1"
	PRIORITY="$2"

	test -e "/usr/bin/$FILENAME" || continue

	# Not a typo: For mpg123, we effectively add 100 to the
	# priority used for mp3-decoder to get us atop of mpg321.
	# We /are/ mpg123, after all, and we are no longer non-free.
	# This hack can be dropped if mpg321 chooses to lower its
	# mpg123 priority.
	update-alternatives --install \
		/usr/bin/mpg123 mpg123 "/usr/bin/$FILENAME" \
		"1$PRIORITY" \
		--slave /usr/share/man/man1/mpg123.1.gz mpg123.1.gz \
		"/usr/share/man/man1/$FILENAME.1.gz"

	update-alternatives --install \
		/usr/bin/mp3-decoder mp3-decoder "/usr/bin/$FILENAME" \
		"$PRIORITY" \
		--slave /usr/share/man/man1/mp3-decoder.1.gz \
		mp3-decoder.1.gz \
		"/usr/share/man/man1/$FILENAME.1.gz"
}

case "$1" in
	configure)
		# Specific alternatives are no longer required with
		# output auto-detection.
		OBSOLETES="mpg123-oss mpg123-alsa mpg123-esd mpg123-nas mpg123-oss-i486"
		for i in $OBSOLETES; do
			remove_alternative "$i"
		done

		# Install generic binary as the only alternative.
		install_alternative mpg123.bin 20
		;;
	abort-upgrade|abort-remove|abort-deconfigure)
		;;
	*)
		echo "postinst called with unknown argument \'$1\'" >&2
		exit 0
esac



exit 0