Linux puskom-ProLiant-DL385-Gen10 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64
/
var
/
lib
/
dpkg
/
info
/
/var/lib/dpkg/info/libmtp9:amd64.preinst
#!/bin/sh # preinst script for libmtp set -e PACKAGE=libmtp9 # Prepare to move a conffile without triggering a dpkg question prep_mv_conffile() { PKGNAME="$1" CONFFILE="$2" if [ -e "$CONFFILE" ]; then md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`" if [ "$md5sum" = "$old_md5sum" ]; then rm -f "$CONFFILE" fi fi } case "$1" in install|upgrade) # PART B: Check if file /etc/udev/libmtp.rules exists # Do not mix with package-default rules file: /lib/udev/rules.d/libmtp8.rules if [ -e "/etc/udev/libmtp.rules" ]; then # Check if libmtp5 or early libmtp6 (<< 0.2.1-2) are installed (and not purged) # Default: Remove /etc/udev/libmtp.rules removeit="1" # Get libmtp* package list in the format '${Package} ${Version}' listpkgs="`dpkg-query -W -f '${Package} ${Version}\n' 'libmtp*' | grep '^libmtp[0-9]\+\ '`" # Separate by new line IFS=$(printf "\n") for ipkg in $listpkgs; do name="`echo $ipkg | cut -d' ' -f1`" version="`echo $ipkg | cut -d' ' -f2`" # Exception: Do not remove if libmtp5 is installed if [ "$name" = "libmtp5" -a ! "$version" = "" ]; then removeit="0" fi # Exception: Do not remove if libmtp6 (<< 0.2.1-2) is installed if [ "$name" = "libmtp6" -a ! "$version" = ""]; then if dpkg --compare-versions "$version" lt-nl "0.2.1-2"; then removeit="0" fi fi done unset IFS # If not installed, remove the old libmtp.rules [ "$removeit" = "1" ] && rm -f /etc/udev/libmtp.rules # Its symlink, /etc/udev/rules.d/libmtp.rules, is checked in postinst fi # PART C: # Disabled until the package libmtp-common is made. # /lib/udev/rules.d/libmtp8.rules is rules file installed by default. # Do not mix with user-modified file: /etc/udev/rules.d/libmtp8.rules # Will be replaced by unversioned /lib/udev/rules.d/45-libmtp.rules #rm_conffile $PACKAGE /lib/udev/rules.d/45-libmtp8.rules # PART D: # Remove ancient /etc/udev/rules.d/65-libmtp.rules if [ -e /etc/udev/rules.d/65-libmtp.rules ]; then dpkg-maintscript-helper rm_conffile \ /etc/udev/rules.d/65-libmtp.rules -- "$@" fi esac exit 0