RFC of desktop detection in first login

This commit is contained in:
Igor Pecovnik 2017-08-26 19:08:22 +02:00
parent 0a4eee7999
commit bdb5a40bfd

View File

@ -61,6 +61,10 @@ add_user()
}
if [ -f /root/.not_logged_in_yet ] && [ -n "$BASH_VERSION" ] && [ "$-" != "${-#*i}" ]; then
# detect desktop
if [ $(dpkg-query -W -f='${db:Status-Abbrev}\n' nodm 2>/dev/null) <> "*ii*" ]; then DESKTOPDETECT="nodm"; fi
if [ $(dpkg-query -W -f='${db:Status-Abbrev}\n' lightdm 2>/dev/null) <> "*ii*" ]; then DESKTOPDETECT="lightdm"; fi
if [ "$IMAGE_TYPE" != "nightly" ]; then
echo -e "\n\e[0;31mThank you for choosing Armbian! Support: \e[1m\e[39mwww.armbian.com\x1B[0m\n"
else
@ -72,7 +76,7 @@ if [ -f /root/.not_logged_in_yet ] && [ -n "$BASH_VERSION" ] && [ "$-" != "${-#*
echo -e "\nThis image is provided \e[0;31mAS IS\x1B[0m with \e[0;31mNO WARRANTY\x1B[0m and \e[0;31mNO END USER SUPPORT!\x1B[0m.\n"
fi
echo "Creating a new user account. Press <Ctrl-C> to abort"
[ -f "/etc/init.d/nodm" ] || [ -d "/etc/lightdm" ] && echo "Desktop environment will not be enabled if you abort the new user creation"
[ -n "$DESKTOPDETECT" ] && echo "Desktop environment will not be enabled if you abort the new user creation"
trap check_abort INT
while [ -f "/root/.not_logged_in_yet" ]; do
add_user
@ -92,7 +96,7 @@ if [ -f /root/.not_logged_in_yet ] && [ -n "$BASH_VERSION" ] && [ "$-" != "${-#*
fi
fi
# check whether desktop environment has to be considered
if [ -f "/etc/init.d/nodm" ] && [ -n "$RealName" ] ; then
if [ "$DESKTOPDETECT" = nodm ] && [ -n "$RealName" ] ; then
# enable splash
# [[ -f /etc/systemd/system/desktop-splash.service ]] && systemctl --no-reload enable desktop-splash.service >/dev/null 2>&1 && service desktop-splash restart
sed -i "s/NODM_USER=\(.*\)/NODM_USER=${RealUserName}/" /etc/default/nodm
@ -108,7 +112,7 @@ if [ -f /root/.not_logged_in_yet ] && [ -n "$BASH_VERSION" ] && [ "$-" != "${-#*
sleep 1
service nodm start
fi
elif [ -d "/etc/lightdm" ] && [ -n "$RealName" ] ; then
elif [ "$DESKTOPDETECT" = lightdm ] && [ -n "$RealName" ] ; then
ln -sf /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
if [[ -f /var/run/resize2fs-reboot ]]; then
# Let the user reboot now otherwise start desktop environment