68 lines
2.1 KiB
Bash
68 lines
2.1 KiB
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
if [ "$1" = "upgrade" ] || [ "$1" = "install" ]; then
|
|
# Remove wrongly replaced custom.config file by versions > 3.37.90 && < 3.38.1
|
|
# This script can be safely removed post 20.10 release
|
|
prev_version="$2"
|
|
if dpkg --compare-versions "$prev_version" ge 3.37.90 &&
|
|
dpkg --compare-versions "$prev_version" lt-nl 3.38.1; then
|
|
conf_file=/etc/gdm3/daemon.conf
|
|
if [ "${prev_version#*ubuntu}" != "$prev_version" ]; then
|
|
conf_file=/etc/gdm3/custom.conf
|
|
fi
|
|
|
|
conf="${DPKG_ROOT}$conf_file"
|
|
if [ -f "$conf" ] &&
|
|
echo "ed0a2d19ba7344faa0feadd783bb4fa5 $conf" | md5sum -c --status; then
|
|
# If the file matches this checksum, then it's a file generated by
|
|
# /usr/libexec/gdm-disable-wayland that was wrongly replaced, so we
|
|
# replace the conf file to match the one that was default in these
|
|
# broken versions, so that dpkg would replace it in case.
|
|
echo "Configuration file $conf_file has likely been damaged by" \
|
|
"https://pad.lv/1899673, replacing with the gdm default..."
|
|
cat <<'EOF' > "$conf"
|
|
# GDM configuration storage
|
|
#
|
|
# See /usr/share/gdm/gdm.schemas for a list of available options.
|
|
|
|
[daemon]
|
|
# Uncomment the line below to force the login screen to use Xorg
|
|
#WaylandEnable=false
|
|
|
|
# Enabling automatic login
|
|
# AutomaticLoginEnable = true
|
|
# AutomaticLogin = user1
|
|
|
|
# Enabling timed login
|
|
# TimedLoginEnable = true
|
|
# TimedLogin = user1
|
|
# TimedLoginDelay = 10
|
|
|
|
[security]
|
|
|
|
[xdmcp]
|
|
|
|
[chooser]
|
|
|
|
[debug]
|
|
# Uncomment the line below to turn on debugging
|
|
# More verbose logs
|
|
# Additionally lets the X server dump core if it crashes
|
|
#Enable=true
|
|
|
|
EOF
|
|
|
|
# Verify that the file we've just added matches the default one
|
|
# We don't fail as it's not a fatal error, but will cause manual
|
|
# intervention at later points
|
|
default_md5sum="$(dpkg-query -W -f='${Conffiles}' gdm3 | \
|
|
sed -n -e "\\'^ $conf_file ' { s/ obsolete$//; s/.* //; p }")"
|
|
echo "$default_md5sum $conf" | md5sum -c --status ||
|
|
echo "Replaced configuration file isn't matching expected default"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
#DEBHELPER#
|