From e81df0b7f937f859b606a97899e08fc6ab6a8292 Mon Sep 17 00:00:00 2001 From: majekla Date: Fri, 23 Aug 2024 13:56:05 +0000 Subject: [PATCH] Upload files to "/" version of freebsd-desktop script based on my repository (pkgrescue) --- freebsd-desktop_pkgrescue.sh | 951 +++++++++++++++++++++++++++++++++++ 1 file changed, 951 insertions(+) create mode 100644 freebsd-desktop_pkgrescue.sh diff --git a/freebsd-desktop_pkgrescue.sh b/freebsd-desktop_pkgrescue.sh new file mode 100644 index 0000000..effb065 --- /dev/null +++ b/freebsd-desktop_pkgrescue.sh @@ -0,0 +1,951 @@ +#!/bin/sh + +clear +echo "--------------------------------------------------------" +echo "| Warning! This script is based on my own repository, pkgrescue, with the aim of allowing continued installation of desktop environments and basic applications even when build issues occur in the quarterly repository." +echo "| Stop the script and choose the other version if you do not wish to use my repository." +echo "| Press ENTER to go on" +read ENTER + +checkinternet() { + local url="https://www.freebsd.org/" + + if fetch -q -o /dev/null "$url"; then + echo "Looking for Internet Connection, please wait..." + else + echo "Your computer is not connected to the internet, I can't go on." + exit 1 + fi +} + +installpkg() { + printf "\n" + echo "Looking for 'pkg', please wait..." + sleep 1 + + if [ ! -x /usr/local/sbin/pkg ]; then + # Check if pkg can be installed + if pkg ins -y 2>&1 | grep -q "error"; then + echo "I can't install pkg, please check your internet connection" + printf "\n" + exit 0 + fi + fi +} + +# Prepare for pkgrescue : +mkdir -p /var/pkgrescue/pkg + +# Welcome ! +welcome() { + echo "Everything seems OK, let's go !" + bsddialog --msgbox "Welcome to this desktop installation script for FreeBSD!" 5 60 +} + + +# System Update +update() { + if bsddialog --yesno "Do you want to update your system before starting?" 5 54; then + bsddialog --msgbox "Please review the available changes, then press 'q' to continue" 5 67 + freebsd-update fetch + freebsd-update install + fi +} + + +# User +user_for_desktop() { + if bsddialog --yesno "Have you already created the user who will use the desktop?" 5 63; then + for j in $(seq 4); do + # Username of the desktop environment user + user=$(bsddialog --inputbox "Please enter his username" 8 29 2>&1 1>/dev/tty) + + #check if the user already exists or not + if ! getent passwd "$user" >/dev/null; then + bsddialog --msg " !WARNING!\n This user does not exist\n Please try again" 7 58 + else + break + fi + done + + # Exit script if not able to choose a user + if [ $j -eq 4 ]; then + exit 0 + fi + else + for i in $(seq 4); do + + user=$(bsddialog --inputbox "What username would you like to give to your user?\n (No spaces or special characters)" 9 54 2>&1 1>/dev/tty) + fullname=$(bsddialog --inputbox "Please enter his full name (don't leave empty)" 8 50 2>&1 1>/dev/tty) + + #check if the user already exists or not + if getent passwd "$user" >/dev/null; then + if bsddialog --yesno " !WARNING!\n This user already exists\nDo you want to use it [Yes] or create another one [No]" 7 58; then + break + fi + else + pw useradd "$user" -d "/home/$user" -m -c "$fullname" + clear + echo "--------------------------------------" + echo "Please assign a password to $user" + printf "\n" + passwd $user + break + fi + done + + # Exit script if not able to create a user + if [ $i -eq 4 ]; then + exit 0 + fi + fi +} + + +# DE choice: +kde-sddm() { + pkg_list="xorg-7.7_3.pkg sudo-1.9.15p5_4.pkg sddm-0.21.0.pkg kde5-5.27.11.23.08.5_2.pkg freebsd-8k-wallpapers-kde-2.1.pkg kde-baseapps-23.08.5_2.pkg kde-dev-scripts-23.08.5_1.pkg kde-dev-utils-23.08.5.pkg kde-thumbnailer-chm-0.2.1_4.pkg kde-thumbnailer-epub-1.1.9.b_4.pkg kde-thumbnailer-fb2-0.3.1_4.pkg kde_poster-1.0_2.pkg kdeaccessibility-23.08.5_1.pkg kdeadmin-23.08.5_1.pkg kdebugsettings-23.08.5.pkg kdeconnect-kde-23.08.5_3.pkg kdegames-23.08.5_1.pkg kdegraphics-23.08.5_1.pkg kdegraphics-thumbnailers-23.08.5_1.pkg kdemultimedia-23.08.5_3.pkg kdevelop-23.08.5_2.pkg calligra-3.2.1_62.pkg kmymoney-5.1.3_5.pkg kdemultimedia-ffmpegthumbs-23.08.5_1.pkg kdenetwork-23.08.5_1.pkg kdenetwork-filesharing-23.08.5_1.pkg kdenlive-23.08.5_1.pkg kdeutils-23.08.5_2.pkg libkdegames-23.08.5.pkg libkdepim-23.08.5.pkg libproxy-kde-0.4.18.pkg plasma5-kde-cli-tools-5.27.11.pkg plasma5-kde-gtk-config-5.27.11.pkg plasma5-kdecoration-5.27.11.pkg plasma5-kdeplasma-addons-5.27.11.pkg wallpapers-freebsd-kde-1.0_1.pkg dsbsu-0.2_2.pkg" + + for pkg in $pkg_list; do + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${pkg}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${pkg}_autoinstall.sh + /var/pkgrescue/pkg/${pkg}_autoinstall.sh + done + + sysrc sddm_enable=YES dbus_enable=YES + + sysctl net.local.stream.recvspace=65536 net.local.stream.sendspace=65536 > /dev/null 2>&1 + pw groupmod video -m "$user" + + if ! grep -q "proc /proc procfs rw 0 0" /etc/fstab; then + echo "proc /proc procfs rw 0 0" >> /etc/fstab + fi + + echo "exec ck-launch-session startplasma-x11" > /home/"$user"/.xinitrc +} + +xfce-lightdm() { + pkg_list="xorg-7.7_3.pkg sudo-1.9.15p5_4.pkg lightdm-1.32.0_6.pkg lightdm-gtk-greeter-2.0.8_4.pkg xfce-4.18_1.pkg xfce-icons-elementary-0.19.pkg xfce4-appfinder-4.18.1_2.pkg xfce4-appmenu-plugin-0.7.6_3.pkg xfce4-battery-plugin-1.1.5_2.pkg xfce4-bsdcpufreq-plugin-0.3.1_4.pkg xfce4-calculator-plugin-0.7.2_2.pkg xfce4-clipman-plugin-1.6.6.pkg xfce4-conf-4.18.3.pkg xfce4-cpugraph-plugin-1.2.10_1.pkg xfce4-dashboard-1.0.0_3.pkg xfce4-datetime-plugin-0.8.3_3.pkg xfce4-desktop-4.18.1_4.pkg xfce4-dev-tools-4.18.1_1.pkg xfce4-dict-plugin-0.8.6_2.pkg xfce4-diskperf-plugin-2.7.0_3.pkg xfce4-docklike-plugin-0.4.2.pkg xfce4-fsguard-plugin-1.1.3_2.pkg xfce4-generic-slider-1.0.0_2,1.pkg xfce4-genmon-plugin-4.2.0_2.pkg xfce4-goodies-4.18_4.pkg xfce4-mailwatch-plugin-1.3.1_2.pkg xfce4-mixer-4.18.1_4.pkg xfce4-mount-plugin-1.1.6_2.pkg xfce4-mpc-plugin-0.5.3_2.pkg xfce4-netload-plugin-1.4.1_2.pkg xfce4-notes-plugin-1.11.0.pkg xfce4-notifyd-0.9.4_1.pkg xfce4-panel-4.18.6.pkg xfce4-panel-profiles-1.0.14_2.pkg xfce4-places-plugin-1.8.3_3.pkg xfce4-power-manager-4.18.4.pkg xfce4-pulseaudio-plugin-0.4.8_2.pkg xfce4-screensaver-4.18.3.pkg xfce4-screenshooter-plugin-1.10.6.pkg xfce4-session-4.18.4.pkg xfce4-settings-4.18.6.pkg xfce4-smartbookmark-plugin-0.5.2_4.pkg xfce4-stopwatch-plugin-0.5.0_3.pkg xfce4-systemload-plugin-1.3.2_3.pkg xfce4-taskmanager-1.5.7.pkg xfce4-terminal-1.1.3.pkg xfce4-time-out-plugin-1.1.3_2.pkg xfce4-timer-plugin-1.7.2_2.pkg xfce4-tumbler-4.18.2_2.pkg xfce4-verve-plugin-2.0.3_2.pkg xfce4-volumed-pulse-0.2.4_3.pkg xfce4-wavelan-plugin-0.6.3_3.pkg xfce4-weather-plugin-0.11.2.pkg xfce4-whiskermenu-plugin-2.8.3.pkg xfce4-windowck-plugin-0.5.1_3.pkg xfce4-wm-4.18.0_3.pkg xfce4-wm-themes-4.10.0_2.pkg xfce4-xkb-plugin-0.8.3_3.pkg xarchiver-0.5.4.23.pkg" + + + for pkg in $pkg_list; do + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${pkg}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${pkg}_autoinstall.sh + /var/pkgrescue/pkg/${pkg}_autoinstall.sh + done + + sysrc lightdm_enable=YES dbus_enable=YES + + if ! grep -q "proc /proc procfs rw 0 0" /etc/fstab; then + echo "proc /proc procfs rw 0 0" >> /etc/fstab + fi + + cp /usr/local/etc/xdg/xfce4/xinitrc /home/"$user"/.xinitrc +} + +mate-lightdm() { + pkg_list="xorg-7.7_3.pkg sudo-1.9.15p5_4.pkg lightdm-1.32.0_6.pkg lightdm-gtk-greeter-2.0.8_4.pkg mate-applet-appmenu-0.7.6_3.pkg mate-applets-1.28.0.pkg mate-backgrounds-1.28.0.pkg mate-base-1.28.1.pkg mate-calc-1.28.0.pkg mate-common-1.28.0.pkg mate-control-center-1.26.0_6.pkg mate-desktop-1.28.1_1.pkg mate-dock-applet-21.10.0_3.pkg mate-icon-theme-1.28.0.pkg mate-icon-theme-faenza-1.20.0.pkg mate-indicator-applet-1.26.0_2.pkg mate-media-1.28.1.pkg mate-menus-1.28.0.pkg mate-notification-daemon-1.28.0.pkg mate-pam-helper-1.3.pkg mate-panel-1.28.0,1.pkg mate-polkit-1.28.1.pkg mate-power-manager-1.28.1.pkg mate-screensaver-1.28.0.pkg mate-session-manager-1.28.0.pkg mate-settings-daemon-1.28.0.pkg mate-system-monitor-1.28.1.pkg mate-themes-3.22.23_1.pkg mate-user-guide-1.28.0.pkg mate-utils-1.28.0.pkg libshumate-1.2.2.pkg libmatemixer-1.28.0.pkg libmateweather-1.28.0.pkg libmatekbd-1.26.0_2.pkg" + + + for pkg in $pkg_list; do + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${pkg}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${pkg}_autoinstall.sh + /var/pkgrescue/pkg/${pkg}_autoinstall.sh + done + + sysrc lightdm_enable=YES dbus_enable=YES + + if ! grep -q "proc /proc procfs rw 0 0" /etc/fstab; then + echo "proc /proc procfs rw 0 0" >> /etc/fstab + fi + + echo "exec ck-launch-session mate-session" > /home/"$user"/.xinitrc +} + +cinnamon-lightdm() { + pkg_list="xorg-7.7_3.pkg sudo-1.9.15p5_4.pkg lightdm-1.32.0_6.pkg lightdm-gtk-greeter-2.0.8_4.pkg cinnamon-5.4.9_6.pkg cinnamon-control-center-5.4.6_3.pkg cinnamon-desktop-5.4.2_4.pkg cinnamon-menus-5.4.0.pkg cinnamon-screensaver-5.4.2_2.pkg cinnamon-session-5.4.0_4.pkg cinnamon-settings-daemon-5.4.4_4.pkg cinnamon-translations-5.4.2.pkg" + + for pkg in $pkg_list; do + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${pkg}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${pkg}_autoinstall.sh + /var/pkgrescue/pkg/${pkg}_autoinstall.sh + done + + sysrc lightdm_enable=YES dbus_enable=YES + + if ! grep -q "proc /proc procfs rw 0 0" /etc/fstab; then + echo "proc /proc procfs rw 0 0" >> /etc/fstab + fi + + echo "exec ck-launch-session cinnamon-session" > /home/"$user"/.xinitrc +} + +gnome-gdm() { + pkg_list="xorg-7.7_3.pkg sudo-1.9.15p5_4.pkg gdm-42.0_7.pkg chrome-gnome-shell-10.1_2.pkg gnome_subr-1.0.pkg gnome-2048-3.38.2_4.pkg gnome-42_5.pkg gnome-autoar-0.4.3_2.pkg gnome-backgrounds-43_1.pkg gnome-builder-42.1_6.pkg gnome-calculator-43.0.1_3.pkg gnome-calendar-42.2_2.pkg gnome-characters-43.0_2.pkg gnome-chess-43.0_2.pkg gnome-clipboard-daemon-1.0_13.pkg gnome-clocks-40.0_1,1.pkg gnome-color-manager-3.36.0_6.pkg gnome-common-3.18.0.pkg gnome-connections-42.1.2_3.pkg gnome-console-43.0_4.pkg gnome-contacts-41.0_5.pkg gnome-control-center-43.2_3.pkg gnome-desktop-42.4_2.pkg gnome-devel-docs-40.3.pkg gnome-dictionary-40.0_5.pkg gnome-font-viewer-43.0_2.pkg gnome-games-3.24.0_1.pkg gnome-getting-started-docs-3.38.1.pkg gnome-icon-theme-3.12.0_1.pkg gnome-icon-theme-extras-3.12.0_1.pkg gnome-icon-theme-symbolic-3.12.0.pkg gnome-icons-20060914_5.pkg gnome-icons-elementary-7.3.1.pkg gnome-icons-faenza-1.3.1.pkg gnome-icons-luv-0.4.9.12_2.pkg gnome-initial-setup-43.2_3.pkg gnome-keyring-42.1_4.pkg gnome-keyring-sharp-1.0.2_8.pkg gnome-klotski-3.38.2_3.pkg gnome-latex-3.44.0_2.pkg gnome-lite-42_5.pkg gnome-mahjongg-3.38.3_3.pkg gnome-maps-43.5.pkg gnome-menus-3.36.0.pkg gnome-metronome-1.3.0_9.pkg gnome-mime-data-2.18.0_5.pkg gnome-mines-40.1_3.pkg gnome-mplayer-1.0.9_9.pkg gnome-music-42.1_2.pkg gnome-nettool-42.0_2,1.pkg gnome-nibbles-3.38.2_4.pkg gnome-online-accounts-3.44.0_2.pkg gnome-online-miners-3.34.0_2.pkg gnome-photos-43.0_4.pkg gnome-pie-0.7.3_3.pkg gnome-planner-0.14.6.20220531_1.pkg gnome-podcasts-0.7.1_2.pkg gnome-pomodoro-0.22.1_1,1.pkg gnome-power-manager-3.32.0_3.pkg gnome-pty-helper-0.40.2.pkg gnome-robots-40.0_3.pkg gnome-screenshot-41.0_3.pkg gnome-session-42.0_4.pkg gnome-settings-daemon-42.2_7.pkg gnome-shell-42.4_9.pkg gnome-shell-extension-audio-output-switcher-0.0.0.20171022_2.pkg gnome-shell-extension-coverflow-0.0.0.20180110_2.pkg gnome-shell-extension-dashtodock-65_2.pkg gnome-shell-extension-dashtopanel-v46.pkg gnome-shell-extension-filesmenu-0.0.0.20171125_2.pkg gnome-shell-extension-hidetopbar-0.0.0.20180511_2.pkg gnome-shell-extension-lockkeys-0.0.0.20180511_2.pkg gnome-shell-extension-mediaplayer-4.0_1.pkg gnome-shell-extension-openweather-119.pkg gnome-shell-extension-panel-osd-0.0.0.20220406.pkg gnome-shell-extension-recent-items-40_1.pkg gnome-shell-extension-trash-0.2.0_1.pkg gnome-shell-extension-weather-0.0.0.20180411_2.pkg gnome-shell-extension-windowoverlay-icons-36_1.pkg gnome-shell-extensions-42.3_2.pkg gnome-shell-extra-extensions-3.28_2.pkg gnome-sound-recorder-42.0_2.pkg gnome-ssh-askpass-9.7p1.pkg gnome-ssh-askpass-9.7p1.pkg gnome-sudoku-42.0_3.pkg gnome-system-monitor-42.0_1.pkg gnome-terminal-3.44.2_3.pkg gnome-tetravex-3.38.2_3.pkg gnome-text-editor-42.2_5.pkg gnome-themes-2.32.1_2.pkg gnome-themes-extra-3.28_5.pkg gnome-todo-41.0_3.pkg gnome-tweaks-40.10_3.pkg gnome-user-docs-42.0.pkg gnome-user-share-3.14.0_8.pkg gnome-utils-42,1.pkg gnome-video-effects-0.5.0.pkg gnome-weather-42.0_1.pkg guile-gnome-platform-full-2.16.5_9.pkg libgnome-games-support-1.8.2_2.pkg libgnome-keyring-3.12.0_2.pkg libgnomecanvas-2.30.3_7.pkg libgnomecanvasmm-2.26.0_15.pkg libgnomekbd-3.26.1_2.pkg libproxy-gnome3-0.4.18.pkg pinentry-gnome-1.3.0.pkg polkit-gnome-0.105_4.pkg qgnomeplatform-0.6.1.8_3.pkg rubygem-gnome-4.2.2.pkg subversion-gnome-keyring-1.14.3_2.pkg xdg-desktop-portal-gnome-43.1.pkg" + + for pkg in $pkg_list; do + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${pkg}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${pkg}_autoinstall.sh + /var/pkgrescue/pkg/${pkg}_autoinstall.sh + done + + sysrc gdm_enable=YES dbus_enable=YES + + if ! grep -q "proc /proc procfs rw 0 0" /etc/fstab; then + echo "proc /proc procfs rw 0 0" >> /etc/fstab + fi + + echo "exec gnome-session" > /home/"$user"/.xinitrc +} + +lxqt-sddm() { + pkg_list="xorg-7.7_3.pkg sudo-1.9.15p5_4.pkg sddm-0.21.0.pkg lxqt-2.0.0.pkg lxqt-about-2.0.0.pkg lxqt-admin-2.0.0.pkg lxqt-archiver-1.0.0.pkg lxqt-build-tools-0.13.0.pkg lxqt-config-2.0.0.pkg lxqt-globalkeys-2.0.0.pkg lxqt-menu-data-2.0.0.pkg lxqt-notificationd-2.0.1.pkg lxqt-openssh-askpass-2.0.1.pkg lxqt-panel-2.0.1.pkg lxqt-policykit-2.0.0.pkg lxqt-powermanagement-2.0.0.pkg lxqt-qt6plugin-2.0.0.pkg lxqt-qtplugin-1.4.0.pkg lxqt-runner-2.0.0.pkg lxqt-session-2.0.0.pkg lxqt-sudo-2.0.0.pkg lxqt-themes-2.0.0.pkg lxqt2-build-tools-2.0.0.pkg" + + for pkg in $pkg_list; do + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${pkg}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${pkg}_autoinstall.sh + /var/pkgrescue/pkg/${pkg}_autoinstall.sh + done + + sysrc sddm_enable=YES dbus_enable=YES + + if ! grep -q "proc /proc procfs rw 0 0" /etc/fstab; then + echo "proc /proc procfs rw 0 0" >> /etc/fstab + fi + + echo "exec ck-launch-session startlxqt" > /home/"$user"/.xinitrc +} + + +desktop_selection_menu() { + DE=$(bsddialog --clear \ + --backtitle "Desktop Environnment" \ + --title "Desktop Environnment" \ + --menu "Select your Desktop Environnment:" \ + 14 70 10 \ + 1 "KDE (with sddm)" \ + 2 "XFCE4 (with lightdm)" \ + 3 "MATE (with lightdm)" \ + 4 "CINNAMON (with lightdm)" \ + 5 "GNOME (with gdm)" \ + 6 "LXQT (with sddm)" \ + 7 "(none)" \ + 3>&1 1>&2 2>&3) + + case $DE in + 1) kde-sddm ;; + 2) xfce-lightdm ;; + 3) mate-lightdm ;; + 4) cinnamon-lightdm ;; + 5) gnome-gdm ;; + 6) lxqt-sddm ;; + esac +} + + +# Which GPU ? +intel-irisxe() { + +cat < /usr/local/etc/X11/xorg.conf.d/00-scfb.conf +Section "Device" + Identifier "Card0" + Driver "scfb" + BusID "$intelirisxe_pci_location" +EndSection +EOF + +} + +vbox() { + +cat < /usr/local/etc/X11/xorg.conf.d/00-vbox.conf +# This configuration file is useless. +# It only permits autodetection. +EOF + + +} + +intel-older() { + clear + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/xf86-video-intel-2.99.917.923_1,1.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/xf86-video-intel-2.99.917.923_1,1.pkg_autoinstall.sh + /var/pkgrescue/pkg/xf86-video-intel-2.99.917.923_1,1.pkg_autoinstall.sh + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/drm-kmod-20220907_3.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/drm-kmod-20220907_3.pkg_autoinstall.sh + /var/pkgrescue/pkg/drm-kmod-20220907_3.pkg_autoinstall.sh + + sysrc kld_list="i915kms" > /dev/null 2>&1 + +cat < /usr/local/etc/X11/xorg.conf.d/00-intel.conf +Section "Device" + Identifier "Intel Graphics" + Driver "intel" + #Option "AccelMethod" "sna" + #Option "TearFree" "true" + #Option "DRI" "3" + #Option "Backlight" "intel_backlight" + BusID "$intel_pci_location" +EndSection +EOF + +} + +nvidia-gpu() { + clear + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/nvidia-driver-550.54.14.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/nvidia-driver-550.54.14.pkg_autoinstall.sh + /var/pkgrescue/pkg/nvidia-driver-550.54.14.pkg_autoinstall.sh + sysrc kld_list="nvidia-modeset" > /dev/null 2>&1 + + # Automatically detect and BusID for NVIDIA graphics : + pciconf_output=$(pciconf -lv | grep -B3 'display' | grep -B2 'NVIDIA') + pci_location=$(echo "$pciconf_output" | sed -nE 's/^vgapci[0-9]+@pci([0-9]+:[0-9]+:[0-9]+:[0-9]+).*/PCI:\1/p' | sed 's/0://') + + +cat < /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf +Section "Device" + Identifier "Device0" + Driver "nvidia" + VendorName "NVIDIA Corporation" + BusID "$nvidia_pci_location" +EndSection +EOF + +} + +amd-cpu_amd-gpu() { + clear + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/xf86-video-amdgpu-22.0.0_2.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/xf86-video-amdgpu-22.0.0_2.pkg_autoinstall.sh + /var/pkgrescue/pkg/xf86-video-amdgpu-22.0.0_2.pkg_autoinstall.sh + sysrc kld_list="amdgpu" > /dev/null 2>&1 +} + + +graphics_selection_menu() { + GPU=$(bsddialog --clear \ + --backtitle "GPU" \ + --title "GPU Menu" \ + --menu "Select your graphics:" \ + 12 70 10 \ + 1 "Intel Iris Xe" \ + 2 "Intel (before Iris Xe)" \ + 3 "Nvidia" \ + 4 "AMD" \ + 5 "Virtual Machine" \ + 3>&1 1>&2 2>&3) + + case $GPU in + 1) intel-irisxe ;; + 2) intel-older ;; + 3) nvidia-gpu ;; + 4) amd-gpu;; + esac + +} + + +automatic_graphics_detection() { + + # Check if there is an already existing configuration file : + if [ -e /usr/local/etc/X11/xorg.conf.d/00-scfb.conf ] || \ + [ -e /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf ] || \ + [ -e /usr/local/etc/X11/xorg.conf.d/00-intel.conf ] || \ + [ -e /usr/local/etc/X11/xorg.conf.d/00-vbox.conf ]; then + + bsddialog --yesno "I have detected a previous graphics configuration file\n Do you want to use it [Yes] or erase it [No]?" 6 58 + existingconf_ornot=$? + + + if [ $existingconf_ornot -eq 0 ]; then + + useconf="1" + + else + + rm /usr/local/etc/X11/xorg.conf.d/00-scfb.conf 2>&1 + rm /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf 2>&1 + rm /usr/local/etc/X11/xorg.conf.d/00-intel.conf 2>&1 + rm /usr/local/etc/X11/xorg.conf.d/00-vbox.conf 2>&1 + + + fi + + + + fi + + + if [ "$useconf" != "1" ]; then + + # VIRTUALBOX + vbox_pciconf_output=$(pciconf -lv | grep -B3 'display' | grep -B2 "'SVGA II Adapter") + vbox_pci_location=$(echo "$vbox_pciconf_output" | sed -nE 's/^vgapci[0-9]+@pci([0-9]+:[0-9]+:[0-9]+:[0-9]+).*/PCI:\1/p' | sed 's/0://') + + # INTEL IRIS Xe + intelirisxe_pciconf_output=$(pciconf -lv | grep -B3 'display' | grep -B2 'Iris Xe') + intelirisxe_pci_location=$(echo "$intelirisxe_pciconf_output" | sed -nE 's/^vgapci[0-9]+@pci([0-9]+:[0-9]+:[0-9]+:[0-9]+).*/PCI:\1/p' | sed 's/0://') + + # INTEL (before Iris Xe) + intel_pciconf_output=$(pciconf -lv | grep -B3 'display' | grep -B2 "HD Graphics") + intel_pci_location=$(echo "$intel_pciconf_output" | sed -nE 's/^vgapci[0-9]+@pci([0-9]+:[0-9]+:[0-9]+:[0-9]+).*/PCI:\1/p' | sed 's/0://') + + # NVIDIA + nvidia_pciconf_output=$(pciconf -lv | grep -B3 'display' | grep -B2 'NVIDIA') + nvidia_pci_location=$(echo "$nvidia_pciconf_output" | sed -nE 's/^vgapci[0-9]+@pci([0-9]+:[0-9]+:[0-9]+:[0-9]+).*/PCI:\1/p' | sed 's/0://') + + + # If 2 graphics are detected (Intel Iris Xe and NVIDIA), please choose between + if [ ! -z "$intelirisxe_pciconf_output" ] && \ + [ ! -z "$nvidia_pciconf_output" ]; then + + bsddialog --yesno "We have detected both Intel Iris Xe and NVIDIA graphics\n Use Intel Iris Xe [Yes] or NVIDIA [No]?" 6 59 + intel_ornvidia=$? + + if [ $intel_ornvidia -eq 0 ]; then + + intel-irisxe + + else + nvidiagpu + + fi + + fi + + # If 2 graphics are detected (Intel and NVIDIA), please choose between + if [ ! -z "$intel_pciconf_output" ] && \ + [ ! -z "$nvidia_pciconf_output" ]; then + + bsddialog --yesno "We have detected both Intel and NVIDIA graphics\n Use Intel [Yes] or NVIDIA [No]?" 6 51 + intel_ornvidia=$? + + if [ $intel_ornvidia -eq 0 ]; then + + intel-older + + else + nvidiagpu + + fi + + fi + + # If VirtualBox is detected, ask to accept or not : + if [ ! -z "$vbox_pciconf_output" ]; then + vbox + fi + + + # If an Intel Iris Xe is detected, ask to accept or not : + if [ ! -z "$intelirisxe_pciconf_output" ]; then + intel-irisxe + fi + + + # If an Intel is detected, ask to accept or not : + if [ ! -z "$intel_pciconf_output" ]; then + intel-older + fi + + + # If an NVIDIA is detected, ask to accept or not : + if [ ! -z "$nvidia_pciconf_output" ]; then + nvidia-gpu + fi + + + # If no choice has been done, go to graphics_selection_menu : + if [ ! -e /usr/local/etc/X11/xorg.conf.d/00-scfb.conf ] && \ + [ ! -e /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf ] && \ + [ ! -e /usr/local/etc/X11/xorg.conf.d/00-intel.conf ] && \ + [ ! -e /usr/local/etc/X11/xorg.conf.d/00-vbox.conf ]; then + + graphics_selection_menu + + fi + + + fi + + + + # Check if there is an already existing configuration file : + if [ ! -e /usr/local/etc/X11/xorg.conf.d/00-scfb.conf ] && \ + [ ! -e /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf ] && \ + [ ! -e /usr/local/etc/X11/xorg.conf.d/00-intel.conf ] && \ + [ ! -e /usr/local/etc/X11/xorg.conf.d/00-vbox.conf ]; then + + graphics_selection_menu + fi + + +} + +programs_selection_menu() { + # Install usual programs + TMPFILE=$(mktemp) + + bsddialog --backtitle "Select programs" \ + --title "Installing applications" \ + --checklist "Select programs:" 30 70 20 \ + "firefox-129.0.2,2.pkg " "Firefox web browser" off \ + "ungoogled-chromium-127.0.6533.119.pkg " "Chromium web browser without Google" off \ + "chrome-linux " "Linux compat chrome for Netflix" off \ + "brave-linux " "Linux compat brave" off \ + "edge-linux " "Linux compat edge" off \ + "opera-linux " "Linux compat opera" off \ + "vivaldi-linux " "Linux compat vivaldi" off \ + "qutebrowser-3.2.0.pkg " "Qutebrowser vim-like web browser" off \ + "tor-browser-13.5.a9_1.pkg " "Tor Browser for FreeBSD" off \ + "midori-9.0_10.pkg " "Midori web browser" off \ + "thunderbird-115.14.0.pkg " "Thunderbird Mail Client" off \ + "claws-mail-3.20.0.pkg " "Claws-Mail Client" off \ + "putty-0.81.pkg " "Putty term" off \ + "remmina-1.4.35_3.pkg " "Remote Desktop Viewer" off \ + "gtk-mixer-1.0.4.pkg " "Sound controller" off \ + "keepassxc-2.7.6.pkg " "KeePassXC password manager" off \ + "keepass-2.56.pkg " "KeePass password manager" off \ + "codeblocks-20.03_11.pkg " "Code Editor" off \ + "anydesk " "Remote Desktop access" off \ + "vscode-1.92.1_1.pkg " "Code Editor" off \ + "vlc-3.0.21_4,4.pkg " "VLC multimedia player" off \ + "handbrake-1.7.2_1.pkg " "HandBrake video encoder" off \ + "ffmpeg-6.1.2,1.pkg " "Video library" off \ + "audacity-3.5.1_1.pkg " "Audacity audio editor" off \ + "gimp-2.10.38,2.pkg " "GIMP image editor" off \ + "nomacs-3.16_12.pkg " "easy image viewer/editor" off \ + "ristretto-0.13.2.pkg " "Ristretto image viewer" off \ + "liferea-1.14.5_2.pkg " "RSS agregator" off \ + "ytdl-0.6.4_22.pkg " "YouTube video downloader" off \ + "libreoffice-24.2.4.2.pkg " "LibreOffice office suite" off \ + "abiword-3.0.5_9.pkg " "Text editor" off \ + "qpdfview-0.5.0_4.pkg " "PDF document viewer" off \ + "filezilla-3.67.0_1.pkg " "FileZilla FTP client" off \ + "rclone-1.67.0_1.pkg " "Rclone file transfer tool" off \ + "rclone-browser-1.8.0.pkg " "GUI rclone" off \ + "musescore-4.2.1.pkg " "Sheet music editor" off \ + "httrack-3.49.5.pkg " "web-site sucker" off \ + "hexchat-2.16.2.pkg " "HexChat IRC client" off \ + "pidgin " "Pidgin messaging client" off \ + "psi-1.5_3.pkg " "PSI messaging client" off \ + "wireshark-4.2.5.pkg " "Wireshark network protocol analyzer" off \ + "nmap-7.94_3.pkg " "Nmap network discovery tool" off \ + "tor-0.4.8.12.pkg " "Tor decentralized anonymous network" off \ + "openvpn-2.6.12.pkg " "OpenVPN Virtual Private Network setup" off 2>$TMPFILE + + choices=$(sed 's/"//g' < $TMPFILE | tr ' ' '\n') + + # Install the selected programs. + for choice in $choices; do + + case $choice in + "chrome-linux") + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/wget-1.24.5.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/git-2.45.2_1.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + + if [ ! -e /tmp/linux-browser-installer* ]; then + git clone https://github.com/mrclksr/linux-browser-installer.git + fi + + chmod 755 /usr/local/sbin/debootstrap + /tmp/linux-browser-installer install chrome + + ;; + "brave-linux") + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/wget-1.24.5.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/git-2.45.2_1.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + + if [ ! -e /tmp/linux-browser-installer* ]; then + git clone https://github.com/mrclksr/linux-browser-installer.git + fi + + chmod 755 /usr/local/sbin/debootstrap + /tmp/linux-browser-installer install brave + + ;; + "edge-linux") + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/wget-1.24.5.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/git-2.45.2_1.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + + if [ ! -e /tmp/linux-browser-installer* ]; then + git clone https://github.com/mrclksr/linux-browser-installer.git + fi + + chmod 755 /usr/local/sbin/debootstrap + /tmp/linux-browser-installer install edge + + ;; + "opera-linux") + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/wget-1.24.5.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/git-2.45.2_1.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + + if [ ! -e /tmp/linux-browser-installer* ]; then + git clone https://github.com/mrclksr/linux-browser-installer.git + fi + + chmod 755 /usr/local/sbin/debootstrap + /tmp/linux-browser-installer install opera + + ;; + "vivaldi-linux") + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/wget-1.24.5.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + /var/pkgrescue/pkg/wget-1.24.5.pkg_autoinstall.sh + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/git-2.45.2_1.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + /var/pkgrescue/pkg/git-2.45.2_1.pkg_autoinstall.sh + + if [ ! -e /tmp/linux-browser-installer* ]; then + git clone https://github.com/mrclksr/linux-browser-installer.git + fi + + chmod 755 /usr/local/sbin/debootstrap + /tmp/linux-browser-installer install vivaldi + + rm -r /tmp/linux-browser-installer + + ;; + "pidgin") + pkg_list="pidgin-2.14.13.pkg pidgin-bot-sentry-1.3.0_14.pkg pidgin-encryption-3.1_8.pkg pidgin-fetion-0.98.5.2_8.pkg pidgin-hotkeys-0.2.4_21.pkg pidgin-icyque-g20200619_2.pkg pidgin-latex-1.0_13.pkg pidgin-libnotify-0.14_16.pkg pidgin-manualsize-0.7_6.pkg pidgin-otr-4.0.2_3.pkg pidgin-sipe-1.24.0_4.pkg pidgin-skypeweb-1.7_1,1.pkg pidgin-twitter-0.9.2_8.pkg pidgin-window_merge-0.3_1.pkg" + + for pkg in $pkg_list; do + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${pkg}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${pkg}_autoinstall.sh + /var/pkgrescue/pkg/${pkg}_autoinstall.sh + done + ;; + "anydesk") + fetch https://download.anydesk.com/freebsd/anydesk-freebsd-6.1.1-x86_64.tar.gz -P /tmp + cd /tmp + tar -xvzf anydesk-freebsd* + cd anydesk-6* + cp anydesk /usr/local/bin/ + ;; + *) + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${choice}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${choice}_autoinstall.sh + /var/pkgrescue/pkg/${choice}_autoinstall.sh + ;; + esac + + done + + rm -f "$TMPFILE" +} + + + +# usual tools bundle +usual_tools_installation() { + pkg_list="wget-1.24.5.pkg w3m-0.5.3.20230718.pkg lynx-current-2.9.2.pkg rsync-3.3.0.pkg emacs-29.4,3.pkg nano-8.0.pkg sshpass-1.10_1.pkg fuse-1.6.0_6.pkg fusefs-ntfs-2022.10.3_1.pkg fusefs-exfat-1.4.0_1.pkg automount-1.7.9.pkg megatools-1.11.1.20230212_1.pkg dvd+rw-tools-7.1_4.pkg cdrtools-2024.03.21.pkg webcamd-5.17.1.2_2.pkg cups-2.4.10_1.pkg cups-filters-1.28.17_4.pkg system-config-printer-1.5.12_3.pkg pwcview-1.4.1_9.pkg wifimgr-1.23_3.pkg networkmgr-6.4.pkg zip-3.0_2.pkg unzip-6.0_8.pkg bzip2-1.0.8_1.pkg bzip3-1.4.0_2.pkg btop-1.3.2.pkg htop-3.3.0_2.pkg nmap-7.94_3.pkg bind-tools-9.18.28.pkg git-2.45.2_1.pkg rdesktop-1.9.0_1.pkg xrdp-0.9.26,1.pkg tree-2.1.1_1.pkg gh-2.46.0_2.pkg hw-probe-1.6.5.pkg inxi-3.3.11.1_1.pkg python3-3_4.pkg bhyve-firmware-1.0_2.pkg openssl-3.0.14,1.pkg gtkglext-1.2.0_21.pkg" + + for pkg in $pkg_list; do + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/${pkg}_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/${pkg}_autoinstall.sh + /var/pkgrescue/pkg/${pkg}_autoinstall.sh + done + + sysrc -f /boot/loader.conf fusefs_load=YES + sysrc webcamd_enable="YES" + service devd restart + pw groupmod webcamd -m "$user" + sysrc -f /boot/loader.conf cuse_load=YES + sysrc cupsd_enable="YES" + sysrc xrdp_enable="NO" + sysrc xrdp_sesman_enable="NO" + + if [ ! -x /usr/local/bin/ipfwGUI ]; then + cd /tmp + git clone https://github.com/bsdlme/ipfwGUI.git + cd ipfwGUI + make install clean + fi +} + + + +# Install a hypervisor +hypervisor_selection() { + TMPFILE=$(mktemp) + + bsddialog --backtitle "Select programs" \ + --title "Install a hypervisor" \ + --checklist "Select programs:" 9 70 20 \ + "virtualbox-ose " "VirtualBox" off \ + "BVCP " "GUI Bhyve manager" off 2>$TMPFILE + + # Read the user choices from the temporary file. + choices=$(sed 's/"//g' < $TMPFILE | tr ' ' '\n') + + + # Install the selected programs. + for choice in $choices; do + + if [ "$choice" = "virtualbox-ose" ]; then + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/virtualbox-ose-6.1.50_4.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/virtualbox-ose-6.1.50_4.pkg_autoinstall.sh + /var/pkgrescue/pkg/virtualbox-ose-6.1.50_4.pkg_autoinstall.sh + + fetch -o /var/pkgrescue/pkg http://pkgrescue.ddns.net/FreeBSD%3A14%3Aamd64/quarterly/virtualbox-ose-additions-6.1.50.pkg_autoinstall.sh + chmod 740 /var/pkgrescue/pkg/virtualbox-ose-additions-6.1.50.pkg_autoinstall.sh + /var/pkgrescue/pkg/virtualbox-ose-additions-6.1.50.pkg_autoinstall.sh + + sysrc vboxguest_enable=YES > /dev/null 2>&1 + sysrc vboxservice_enable=YES > /dev/null 2>&1 + sysrc vboxnet_enable=YES > /dev/null 2>&1 + sysrc -f /boot/loader.conf vboxdrv_load=YES > /dev/null 2>&1 + + if ! grep -q "^\[system=10\]$" /etc/devfs.rules; then + echo "[system=10]" >> /etc/devfs.rules + fi + + if ! grep -q "^add path 'usb/\*' mode 0660 group operator$" /etc/devfs.rules; then + echo "add path 'usb/*' mode 0660 group operator" >> /etc/devfs.rules + fi + + sysrc devfs_system_ruleset="system" > /dev/null 2>&1 + pw groupmod vboxusers -m "$user" + pw groupmod operator -m "$user" + sysrc hald_enable=YES > /dev/null 2>&1 + + if ! grep -q "^perm cd\* 0660$" /etc/devfs.conf; then + echo "perm cd* 0660" >> /etc/devfs.conf + fi + + if ! grep -q "^perm xpt0 0660$" /etc/devfs.conf; then + echo "perm xpt0 0660" >> /etc/devfs.conf + fi + + if ! grep -q "^perm pass\* 0660$" /etc/devfs.conf; then + echo "perm pass* 0660" >> /etc/devfs.conf + fi + + if ! grep -q "^own vboxnetctl root:vboxusers$" /etc/devfs.conf; then + echo "own vboxnetctl root:vboxusers" >> /etc/devfs.conf + fi + + if ! grep -q "^perm vboxnetctl 0660$" /etc/devfs.conf; then + echo "perm vboxnetctl 0660" >> /etc/devfs.conf + fi + + + chown root:vboxusers /dev/vboxnetctl + chmod 0660 /dev/vboxnetctl + + fi + if [ "$choice" = "BVCP" ]; then + fetch https://bhyve.npulse.net/release.tgz -o /tmp + cd /tmp ; tar xvzf release.tgz ; cd bhyve-webadmin* + ./install.sh + printf "\n" + echo "------------------------------------------------------" + echo "Please note the admin password and then press [ENTER] to continue" + echo "------------------------------------------------------" + read ENTER + fi + + done + + rm -f "$TMPFILE" +} + + +# Add $user to wheel and operator group, add wheel group to sudo permissions +make_administrator() { + pw groupmod wheel -m "$user" + pw groupmod operator -m "$user" + sed -i '' "s/# %wheel/ %wheel/" /usr/local/etc/sudoers +} + + + +# Change locale +locale_selection_menu() { + + # Utiliser bsddialog pour afficher une liste avec des boutons radio + selected_choice=$(bsddialog --title "Select Locale" --radiolist "Please choose:" 19 50 15 \ + "af_ZA.UTF-8" "South Africa" off \ + "am_ET.UTF-8" "Ethiopia" off \ + "ar_AE.UTF-8" "United Arab Emirates" off \ + "ar_EG.UTF-8" "Egypt" off \ + "ar_JO.UTF-8" "Jordan" off \ + "ar_MA.UTF-8" "Morocco" off \ + "ar_QA.UTF-8" "Qatar" off \ + "ar_SA.UTF-8" "Saudi Arabia" off \ + "be_BY.UTF-8" "Belarus" off \ + "bg_BG.UTF-8" "Bulgaria" off \ + "ca_AD.UTF-8" "Andorra" off \ + "ca_ES.UTF-8" "Spain" off \ + "ca_FR.UTF-8" "France" off \ + "ca_IT.UTF-8" "Italy" off \ + "cs_CZ.UTF-8" "Czech Republic" off \ + "da_DK.UTF-8" "Denmark" off \ + "de_AT.UTF-8" "Austria" off \ + "de_CH.UTF-8" "Switzerland" off \ + "de_DE.UTF-8" "Germany" off \ + "el_GR.UTF-8" "Greece" off \ + "en_AU.UTF-8" "Australia" off \ + "en_CA.UTF-8" "Canada" off \ + "en_GB.UTF-8" "United Kingdom" off \ + "en_HK.UTF-8" "Hong Kong" off \ + "en_IE.UTF-8" "Ireland" off \ + "en_NZ.UTF-8" "New Zealand" off \ + "en_PH.UTF-8" "Philippines" off \ + "en_SG.UTF-8" "Singapore" off \ + "en_US.UTF-8" "United States" off \ + "en_ZA.UTF-8" "South Africa" off \ + "es_AR.UTF-8" "Argentina" off \ + "es_CR.UTF-8" "Costa Rica" off \ + "es_ES.UTF-8" "Spain" off \ + "es_MX.UTF-8" "Mexico" off \ + "et_EE.UTF-8" "Estonia" off \ + "eu_ES.UTF-8" "Spain" off \ + "fa_AF.UTF-8" "Afghanistan" off \ + "fa_IR.UTF-8" "Iran" off \ + "fi_FI.UTF-8" "Finland" off \ + "fr_BE.UTF-8" "Belgium" off \ + "fr_CA.UTF-8" "Canada" off \ + "fr_CH.UTF-8" "Switzerland" off \ + "fr_FR.UTF-8" "France" off \ + "ga_IE.UTF-8" "Ireland" off \ + "he_IL.UTF-8" "Israel" off \ + "hi_IN.UTF-8" "India" off \ + "hr_HR.UTF-8" "Croatia" off \ + "hu_HU.UTF-8" "Hungary" off \ + "hy_AM.UTF-8" "Armenia" off \ + "is_IS.UTF-8" "Iceland" off \ + "it_CH.UTF-8" "Switzerland" off \ + "it_IT.UTF-8" "Italy" off \ + "ja_JP.UTF-8" "Japan" off \ + "kk_KZ.UTF-8" "Kazakhstan" off \ + "ko_KR.UTF-8" "South Korea" off \ + "lt_LT.UTF-8" "Lithuania" off \ + "lv_LV.UTF-8" "Latvia" off \ + "mn_MN.UTF-8" "Mongolia" off \ + "nb_NO.UTF-8" "Norway" off \ + "nl_BE.UTF-8" "Belgium" off \ + "nl_NL.UTF-8" "Netherlands" off \ + "nn_NO.UTF-8" "Norway" off \ + "pl_PL.UTF-8" "Poland" off \ + "pt_BR.UTF-8" "Brazil" off \ + "pt_PT.UTF-8" "Portugal" off \ + "ro_RO.UTF-8" "Romania" off \ + "ru_RU.UTF-8" "Russia" off \ + "se_FI.UTF-8" "Finland" off \ + "se_NO.UTF-8" "Norway" off \ + "sk_SK.UTF-8" "Slovakia" off \ + "sl_SI.UTF-8" "Slovenia" off \ + "sr_RS.UTF-8" "Serbia" off \ + "sr_RS.UTF-8@latin" "Serbia" off \ + "sv_FI.UTF-8" "Finland" off \ + "sv_SE.UTF-8" "Sweden" off \ + "tr_TR.UTF-8" "Turkey" off \ + "uk_UA.UTF-8" "Ukraine" off \ + "zh_CN.UTF-8" "China" off \ + "zh_HK.UTF-8" "Hong Kong" off \ + "zh_TW.UTF-8" "Taiwan" off 3>&1 1>&2 2>&3) + + + # Check and Add locale choice to /home/"$user"/.profile + if ! grep -q "export LANG=\"$selected_choice\"" /home/"$user"/.profile; then + { + echo -e "\n# CUSTOM LOCALE" + echo "export LANG=\"$selected_choice\"" + } >> /home/"$user"/.profile + fi + + if ! grep -q "export LC_CTYPE=\"$selected_choice\"" /home/"$user"/.profile; then + echo "export LC_CTYPE=\"$selected_choice\"" >> /home/"$user"/.profile + fi + + # Change the locale for gdm (if installed) + if [ -e /usr/local/etc/gdm/locale.conf ]; then + sed -i '' "s/en_US.UTF-8/$selected_choice/" /usr/local/etc/gdm/locale.conf + fi + + # Change Keyboard map + kbd=$(echo "$selected_choice" | sed 's/^\(..\).*$/\1/') + + if [ ! -e /usr/local/etc/X11/xorg.conf.d/keyboard.conf ]; then + +cat < /usr/local/etc/X11/xorg.conf.d/keyboard.conf +Section "InputClass" +Identifier "KeyboardDefaults" + MatchIsKeyboard "on" + Option "XkbLayout" "$kbd" +EndSection +EOF + + fi + + +} + +build_locatedb() { + + # updatedb : + if [ "$(sysrc -n weekly_locate_enable='/etc/periodic/weekly/310.locate')" = "YES" ]; then + echo "The weekly locate update is already enabled in rc.conf. The script 310.locate will not run." + else + /etc/periodic/weekly/310.locate + fi + +} + +# reboot now +reboot_now() { + bsddialog --yesno "Thank you for using this script!\n The installation is finished\n Do you want to reboot now?" 7 36 + close_inac=$? + + if [ $close_inac -eq 0 ]; then + + reboot + + fi +} + +################################################################################################################ + +checkinternet +installpkg +welcome +update +user_for_desktop +desktop_selection_menu +automatic_graphics_detection # at the very moment, only Intel 'Iris Xe', Intel 'HD/UHD Graphics' and 'NVIDIA' (for 535 version) are automatically detected, choice must be asked manually for others +programs_selection_menu +usual_tools_installation +hypervisor_selection +make_administrator +locale_selection_menu +build_locatedb +reboot_now