| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
if [ "$1" = "upgrade" ] || [ "$1" = "install" ]; then |
| 6 |
# Remove wrongly replaced custom.config file by versions > 3.37.90 && < 3.38.1 |
| 7 |
# This script can be safely removed post 20.10 release |
| 8 |
prev_version="$2" |
| 9 |
if dpkg --compare-versions "$prev_version" ge 3.37.90 && |
| 10 |
dpkg --compare-versions "$prev_version" lt-nl 3.38.1; then |
| 11 |
conf_file=/etc/gdm3/daemon.conf |
| 12 |
if [ "${prev_version#*ubuntu}" != "$prev_version" ]; then |
| 13 |
conf_file=/etc/gdm3/custom.conf |
| 14 |
fi |
| 15 |
|
| 16 |
conf="${DPKG_ROOT}$conf_file" |
| 17 |
if [ -f "$conf" ] && |
| 18 |
echo "ed0a2d19ba7344faa0feadd783bb4fa5 $conf" | md5sum -c --status; then |
| 19 |
# If the file matches this checksum, then it's a file generated by |
| 20 |
# /usr/libexec/gdm-disable-wayland that was wrongly replaced, so we |
| 21 |
# replace the conf file to match the one that was default in these |
| 22 |
# broken versions, so that dpkg would replace it in case. |
| 23 |
echo "Configuration file $conf_file has likely been damaged by" \ |
| 24 |
"https://pad.lv/1899673, replacing with the gdm default..." |
| 25 |
cat <<'EOF' > "$conf" |
| 26 |
# GDM configuration storage |
| 27 |
# |
| 28 |
# See /usr/share/gdm/gdm.schemas for a list of available options. |
| 29 |
|
| 30 |
[daemon] |
| 31 |
# Uncomment the line below to force the login screen to use Xorg |
| 32 |
#WaylandEnable=false |
| 33 |
|
| 34 |
# Enabling automatic login |
| 35 |
# AutomaticLoginEnable = true |
| 36 |
# AutomaticLogin = user1 |
| 37 |
|
| 38 |
# Enabling timed login |
| 39 |
# TimedLoginEnable = true |
| 40 |
# TimedLogin = user1 |
| 41 |
# TimedLoginDelay = 10 |
| 42 |
|
| 43 |
[security] |
| 44 |
|
| 45 |
[xdmcp] |
| 46 |
|
| 47 |
[chooser] |
| 48 |
|
| 49 |
[debug] |
| 50 |
# Uncomment the line below to turn on debugging |
| 51 |
# More verbose logs |
| 52 |
# Additionally lets the X server dump core if it crashes |
| 53 |
#Enable=true |
| 54 |
|
| 55 |
EOF |
| 56 |
|
| 57 |
# Verify that the file we've just added matches the default one |
| 58 |
# We don't fail as it's not a fatal error, but will cause manual |
| 59 |
# intervention at later points |
| 60 |
default_md5sum="$(dpkg-query -W -f='${Conffiles}' gdm3 | \ |
| 61 |
sed -n -e "\\'^ $conf_file ' { s/ obsolete$//; s/.* //; p }")" |
| 62 |
echo "$default_md5sum $conf" | md5sum -c --status || |
| 63 |
echo "Replaced configuration file isn't matching expected default" |
| 64 |
fi |
| 65 |
fi |
| 66 |
fi |
| 67 |
|
| 68 |
#DEBHELPER# |