| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
remove_alternative() |
| 6 |
{ |
| 7 |
test -n "$1" || continue |
| 8 |
|
| 9 |
FILENAME="$1" |
| 10 |
|
| 11 |
update-alternatives --remove mpg123 "/usr/bin/$FILENAME" |
| 12 |
update-alternatives --remove mp3-decoder "/usr/bin/$FILENAME" |
| 13 |
} |
| 14 |
|
| 15 |
install_alternative() |
| 16 |
{ |
| 17 |
test -n "$1" || continue |
| 18 |
test -n "$2" || continue |
| 19 |
|
| 20 |
FILENAME="$1" |
| 21 |
PRIORITY="$2" |
| 22 |
|
| 23 |
test -e "/usr/bin/$FILENAME" || continue |
| 24 |
|
| 25 |
# Not a typo: For mpg123, we effectively add 100 to the |
| 26 |
# priority used for mp3-decoder to get us atop of mpg321. |
| 27 |
# We /are/ mpg123, after all, and we are no longer non-free. |
| 28 |
# This hack can be dropped if mpg321 chooses to lower its |
| 29 |
# mpg123 priority. |
| 30 |
update-alternatives --install \ |
| 31 |
/usr/bin/mpg123 mpg123 "/usr/bin/$FILENAME" \ |
| 32 |
"1$PRIORITY" \ |
| 33 |
--slave /usr/share/man/man1/mpg123.1.gz mpg123.1.gz \ |
| 34 |
"/usr/share/man/man1/$FILENAME.1.gz" |
| 35 |
|
| 36 |
update-alternatives --install \ |
| 37 |
/usr/bin/mp3-decoder mp3-decoder "/usr/bin/$FILENAME" \ |
| 38 |
"$PRIORITY" \ |
| 39 |
--slave /usr/share/man/man1/mp3-decoder.1.gz \ |
| 40 |
mp3-decoder.1.gz \ |
| 41 |
"/usr/share/man/man1/$FILENAME.1.gz" |
| 42 |
} |
| 43 |
|
| 44 |
case "$1" in |
| 45 |
configure) |
| 46 |
# Specific alternatives are no longer required with |
| 47 |
# output auto-detection. |
| 48 |
OBSOLETES="mpg123-oss mpg123-alsa mpg123-esd mpg123-nas mpg123-oss-i486" |
| 49 |
for i in $OBSOLETES; do |
| 50 |
remove_alternative "$i" |
| 51 |
done |
| 52 |
|
| 53 |
# Install generic binary as the only alternative. |
| 54 |
install_alternative mpg123.bin 20 |
| 55 |
;; |
| 56 |
abort-upgrade|abort-remove|abort-deconfigure) |
| 57 |
;; |
| 58 |
*) |
| 59 |
echo "postinst called with unknown argument \'$1\'" >&2 |
| 60 |
exit 0 |
| 61 |
esac |
| 62 |
|
| 63 |
#DEBHELPER# |
| 64 |
|
| 65 |
exit 0 |
| 66 |
|