74 lines
2.4 KiB
Bash
74 lines
2.4 KiB
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
THIS_PACKAGE=cosmic-greeter
|
|
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
|
|
|
|
# creating cosmic-greeter group if it isn't already there
|
|
if ! getent group cosmic-greeter >/dev/null; then
|
|
addgroup --system --force-badname --quiet cosmic-greeter
|
|
fi
|
|
|
|
# creating cosmic-greeter user if it isn't already there
|
|
if ! getent passwd cosmic-greeter >/dev/null; then
|
|
adduser --system --force-badname --quiet \
|
|
--ingroup cosmic-greeter \
|
|
--home /var/lib/cosmic-greeter --no-create-home \
|
|
--shell /bin/false \
|
|
cosmic-greeter
|
|
usermod -c "COSMIC Greeter" cosmic-greeter
|
|
fi
|
|
|
|
# ensure cosmic-greeter user is part of the video group
|
|
adduser cosmic-greeter video
|
|
|
|
# create home directory if it does not exist and set permissions
|
|
if [ ! -d /var/lib/cosmic-greeter ]
|
|
then
|
|
mkdir /var/lib/cosmic-greeter
|
|
chown -R cosmic-greeter:cosmic-greeter /var/lib/cosmic-greeter
|
|
fi
|
|
|
|
# debconf is not a registry, so we only fiddle with the default file if
|
|
# the configure script requested an update
|
|
if [ -e $DEFAULT_DISPLAY_MANAGER_FILE.debconf-update ]; then
|
|
rm -f $DEFAULT_DISPLAY_MANAGER_FILE.debconf-update
|
|
if db_get shared/default-x-display-manager; then
|
|
# workaround debconf passthru bug (#379198)
|
|
if [ -z "$RET" ]; then
|
|
RET="$THIS_PACKAGE"
|
|
fi
|
|
if [ "$THIS_PACKAGE" != "$RET" ]; then
|
|
echo "Please be sure to run \"dpkg --configure $RET\"."
|
|
fi
|
|
if db_get "$RET"/daemon_name; then
|
|
echo "$RET" > $DEFAULT_DISPLAY_MANAGER_FILE
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
DEFAULT_SERVICE=/etc/systemd/system/display-manager.service
|
|
# set default-display-manager systemd service link according to our config
|
|
if [ "$1" = configure ] && [ -d /etc/systemd/system/ ]; then
|
|
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
|
|
SERVICE=/lib/systemd/system/$(basename $(cat "$DEFAULT_DISPLAY_MANAGER_FILE")).service
|
|
if [ -h "$DEFAULT_SERVICE" ] && [ $(readlink "$DEFAULT_SERVICE") = /dev/null ]; then
|
|
echo "Display manager service is masked" >&2
|
|
elif [ -e "$SERVICE" ]; then
|
|
ln -sf "$SERVICE" "$DEFAULT_SERVICE"
|
|
else
|
|
echo "WARNING: $SERVICE is the selected default display manager but does not exist" >&2
|
|
rm -f "$DEFAULT_SERVICE"
|
|
fi
|
|
else
|
|
rm -f "$DEFAULT_SERVICE"
|
|
fi
|
|
fi
|
|
|
|
# debconf hangs if cosmic-greeter gets started below without this
|
|
db_stop || true
|
|
|
|
#DEBHELPER#
|