| Server IP : 185.11.201.71 / Your IP : 192.168.7.18 Web Server : Apache/2.4.29 (Ubuntu) System : Linux tech-virtual-machine 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 User : tech ( 1000) PHP Version : 7.4.28 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/lib/dpkg/info/ |
Upload File : |
#!/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