tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

preinst (1091B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 mv_conffile() {
      6   local package='alsa-utils'
      7   local name="$1"
      8   local newname="$2"
      9 
     10   [ -e "$name" ] || return 0
     11 
     12   local md5="$(md5sum $name | sed -e 's/ .*//')"
     13   oldmd5="$(dpkg-query -W -f='${Conffiles}' $package | \
     14     sed -n -e "\' $name ' { s/ obsolete$//; s/.* //; p }")"
     15 
     16   if [ "$md5" = "$oldmd5" ]; then
     17     rm -f "$name"
     18   else
     19     mv "$name" "$newname"
     20   fi
     21 }
     22 
     23 rm_conffile() {
     24   mv_conffile "$1" "$1.dpkg-bak"
     25 }
     26 
     27 case "$1" in
     28   install|upgrade)
     29 	# Delete obsolete alsa-base dev.d symlinks
     30 	for N in 0 1 2 3 4 5 6 7 ; do
     31 		D="/etc/dev.d/snd/controlC$N"
     32 		if [ -d "$D" ] ; then
     33 			L="$D/alsa-base.dev"
     34 			rm -f "$L"
     35 		fi
     36 	done
     37 	# Delete obsolete alsa-base dev.d script
     38 	rm_conffile /etc/alsa/dev.d/alsa-base
     39 	# Delete obsolete modprobe dir
     40 	rm -rf /etc/alsa/modprobe-post-install.d
     41 	# Remove udev rules symlink and alsa-utils.rules since it is stored as
     42 	# /lib/udev/rules.d/80-alsa.rules
     43 	L="/etc/udev/rules.d/z60_alsa-utils.rules"
     44 	[ -L "$L" ] && rm -f "$L"
     45 	rm_conffile /etc/udev/alsa-utils.rules
     46 	;;
     47   abort-upgrade)
     48 	# Nothing to do
     49 	;;
     50 esac
     51 
     52 #DEBHELPER#