freebsd_helpers/freebsd-desktop.sh
2024-04-07 10:11:06 +00:00

404 lines
21 KiB
Bash

#!/bin/sh
# Check if bsddialog is present on the system (for graphical display).
# If not, install the package manager and bsddialog.
while [ ! -x "/usr/local/bin/bsddialog" ]; do
clear
echo "-------------------------------------------"
echo "The bsddialog program is not installed."
echo "Installation in progress..."
printf "\n"
pkg ins -y
pkg ins -y bsddialog
done
##############################################################################################
# Welcome
bsddialog --msgbox "Welcome to this desktop environment installation script for FreeBSD!\n\nFollow the guide to install KDE, XFCE, MATE, CINNAMON, GNOME, or LXQT!" 9 70
##############################################################################################
# System Update
bsddialog --yesno "Do you want to update your system before starting?" 5 54
close_inac=$?
if [ $close_inac -eq 0 ]; then
bsddialog --msgbox "Please review the available changes, then press 'q' to continue" 5 67
freebsd-update fetch
freebsd-update install
fi
##############################################################################################
# User
bsddialog --yesno "Have you already created the user who will use the desktop environment, or not?" 6 53
close_inac=$?
if [ $close_inac -eq 1 ]; then
user=$(bsddialog --inputbox "What username would you like to give to your user? (No spaces or special characters)" 9 56 2>&1 1>/dev/tty)
fullname=$(bsddialog --inputbox "What is his full name ?" 9 40 2>&1 1>/dev/tty)
pw useradd "$user" -d "/home/$user" -m -c "$fullname"
clear
echo "--------------------------------------"
echo "Please assign a password to $user"
passwd $user
else
# Username of the desktop environment user
user=$(bsddialog --inputbox "Please enter the username of the user who will use the desktop environment" 9 50 2>&1 1>/dev/tty)
fi
##############################################################################################
# Which GPU ?
intel-irisxe() {
echo 'Section "Device"' > /usr/local/etc/X11/xorg.conf.d/00-scfb.conf
echo ' Identifier "Card0"' >> /usr/local/etc/X11/xorg.conf.d/00-scfb.conf
echo ' Driver "scfb"' >> /usr/local/etc/X11/xorg.conf.d/00-scfb.conf
echo 'EndSection' >> /usr/local/etc/X11/xorg.conf.d/00-scfb.conf
}
intel-older() {
clear
pkg ins -y xf86-video-intel ; pkg ins -y drm-kmod
sysrc kld_list="i915kms"
}
nvidia-gpu() {
clear
pkg ins -y nvidia-driver
sysrc kld_list="nvidia-modeset"
echo 'Section "Device"' > /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf
echo ' Identifier "Device0"' >> /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf
echo ' Driver "nvidia"' >> /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf
echo ' VendorName "NVIDIA Corporation' >> /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf
echo ' BusID "PCI:1:0:0' >> /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf
echo 'EndSection' >> /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf
}
amd-cpu_amd-gpu() {
clear
pkg ins -y xf86-video-amdgpu
sysrc kld_list="amdgpu"
}
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
##############################################################################################
# DE choice:
kde-sddm() {
pkg ins -y xorg ; pkg ins -y sudo
pkg ins -y sddm ; sysrc sddm_enable="YES"
pkg ins -y kde5 ; pkg ins -y freebsd-8k-wallpapers-kde ; pkg ins -y kde-baseapps ; pkg ins -y kde-dev-scripts ; pkg ins -y kde-dev-utils ; pkg ins -y kde-thumbnailer-chm ; pkg ins -y kde-thumbnailer-epub ; pkg ins -y kde-thumbnailer-fb2 ; pkg ins -y kde_poster ; pkg ins -y kdeaccessibility ; pkg ins -y kdeadmin ; pkg ins -y kdebugsettings ; pkg ins -y kdeconnect-kde ; pkg ins -y kdegames ; pkg ins -y kdegraphics ; pkg ins -y kdegraphics-thumbnailers ; pkg ins -y kdemultimedia ; pkg ins -y kdevelop ; pkg ins -y calligra ; pkg ins -y kmymoney ; pkg ins -y kdemultimedia-ffmpegthumbs ; pkg ins -y kdenetwork ; pkg ins -y kdenetwork-filesharing ; pkg ins -y kdenlive ; pkg ins -y kdeutils ; pkg ins -y libkdegames ; pkg ins -y libkdepim ; pkg ins -y libproxy-kde ; pkg ins -y plasma5-kde-cli-tools ; pkg ins -y plasma5-kde-gtk-config ; pkg ins -y plasma5-kdecoration ; pkg ins -y plasma5-kdeplasma-addons ; pkg ins -y wallpapers-freebsd-kde ; pkg ins -y dsbsu
sysctl net.local.stream.recvspace=65536 ; sysctl net.local.stream.sendspace=65536
sysrc dbus_enable="YES"
echo "proc /proc procfs rw 0 0" >> /etc/fstab
echo "exec ck-launch-session startplasma-x11" > /home/"$user"/.xinitrc
pw groupmod video -m $user
}
xfce-lightdm() {
pkg ins -y xorg ; pkg ins -y sudo
pkg ins -y gtk-xfce-engine ; pkg ins -y libxfce4menu ; pkg ins -y libxfce4util ; pkg ins -y workrave-xfce ; pkg ins -y xfce ; pkg ins -y xfce-icons-elementary ; pkg ins -y xfce4-appfinder ; pkg ins -y xfce4-appmenu-plugin ; pkg ins -y xfce4-battery-plugin ; pkg ins -y xfce4-bsdcpufreq-plugin ; pkg ins -y xfce4-calculator-plugin ; pkg ins -y xfce4-clipman-plugin ; pkg ins -y xfce4-conf ; pkg ins -y xfce4-cpugraph-plugin ; pkg ins -y xfce4-dashboard ; pkg ins -y xfce4-datetime-plugin ; pkg ins -y xfce4-desktop ; pkg ins -y xfce4-dev-tools ; pkg ins -y xfce4-dict-plugin ; pkg ins -y xfce4-diskperf-plugin ; pkg ins -y xfce4-docklike-plugin ; pkg ins -y xfce4-fsguard-plugin ; pkg ins -y xfce4-generic-slider ; pkg ins -y xfce4-genmon-plugin ; pkg ins -y xfce4-goodies ; pkg ins -y xfce4-mailwatch-plugin ; pkg ins -y xfce4-mixer ; pkg ins -y xfce4-mixer-full ; pkg ins -y xfce4-mount-plugin ; pkg ins -y xfce4-mpc-plugin ; pkg ins -y xfce4-netload-plugin ; pkg ins -y xfce4-notes-plugin ; pkg ins -y xfce4-notifyd ; pkg ins -y xfce4-panel ; pkg ins -y xfce4-panel-profiles ; pkg ins -y xfce4-places-plugin ; pkg ins -y xfce4-power-manager ; pkg ins -y xfce4-pulseaudio-plugin ; pkg ins -y xfce4-screensaver ; pkg ins -y xfce4-screenshooter-plugin ; pkg ins -y xfce4-session ; pkg ins -y xfce4-settings ; pkg ins -y xfce4-smartbookmark-plugin ; pkg ins -y xfce4-stopwatch-plugin ; pkg ins -y xfce4-systemload-plugin ; pkg ins -y xfce4-taskmanager ; pkg ins -y xfce4-terminal ; pkg ins -y xfce4-time-out-plugin ; pkg ins -y xfce4-timer-plugin ; pkg ins -y xfce4-tumbler ; pkg ins -y xfce4-verve-plugin ; pkg ins -y xfce4-volumed-pulse ; pkg ins -y xfce4-wavelan-plugin ; pkg ins -y xfce4-weather-plugin ; pkg ins -y xfce4-whiskermenu-plugin ; pkg ins -y xfce4-windowck-plugin ; pkg ins -y xfce4-wm ; pkg ins -y xfce4-wm-themes ; pkg ins -y xfce4-xkb-plugin
pkg ins -y lightdm ; pkg ins -y lightdm-gtk-greeter ; sysrc lightdm_enable="YES"
sysrc dbus_enable="YES"
echo "proc /proc procfs rw 0 0" >> /etc/fstab
cp /usr/local/etc/xdg/xfce4/xinitrc /home/"$user"/.xinitrc
}
mate-lightdm() {
pkg ins -y xorg ; pkg ins -y sudo
pkg ins -y libmatekbd ; pkg ins -y libmatemixer ; pkg ins -y libmateweather ; pkg ins -y libshumate ; pkg ins -y mate ; pkg ins -y mate-applet-appmenu ; pkg ins -y mate-applets ; pkg ins -y mate-backgrounds ; pkg ins -y mate-base ; pkg ins -y mate-calc ; pkg ins -y mate-common ; pkg ins -y mate-control-center ; pkg ins -y mate-desktop ; pkg ins -y mate-dock-applet ; pkg ins -y mate-icon-theme ; pkg ins -y mate-icon-theme-faenza ; pkg ins -y mate-indicator-applet ; pkg ins -y mate-media ; pkg ins -y mate-menus ; pkg ins -y mate-notification-daemon ; pkg ins -y mate-pam-helper ; pkg ins -y mate-panel ; pkg ins -y mate-polkit ; pkg ins -y mate-power-manager ; pkg ins -y mate-screensaver ; pkg ins -y mate-session-manager ; pkg ins -y mate-settings-daemon ; pkg ins -y mate-system-monitor ; pkg ins -y mate-terminal ; pkg ins -y mate-themes ; pkg ins -y mate-user-guide ; pkg ins -y mate-utils ; pkg ins -y materia-gtk-theme
pkg ins -y lightdm ; pkg ins -y lightdm-gtk-greeter ; sysrc lightdm_enable="YES"
sysrc dbus_enable="YES"
echo "proc /proc procfs rw 0 0" >> /etc/fstab
echo "exec ck-launch-session mate-session" > /home/"$user"/.xinitrc
}
cinnamon-lightdm() {
pkg ins -y xorg ; pkg ins -y sudo
pkg ins -y cinnamon ; pkg ins -y cinnamon-control-center ; pkg ins -y cinnamon-desktop ; pkg ins -y cinnamon-menus ; pkg ins -y cinnamon-screensaver ; pkg ins -y cinnamon-session ; pkg ins -y cinnamon-settings-daemon ; pkg ins -y cinnamon-translations
pkg ins -y lightdm ; pkg ins -y lightdm-gtk-greeter ; sysrc lightdm_enable="YES"
sysrc dbus_enable="YES"
echo "proc /proc procfs rw 0 0" >> /etc/fstab
echo "exec ck-launch-session cinnamon-session" > /home/"$user"/.xinitrc
}
gnome-gdm() {
pkg ins -y xorg ; pkg ins -y sudo
pkg ins -y chrome-gnome-shell ; pkg ins -y gnome ; pkg ins -y gnome-2048 ; pkg ins -y gnome-autoar ; pkg ins -y gnome-backgrounds ; pkg ins -y gnome-builder ; pkg ins -y gnome-calculator ; pkg ins -y gnome-calendar ; pkg ins -y gnome-characters ; pkg ins -y gnome-chess ; pkg ins -y gnome-clipboard-daemon ; pkg ins -y gnome-clocks ; pkg ins -y gnome-color-manager ; pkg ins -y gnome-common ; pkg ins -y gnome-connections ; pkg ins -y gnome-console ; pkg ins -y gnome-contacts ; pkg ins -y gnome-control-center ; pkg ins -y gnome-desktop ; pkg ins -y gnome-devel-docs ; pkg ins -y gnome-dictionary ; pkg ins -y gnome-font-viewer ; pkg ins -y gnome-games ; pkg ins -y gnome-getting-started-docs ; pkg ins -y gnome-icon-theme ; pkg ins -y gnome-icon-theme-extras ; pkg ins -y gnome-icon-theme-symbolic ; pkg ins -y gnome-icons ; pkg ins -y gnome-icons-elementary ; pkg ins -y gnome-icons-faenza ; pkg ins -y gnome-icons-luv ; pkg ins -y gnome-initial-setup ; pkg ins -y gnome-keyring ; pkg ins -y gnome-keyring-sharp ; pkg ins -y gnome-klotski ; pkg ins -y gnome-latex ; pkg ins -y gnome-lite ; pkg ins -y gnome-mahjongg ; pkg ins -y gnome-maps ; pkg ins -y gnome-menus ; pkg ins -y gnome-metronome ; pkg ins -y gnome-mime-data ; pkg ins -y gnome-mines ; pkg ins -y gnome-mplayer ; pkg ins -y gnome-music ; pkg ins -y gnome-nettool ; pkg ins -y gnome-nibbles ; pkg ins -y gnome-online-accounts ; pkg ins -y gnome-online-miners ; pkg ins -y gnome-photos ; pkg ins -y gnome-pie ; pkg ins -y gnome-planner ; pkg ins -y gnome-podcasts ; pkg ins -y gnome-pomodoro ; pkg ins -y gnome-power-manager ; pkg ins -y gnome-pty-helper ; pkg ins -y gnome-robots ; pkg ins -y gnome-screenshot ; pkg ins -y gnome-session ; pkg ins -y gnome-settings-daemon ; pkg ins -y gnome-shell ; pkg ins -y gnome-shell-extension-audio-output-switcher ; pkg ins -y gnome-shell-extension-coverflow ; pkg ins -y gnome-shell-extension-dashtodock ; pkg ins -y gnome-shell-extension-dashtopanel ; pkg ins -y gnome-shell-extension-filesmenu ; pkg ins -y gnome-shell-extension-hidetopbar ; pkg ins -y gnome-shell-extension-lockkeys ; pkg ins -y gnome-shell-extension-mediaplayer ; pkg ins -y gnome-shell-extension-openweather ; pkg ins -y gnome-shell-extension-panel-osd ; pkg ins -y gnome-shell-extension-recent-items ; pkg ins -y gnome-shell-extension-trash ; pkg ins -y gnome-shell-extension-weather ; pkg ins -y gnome-shell-extension-windowoverlay-icons ; pkg ins -y gnome-shell-extensions ; pkg ins -y gnome-shell-extra-extensions ; pkg ins -y gnome-sound-recorder ; pkg ins -y gnome-ssh-askpass ; pkg ins -y gnome-sudoku ; pkg ins -y gnome-system-monitor ; pkg ins -y gnome-terminal ; pkg ins -y gnome-tetravex ; pkg ins -y gnome-text-editor ; pkg ins -y gnome-themes ; pkg ins -y gnome-themes-extra ; pkg ins -y gnome-todo ; pkg ins -y gnome-tweaks ; pkg ins -y gnome-user-docs ; pkg ins -y gnome-user-share ; pkg ins -y gnome-utils ; pkg ins -y gnome-video-effects ; pkg ins -y gnome-weather ; pkg ins -y gnome_subr ; pkg ins -y guile-gnome-platform-full ; pkg ins -y guile-gnome-platform-lite ; pkg ins -y libgnome-games-support ; pkg ins -y libgnome-keyring ; pkg ins -y libgnomecanvas ; pkg ins -y libgnomecanvasmm ; pkg ins -y libgnomekbd ; pkg ins -y libproxy-gnome3 ; pkg ins -y pinentry-gnome ; pkg ins -y polkit-gnome ; pkg ins -y qgnomeplatform ; pkg ins -y rubygem-gnome ; pkg ins -y subversion-gnome-keyring ; pkg ins -y xdg-desktop-portal-gnome
sysrc gdm_enable="YES"
sysrc dbus_enable="YES"
echo "proc /proc procfs rw 0 0" >> /etc/fstab
echo "exec gnome-session" > /home/"$user"/.xinitrc
}
lxqt-sddm() {
pkg ins -y xorg ; pkg ins -y sudo
pkg ins -y liblxqt ; pkg ins -y lxqt ; pkg ins -y lxqt-about ; pkg ins -y lxqt-admin ; pkg ins -y lxqt-archiver ; pkg ins -y lxqt-build-tools ; pkg ins -y lxqt-config ; pkg ins -y lxqt-globalkeys ; pkg ins -y lxqt-notificationd ; pkg ins -y lxqt-openssh-askpass ; pkg ins -y lxqt-panel ; pkg ins -y lxqt-policykit ; pkg ins -y lxqt-powermanagement ; pkg ins -y lxqt-qtplugin ; pkg ins -y lxqt-runner ; pkg ins -y lxqt-session ; pkg ins -y lxqt-sudo ; pkg ins -y lxqt-themes
pkg ins -y sddm ; sysrc sddm_enable="YES"
sysrc dbus_enable="YES"
echo "proc /proc procfs rw 0 0" >> /etc/fstab
echo "exec ck-launch-session startlxqt" > /home/"$user"/.xinitrc
}
DE=$(bsddialog --clear \
--backtitle "Desktop Environnment" \
--title "Desktop Environnment" \
--menu "Select your Desktop Environnment:" \
14 70 10 \
1 "KDE" \
2 "XFCE4" \
3 "MATE" \
4 "CINNAMON" \
5 "GNOME" \
6 "LXQT" \
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
##############################################################################################
# Install usual programs
TMPFILE=$(mktemp)
bsddialog --backtitle "Select programs" \
--title "Installing applications" \
--checklist "Select programs:" 30 70 20 \
"firefox " "Firefox web browser" off \
"ungoogled-chromium " "Chromium web browser without Google" off \
"chrome-linux " "Linux compat chrome for Netflix" off \
"qutebrowser " "Qutebrowser vim-like web browser" off \
"midori " "Midori web browser" off \
"thunderbird " "Thunderbird Mail Client" off \
"claws-mail " "Claws-Mail Client" off \
"putty " "Putty term" off \
"remmina " "Remote Desktop Viewer" off \
"gtk-mixer " "Sound controller" off \
"keepassxc " "KeePassXC password manager" off \
"codeblocks " "Code Editor" off \
"vscode " "Code Editor" off \
"vlc " "VLC multimedia player" off \
"handbrake " "HandBrake video encoder" off \
"ffmpeg " "Video library" off \
"audacity " "Audacity audio editor" off \
"gimp " "GIMP image editor" off \
"nomacs " "easy image viewer/editor" off \
"ristretto " "Ristretto image viewer" off \
"liferea " "RSS agregator" off \
"youtube-dl " "YouTube video downloader" off \
"libreoffice " "LibreOffice office suite" off \
"abiword " "Text editor" off \
"qpdfview " "PDF document viewer" off \
"filezilla " "FileZilla FTP client" off \
"rclone " "Rclone file transfer tool" off \
"rclone-browser " "GUI rclone" off \
"musescore " "Sheet music editor" off \
"httrack " "web-site sucker" off \
"hexchat " "HexChat IRC client" off \
"pidgin " "Pidgin messaging client" off \
"psi " "PSI messaging client" off \
"wireshark " "Wireshark network protocol analyzer" off \
"nmap " "Nmap network discovery tool" off \
"tor " "Tor decentralized anonymous network" off \
"openvpn " "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")
pkg ins -y wget git
cd /tmp
git clone https://github.com/mrclksr/linux-browser-installer.git
cd linux-browser-installer*
./linux-browser-installer install chrome
cd ..
rm -r linux-browser-installer
;;
"pidgin")
pkg ins -y pidgin ; pkg ins -y pidgin-bot-sentry ; pkg ins -y pidgin-encryption ; pkg ins -y pidgin-fetion ; pkg ins -y pidgin-hotkeys ; pkg ins -y pidgin-icyque ; pkg ins -y pidgin-latex ; pkg ins -y pidgin-libnotify ; pkg ins -y pidgin-manualsize ; pkg ins -y pidgin-otr ; pkg ins -y pidgin-sipe ; pkg ins -y pidgin-skypeweb ; pkg ins -y pidgin-twitter ; pkg ins -y pidgin-window_merge
;;
*)
pkg ins -y "$choice"
;;
esac
done
rm -f "$TMPFILE"
##############################################################################################
# usual tools bundle
clear
echo "-------------------------------------------"
echo "Installation of the tools..."
printf "\n"
pkg ins -y wget ;
pkg ins -y w3m ; pkg ins -y lynx ; pkg ins -y links
pkg ins -y rsync
pkg ins -y emacs ; pkg ins -y nano
pkg ins -y sshpass
pkg ins -y fuse ; pkg ins -y fusefs-ntfs ; pkg ins -y fusefs-exfat ; pkg ins -y automount ; echo 'fusefs_load="YES"' >> /boot/loader.conf
pkg ins -y megatools
pkg ins -y dvd+rw-tools ; pkg ins -y cdrtools
pkg ins -y youtube_dl
pkg ins -y webcamd ; sysrc webcamd_enable="YES" ; service devd restart ; pw groupmod webcamd -m $user ; echo 'cuse_load="YES"' >> /boot/loader.conf ; pkg ins -y pwcview
pkg ins -y cups cups-filters system-config-printer ; sysrc cupsd_enable="YES"
pkg ins -y wifimgr ; pkg ins -y networkmgr
pkg ins -y zip ; pkg ins -y unzip ; pkg ins -y bzip2 ; pkg ins -y bzip3
pkg ins -y btop ; pkg ins -y htop
pkg ins -y nmap ; pkg ins -y bind-tools ; pkg ins -y rkhunter
pkg ins -y git
pkg ins -y rdesktop ; pkg ins -y xrdp ; sysrc xrdp_enable="NO" xrdp_sesman_enable="NO"
pkg ins -y tree
pkg ins -y gh
pkg ins -y hw-probe
pkg ins -y python3 py39-qt5
# Installation of ipfwGUI :
if [ ! -x /usr/local/bin/ipfwGUI ]; then
cd /tmp
git clone https://github.com/bsdlme/ipfwGUI.git
cd ipfwGUI
make install clean
fi
##############################################################################################
# updatedb :
/etc/periodic/weekly/310.locate ; sysrc weekly_locate_enable="YES"
##############################################################################################
# Install a hypervisor
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
pkg ins -y virtualbox-ose ; pkg ins -y virtualbox-ose-additions
sysrc vboxguest_enable=YES vboxservice_enable=YES vboxnet_enable=YES
echo 'vboxdrv_load="YES"' >> /boot/loader.conf
echo "[system=10]" >> /etc/devfs.rules
echo "add path 'usb/*' mode 0660 group operator" >> /etc/devfs.rules
sysrc devfs_system_ruleset="system"
pw groupmod vboxusers -m "$user"
pw groupmod operator -m "$user"
sysrc hald_enable=YES
{
echo "perm cd* 0660"
echo "perm xpt0 0660"
echo "perm pass* 0660"
} >> /etc/devfs.conf
chown root:vboxusers /dev/vboxnetctl
chmod 0660 /dev/vboxnetctl
echo 'own vboxnetctl root:vboxusers' >> /etc/devfs.conf
echo 'perm vboxnetctl 0660' >> /etc/devfs.conf
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 "Veuillez noter le mot de passe admin puis tapper sur [ENTRER] pour continuer"
echo "------------------------------------------------------"
read ENTER
fi
done
rm -f "$TMPFILE"
##############################################################################################
# Add $user to wheel and operator group, add wheel group to sudo permissions
pw groupmod wheel -m "$user"
pw groupmod operator -m "$user"
sed -i '' "s/# %wheel/ %wheel/" /usr/local/etc/sudoers
##############################################################################################
# Change Keyboard Layout for Xorg
kbd=$(bsddialog --inputbox "Please enter the 2-letter layout corresponding to your keyboard (example: 'us' for QWERTY, 'fr' for AZERTY...)" 9 70 2>&1 1>/dev/tty)
echo 'Section "InputClass"' > /usr/local/etc/X11/xorg.conf.d/keyboard.conf
echo 'Identifier "KeyboardDefaults"' >> /usr/local/etc/X11/xorg.conf.d/keyboard.conf
echo ' MatchIsKeyboard "on"' >> /usr/local/etc/X11/xorg.conf.d/keyboard.conf
echo " Option \"XkbLayout\" \"$kbd\"" >> /usr/local/etc/X11/xorg.conf.d/keyboard.conf
echo 'EndSection' >> /usr/local/etc/X11/xorg.conf.d/keyboard.conf
##############################################################################################
# reboot now
bsddialog --yesno "Do you want to reboot now ?" 5 32
close_inac=$?
if [ $close_inac -eq 0 ]; then
reboot
fi