Page MenuHomeFreeBSD

D62171.1795996646.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D62171.1795996646.diff

diff --git a/usr.sbin/bsdinstall/scripts/Makefile b/usr.sbin/bsdinstall/scripts/Makefile
--- a/usr.sbin/bsdinstall/scripts/Makefile
+++ b/usr.sbin/bsdinstall/scripts/Makefile
@@ -5,6 +5,7 @@
bootconfig \
checksum \
config \
+ desktop \
docsinstall \
entropy \
fetchmissingdists \
diff --git a/usr.sbin/bsdinstall/scripts/desktop b/usr.sbin/bsdinstall/scripts/desktop
new file mode 100755
--- /dev/null
+++ b/usr.sbin/bsdinstall/scripts/desktop
@@ -0,0 +1,83 @@
+#!/bin/sh
+#
+# Copyright (c) 2026 The FreeBSD Foundation
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# This software was developed by Alfonso Sabato Siciliano
+# <asiciliano@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+
+# Include only for $OSNAME
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+
+: "${BSDDIALOG_YES=0}"
+
+CHROOT_SBIN="$BSDINSTALL_CHROOT/usr/local/sbin"
+
+ask() {
+ exec 5>&1
+ out=$(shift; "$@" 2>&1 1>&5) || exit 1
+ exec 5>&-
+ eval "$1=\$out"
+}
+
+pkg_install () {
+ exec 5>&1
+ pkgerr=$(chroot "$BSDINSTALL_CHROOT" pkg install -y $* 2>&1 1>&5)
+ retval=$?
+ exec 5>&-
+ if [ $retval -ne 0 ]; then
+ bsddialog --backtitle "$OSNAME Installer" --title Desktop \
+ --msgbox "Error during package installation: $pkgerr\n\n
+Packages may currently be building, this is a common issue, try installing
+again later." \
+ 0 0
+ exit 1
+ fi
+}
+
+#### SECTION 1: Yes-No question, install tools, and checks ####
+bsddialog --backtitle "$OSNAME Installer" --title Desktop --text-escape \
+ --yesno "$OSNAME provides a variety of graphical environments that can be
+easily installed through ports and packages. Refer to the $OSNAME Handbook
+available at \Zuhttps://docs.freebsd.org\ZU.\n\nWould you like to install the
+GPU drivers, Xorg, KDE Plasma, and a display manager now, and have them start
+automatically at the next system reboot?\n\nPlease note this is an experimental
+feature." \
+ 0 0
+[ $? -eq $BSDDIALOG_YES ] || exit 1
+
+# bsdinstall/scripts/firmware to know more about pkg(8) and resolv.conf(5)
+cp -f "$BSDINSTALL_TMPETC/resolv.conf" "$BSDINSTALL_CHROOT/etc/"
+pkg_install bsdinstall-desktop bsdinstall-gpu bsdinstall-dm bsdinstall-de
+
+"$CHROOT_SBIN/bsdinstall-desktop-checks" || exit 1
+
+#### SECTION 2: GPU ####
+ask gpu "$CHROOT_SBIN/bsdinstall-gpu"
+
+#### SECTION 3: Display Manager ####
+ask dm "$CHROOT_SBIN/bsdinstall-dm"
+
+#### SECTION 4: Users ####
+ask BSDINSTALL_USERS "$CHROOT_SBIN/bsdinstall-desktop-users"
+export BSDINSTALL_USERS
+
+#### SECTION 5: Installation and configuration ####
+de=$("$CHROOT_SBIN/bsdinstall-de" 2>&1)
+
+pkg_install $gpu xorg $de $dm bsdinstall-desktop-audio
+chroot "$BSDINSTALL_CHROOT" pkg delete -y -g "bsdinstall-*"
+
+mv "$BSDINSTALL_CHROOT"/tmp/rc.conf.* "$BSDINSTALL_TMPETC"
+mv "$BSDINSTALL_CHROOT"/tmp/loader.conf.* "$BSDINSTALL_TMPBOOT"
+
+#### SECTION 6: Success Message ####
+users=$(echo "$BSDINSTALL_USERS" | sed 's/ /, /g')
+
+bsddialog --backtitle "$OSNAME Installer" --title Desktop --text-escape \
+ --msgbox "Desktop installation completed.\n\n
+A display manager will start automatically and allow login at the next startup.
+The enabled users with configured settings are: \Zb$users\ZB." \
+ 0 0
diff --git a/usr.sbin/bsdinstall/scripts/finalconfig b/usr.sbin/bsdinstall/scripts/finalconfig
--- a/usr.sbin/bsdinstall/scripts/finalconfig
+++ b/usr.sbin/bsdinstall/scripts/finalconfig
@@ -47,7 +47,8 @@
"System Hardening" "Set security options" \
"Time Zone" "Set system timezone" \
"Firmware" "Install Firmware (requires network)" \
- "Handbook" "Install $OSNAME Handbook (requires network)" 2>&1 1>&5)
+ "Handbook" "Install $OSNAME Handbook (requires network)" \
+ "Desktop" "Install graphical environment (requires network)" 2>&1 1>&5)
retval=$?
exec 5>&-
@@ -86,5 +87,8 @@
"Handbook")
bsdinstall docsinstall
;;
+ "Desktop")
+ bsdinstall desktop
+ ;;
esac
done

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 29, 11:57 PM (7 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42098235
Default Alt Text
D62171.1795996646.diff (3 KB)

Event Timeline