forked from majekla/freebsd
2186 lines
76 KiB
Bash
2186 lines
76 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
|
||
|
|
||
|
|
||
|
######################################################################
|
||
|
|
||
|
|
||
|
Desktop-Environment_menu() {
|
||
|
|
||
|
clear
|
||
|
|
||
|
checkinternet() {
|
||
|
|
||
|
printf "\n"
|
||
|
echo "Looking for Internet Connection, please wait..."
|
||
|
sleep 1
|
||
|
|
||
|
# Check ping with cloudflare
|
||
|
destination="1.1.1.1"
|
||
|
|
||
|
# Number of ping attempts
|
||
|
num_attempts=3
|
||
|
|
||
|
# Check internet connection with ping
|
||
|
if ! ping -c "$num_attempts" -q "$destination" > /dev/null; then
|
||
|
|
||
|
printf "\n"
|
||
|
echo "-------------------------------------------"
|
||
|
echo "Your computer is not connected to internet, I can't go on"
|
||
|
printf "\n"
|
||
|
exit 0
|
||
|
|
||
|
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
|
||
|
|
||
|
printf "\n"
|
||
|
echo "-------------------------------------------"
|
||
|
echo "I can't install pkg, please check your internet connection"
|
||
|
printf "\n"
|
||
|
exit 0
|
||
|
|
||
|
fi
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
installbsddialog() {
|
||
|
|
||
|
printf "\n"
|
||
|
echo "Looking for 'bsddialog', please wait..."
|
||
|
sleep 1
|
||
|
|
||
|
if [ ! -x "/usr/local/bin/bsddialog" ]; then
|
||
|
|
||
|
if pkg ins -y bsddialog | grep -q "error"; then
|
||
|
|
||
|
printf "\n"
|
||
|
echo "-------------------------------------------"
|
||
|
echo "I can't install bsddialog, please check your internet connection"
|
||
|
printf "\n"
|
||
|
exit 0
|
||
|
|
||
|
fi
|
||
|
|
||
|
fi
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
# Welcome !
|
||
|
welcome() {
|
||
|
|
||
|
printf "\n"
|
||
|
echo "Everything seems OK, let's go !"
|
||
|
sleep 1
|
||
|
|
||
|
bsddialog --msgbox "Welcome to this desktop installation script for FreeBSD!" 5 60
|
||
|
}
|
||
|
|
||
|
|
||
|
# System Update
|
||
|
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
|
||
|
user_for_desktop() {
|
||
|
bsddialog --yesno "Have you already created the user who will use the desktop?" 5 63
|
||
|
close_inac=$?
|
||
|
|
||
|
if [ $close_inac -eq 1 ]; then
|
||
|
|
||
|
i=0
|
||
|
while [ $i -lt 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
|
||
|
checkuser=$(getent passwd | grep "$user" | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkuser -eq 1 ]; then
|
||
|
|
||
|
bsddialog --yesno " !WARNING!\n This user already exists\nDo you want to use it [Yes] or create another one [No]" 7 58
|
||
|
use_oranother=$?
|
||
|
|
||
|
if [ $use_oranother -eq 1 ]; then
|
||
|
|
||
|
i=$((i+1))
|
||
|
|
||
|
else
|
||
|
|
||
|
i=$((i+5))
|
||
|
|
||
|
fi
|
||
|
|
||
|
else
|
||
|
|
||
|
pw useradd "$user" -d "/home/$user" -m -c "$fullname"
|
||
|
|
||
|
clear
|
||
|
echo "--------------------------------------"
|
||
|
echo "Please assign a password to $user"
|
||
|
printf "\n"
|
||
|
|
||
|
passwd $user
|
||
|
|
||
|
i=$((i+5))
|
||
|
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
# Exit script if not able to create a user
|
||
|
if [ $i -eq 4 ]; then
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
|
||
|
else
|
||
|
|
||
|
j=0
|
||
|
while [ $j -lt 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
|
||
|
checkuser=$(getent passwd | grep "$user" | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkuser -eq 0 ]; then
|
||
|
|
||
|
bsddialog --msg " !WARNING!\n This user does not exist\n Please try again" 7 58
|
||
|
|
||
|
j=$((j+1))
|
||
|
|
||
|
else
|
||
|
|
||
|
j=$((j+5))
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
|
||
|
# Exit script if not able to choose a user
|
||
|
if [ $j -eq 4 ]; then
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
fi
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
# 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"
|
||
|
|
||
|
checkfstab=$(grep "proc /proc procfs rw 0 0" < /etc/fstab | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkstab -eq 0 ]; then
|
||
|
echo "proc /proc procfs rw 0 0" >> /etc/fstab
|
||
|
fi
|
||
|
|
||
|
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"
|
||
|
|
||
|
checkfstab=$(grep "proc /proc procfs rw 0 0" < /etc/fstab | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkstab -eq 0 ]; then
|
||
|
echo "proc /proc procfs rw 0 0" >> /etc/fstab
|
||
|
fi
|
||
|
|
||
|
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"
|
||
|
|
||
|
checkfstab=$(grep "proc /proc procfs rw 0 0" < /etc/fstab | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkstab -eq 0 ]; then
|
||
|
echo "proc /proc procfs rw 0 0" >> /etc/fstab
|
||
|
fi
|
||
|
|
||
|
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"
|
||
|
|
||
|
checkfstab=$(grep "proc /proc procfs rw 0 0" < /etc/fstab | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkstab -eq 0 ]; then
|
||
|
echo "proc /proc procfs rw 0 0" >> /etc/fstab
|
||
|
fi
|
||
|
|
||
|
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"
|
||
|
|
||
|
checkfstab=$(grep "proc /proc procfs rw 0 0" < /etc/fstab | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkstab -eq 0 ]; then
|
||
|
echo "proc /proc procfs rw 0 0" >> /etc/fstab
|
||
|
fi
|
||
|
|
||
|
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"
|
||
|
|
||
|
checkfstab=$(grep "proc /proc procfs rw 0 0" < /etc/fstab | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkstab -eq 0 ]; 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() {
|
||
|
|
||
|
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 " BusID \"$intelirisxe_pci_location\"" >> /usr/local/etc/X11/xorg.conf.d/00-scfb.conf
|
||
|
echo 'EndSection' >> /usr/local/etc/X11/xorg.conf.d/00-scfb.conf
|
||
|
|
||
|
}
|
||
|
|
||
|
vbox() {
|
||
|
|
||
|
echo '# This configuration file is useless.' > /usr/local/etc/X11/xorg.conf.d/00-vbox.conf
|
||
|
echo '# If only permits autodetection.' >> /usr/local/etc/X11/xorg.conf.d/00-vbox.conf
|
||
|
|
||
|
}
|
||
|
|
||
|
intel-older() {
|
||
|
clear
|
||
|
pkg ins -y xf86-video-intel ; pkg ins -y drm-kmod
|
||
|
sysrc kld_list="i915kms"
|
||
|
|
||
|
echo 'Section "Device"' > /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
echo ' Identifier "Intel Graphics"' >> /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
echo ' Driver "intel"' >> /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
echo ' Option "AccelMethod" "sna"' >> /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
echo ' Option "TearFree" "true"' >> /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
echo ' Option "DRI" "3"' >> /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
echo ' Option "Backlight" "intel_backlight"' >> /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
echo " BusID \"$intel_pci_location\"" >> /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
echo "EndSection" >> /usr/local/etc/X11/xorg.conf.d/00-intel.conf
|
||
|
}
|
||
|
|
||
|
nvidia-gpu() {
|
||
|
clear
|
||
|
pkg ins -y nvidia-driver
|
||
|
sysrc kld_list="nvidia-modeset"
|
||
|
|
||
|
# 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://')
|
||
|
|
||
|
|
||
|
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 \"$nvidia_pci_location\"" >> /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"
|
||
|
}
|
||
|
|
||
|
|
||
|
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
|
||
|
|
||
|
#bsddialog --yesno "We have detected VirtualBox graphics on your computer\n (BusID \"$vbox_pci_location\")\nDo you want to use it [Yes] or use another one [No] ?" 7 57
|
||
|
#vbox_ornot=$?
|
||
|
|
||
|
|
||
|
#if [ $vbox_ornot -eq 0 ]; then
|
||
|
|
||
|
vbox
|
||
|
|
||
|
#fi
|
||
|
|
||
|
fi
|
||
|
|
||
|
|
||
|
# If an Intel Iris Xe is detected, ask to accept or not :
|
||
|
if [ ! -z "$intelirisxe_pciconf_output" ]; then
|
||
|
|
||
|
#bsddialog --yesno "We have detected an Iris Xe graphics on your computer\n (BusID \"$intelirisxe_pci_location\")\nDo you want to use it [Yes] or use another one [No] ?" 7 57
|
||
|
#Irisx_ornot=$?
|
||
|
|
||
|
|
||
|
#if [ $Irisx_ornot -eq 0 ]; then
|
||
|
|
||
|
intel-irisxe
|
||
|
|
||
|
#fi
|
||
|
|
||
|
fi
|
||
|
|
||
|
|
||
|
# If an Intel is detected, ask to accept or not :
|
||
|
if [ ! -z "$intel_pciconf_output" ]; then
|
||
|
|
||
|
#bsddialog --yesno "We have detected an Intel graphics on your computer\n (BusID \"$intel_pci_location\")\nDo you want to use it [Yes] or use another one [No] ?" 7 57
|
||
|
#intel_ornot=$?
|
||
|
|
||
|
|
||
|
#if [ $intel_ornot -eq 0 ]; then
|
||
|
|
||
|
intel-older
|
||
|
|
||
|
#fi
|
||
|
|
||
|
fi
|
||
|
|
||
|
|
||
|
# If an NVIDIA is detected, ask to accept or not :
|
||
|
if [ ! -z "$nvidia_pciconf_output" ]; then
|
||
|
|
||
|
#bsddialog --yesno "We have detected a NVIDIA graphics on your computer\n (BusID \"$nvidia_pci_location\")\nDo you want to use it [Yes] or use another one [No] ?" 7 57
|
||
|
#nvidia_ornot=$?
|
||
|
|
||
|
#if [ $nvidia_ornot -eq 0 ]; then
|
||
|
|
||
|
nvidia-gpu
|
||
|
|
||
|
#fi
|
||
|
fi
|
||
|
|
||
|
|
||
|
# If no choice has been done, go to graphics_selection_menu :
|
||
|
if [ ! -e /usr/local/etc/X11/xorg.conf.d/00-scfb.conf ] ; then
|
||
|
if [ ! -e /usr/local/etc/X11/xorg.conf.d/00-nvidia.conf ]; then
|
||
|
if [ ! -e ]/usr/local/etc/X11/xorg.conf.d/00-intel.conf]; then
|
||
|
if [ ! -e ]/usr/local/etc/X11/xorg.conf.d/00-vbox.conf]; then
|
||
|
graphics_selection_menu
|
||
|
fi
|
||
|
fi
|
||
|
fi
|
||
|
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 " "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 \
|
||
|
"tor-browser " "Tor Browser for FreeBSD" 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
|
||
|
usual_tools_installation() {
|
||
|
if [ ! -x /usr/local/bin/wget ]; then
|
||
|
pkg ins -y wget
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/w3m ]; then
|
||
|
pkg ins -y w3m
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/lynx ]; then
|
||
|
pkg ins -y lynx
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/rsync ]; then
|
||
|
pkg ins -y rsync
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/emacs ]; then
|
||
|
pkg ins -y emacs
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/nano ]; then
|
||
|
pkg ins -y nano
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/sshpass ]; then
|
||
|
pkg ins -y sshpass
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/fuse ]; then
|
||
|
pkg ins -y fuse
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/ntfs-3g ]; then
|
||
|
pkg ins -y fusefs-ntfs
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/sbin/mount.exfat ]; then
|
||
|
pkg ins -y fusefs-exfat
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/ntfs-3g ]; then
|
||
|
pkg ins -y fusefs-ntfs
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/sbin/automount ]; then
|
||
|
pkg ins -y automount
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/megatools ]; then
|
||
|
pkg ins -y megatools
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/ntfs-3g ]; then
|
||
|
pkg ins -y fusefs-ntfs
|
||
|
fi
|
||
|
|
||
|
checkfusefsload=$(grep "fusefs_load=\"YES\"" < /boot/loader.conf | wc -l | tr -d ' ' | uniq)
|
||
|
if [ ! $checkfusefsload -eq "1" ]; then
|
||
|
echo 'fusefs_load="YES"' >> /boot/loader.conf
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/growisofs ]; then
|
||
|
pkg ins -y dvd+rw-tools
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/cdrecord ]; then
|
||
|
pkg ins -y cdrtools
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/sbin/webcamd ]; then
|
||
|
pkg ins -y webcamd
|
||
|
sysrc webcamd_enable="YES"
|
||
|
service devd restart
|
||
|
pw groupmod webcamd -m $user
|
||
|
sysrc -f /boot/loader.conf cuse_load=YES
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/pwcview ]; then
|
||
|
pkg ins -y pwcview
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/lpr ]; then
|
||
|
pkg ins -y cups
|
||
|
pkg ins -y cups-filters
|
||
|
pkg ins -y system-config-printer
|
||
|
sysrc cupsd_enable="YES"
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/wifimgr ]; then
|
||
|
pkg ins -y wifimgr
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/networkmgr ]; then
|
||
|
pkg ins -y networkmgr
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/zip ]; then
|
||
|
pkg ins -y zip
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/unzip ]; then
|
||
|
pkg ins -y unzip
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/bzip2 ]; then
|
||
|
pkg ins -y bzip2
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/bzip3 ]; then
|
||
|
pkg ins -y bzip3
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/btop ]; then
|
||
|
pkg ins -y btop
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/htop ]; then
|
||
|
pkg ins -y htop
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/nmap ]; then
|
||
|
pkg ins -y nmap
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/nslookup ]; then
|
||
|
pkg ins -y bind-tools
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/git ]; then
|
||
|
pkg ins -y git
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/rdesktop ]; then
|
||
|
pkg ins -y rdesktop
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/sbin/xrdp ]; then
|
||
|
pkg ins -y xrdp
|
||
|
sysrc xrdp_enable="NO"
|
||
|
xrdp_sesman_enable="NO"
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/tree ]; then
|
||
|
pkg ins -y tree
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/gh ]; then
|
||
|
pkg ins -y gh
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/hw-probe ]; then
|
||
|
pkg ins -y hw-probe
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/inxi ]; then
|
||
|
pkg ins -y inxi
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/python3 ]; then
|
||
|
pkg ins -y python3
|
||
|
pkg ins -y py39-qt5
|
||
|
fi
|
||
|
|
||
|
if [ ! -x /usr/local/bin/inxi ]; then
|
||
|
pkg ins -y inxi
|
||
|
fi
|
||
|
|
||
|
if [ ! -e /usr/local/share/licenses/bhyve-firmware-1.*/catalog.mk ]; then
|
||
|
pkg ins -y bhyve-firmware
|
||
|
fi
|
||
|
|
||
|
# 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
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
# 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
|
||
|
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" >> /etc/devfs.conf
|
||
|
echo "perm xpt0 0660" >> /etc/devfs.conf
|
||
|
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 "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
|
||
|
checkprofilelocale=$(grep "export LANG=\"$selected_choice\"" < /home/"$user"/.profile | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkprofilelocale -eq 0 ]; then
|
||
|
printf "\n" >> /home/"$user"/.profile
|
||
|
echo "# CUSTOM LOCALE" >> /home/"$user"/.profile
|
||
|
echo "export LANG=\"$selected_choice\"" >> /home/"$user"/.profile
|
||
|
fi
|
||
|
|
||
|
checkprofilelctype=$(grep "export LC_CTYPE=\"$selected_choice\"" < /home/"$user"/.profile | wc -l | tr -d ' ' | uniq)
|
||
|
if [ $checkprofilelctype -eq 0 ]; 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
|
||
|
|
||
|
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
|
||
|
|
||
|
fi
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
build_locatedb() {
|
||
|
|
||
|
# updatedb :
|
||
|
/etc/periodic/weekly/310.locate
|
||
|
sysrc weekly_locate_enable="YES"
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
# Thanks
|
||
|
thanks() {
|
||
|
|
||
|
bsddialog --msgbox "Welcome to this desktop installation script for FreeBSD!" 5 60
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
# 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
|
||
|
installbsddialog
|
||
|
welcome
|
||
|
update
|
||
|
user_for_desktop
|
||
|
desktop_selection_menu
|
||
|
automatic_graphics_detection # at the very moment, only Intel 'Iris Xe', Intel 'HD Graphics' and 'NVIDIA' 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
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
Update-full-system() {
|
||
|
bsddialog --msgbox "Please review the available changes, then press 'q' to continue" 5 67
|
||
|
freebsd-update fetch
|
||
|
freebsd-update install
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
Format-USB-UFS() {
|
||
|
|
||
|
bsddialog --msgbox "Please connect your USB device now" 5 38
|
||
|
sleep 7
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "I am running the command 'camcontrol devlist' for you,"
|
||
|
echo "Please find in the list below,"
|
||
|
echo "the disk you want to erase, partition, and format in UFS"
|
||
|
sleep 2
|
||
|
echo "-----------------------------------"
|
||
|
camcontrol devlist
|
||
|
echo "-----------------------------------"
|
||
|
echo "Enter the name of the disk (examples: da0, da1 ...)"
|
||
|
read pathdi
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Would you like to proceed with a secure erase (dd)? [y/n]"
|
||
|
echo "(The erasing process can take several hours, or even days !)"
|
||
|
read effsec
|
||
|
|
||
|
case $effsec in
|
||
|
y|Y)
|
||
|
|
||
|
umount -f /dev/fuse
|
||
|
umount -f /dev/$pathdi*
|
||
|
gpart destroy -F /dev/$pathdi
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The secure erase is starting"
|
||
|
printf "\n"
|
||
|
sleep 1
|
||
|
dd if=/dev/zero of=/dev/$pathdi bs=8m status=progress
|
||
|
;;
|
||
|
n|N)
|
||
|
|
||
|
umount -f /dev/fuse
|
||
|
umount -f /dev/$pathdi*
|
||
|
gpart destroy -F /dev/$pathdi
|
||
|
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Creating GPT table"
|
||
|
gpart create -s GPT /dev/$pathdi
|
||
|
echo "-----------------------------------"
|
||
|
echo "Creating UFS partition"
|
||
|
partia=`gpart add -t freebsd-ufs -a 1m /dev/$pathdi | cut -d ' ' -f1`
|
||
|
partia2="$partia"
|
||
|
echo "-----------------------------------"
|
||
|
echo "UFS formatting of the partition $pathdip"
|
||
|
newfs -U /dev/$partia2
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The erase, partition creation, and formatting are completed"
|
||
|
echo "All you have to do now is mount the partition $partia2 wherever you like, if it doesn't mount automatically"
|
||
|
echo "-----------------------------------"
|
||
|
echo "Press any key to return to the previous menu"
|
||
|
read ENTER
|
||
|
|
||
|
MainMenu
|
||
|
}
|
||
|
|
||
|
Format-USB-FAT32 () {
|
||
|
|
||
|
bsddialog --msgbox "Please connect your USB device now" 5 38
|
||
|
sleep 7
|
||
|
|
||
|
if [ ! -x /usr/local/sbin/mount.exfat ]; then
|
||
|
|
||
|
pkg ins -y fuse fuse-ntfs fusefs-exfat
|
||
|
|
||
|
fi
|
||
|
|
||
|
if kldstat | grep -q "fusefs"; then
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "fusefs is loaded"
|
||
|
|
||
|
else
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "fusefs is not loaded"
|
||
|
printf "\n"
|
||
|
|
||
|
kldload fusefs
|
||
|
|
||
|
fi
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "I am running the command 'camcontrol devlist' for you,"
|
||
|
echo "Please find in the list below,"
|
||
|
echo "the disk you want to erase, partition, and format in FAT32"
|
||
|
sleep 2
|
||
|
echo "-----------------------------------"
|
||
|
camcontrol devlist
|
||
|
echo "-----------------------------------"
|
||
|
echo "Enter the name of the disk (examples: da0, da1 ...)"
|
||
|
read pathdi
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Would you like to proceed with a secure erase (dd)? [y/n]"
|
||
|
echo "(The erasing process can take several hours, or even days !)"
|
||
|
read effsec
|
||
|
|
||
|
case $effsec in
|
||
|
y|Y)
|
||
|
|
||
|
umount -f /dev/fuse
|
||
|
umount -f /dev/$pathdi*
|
||
|
gpart destroy -F /dev/$pathdi
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The secure erase is starting"
|
||
|
printf "\n"
|
||
|
sleep 1
|
||
|
dd if=/dev/zero of=/dev/$pathdi bs=8m status=progress
|
||
|
;;
|
||
|
n|N)
|
||
|
|
||
|
umount -f /dev/fuse
|
||
|
umount -f /dev/$pathdi*
|
||
|
gpart destroy -F /dev/$pathdi
|
||
|
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Creating MBR table"
|
||
|
gpart create -s mbr /dev/$pathdi
|
||
|
echo "-----------------------------------"
|
||
|
echo "Please enter a Label for your partition"
|
||
|
read namepartfat
|
||
|
echo "-----------------------------------"
|
||
|
echo "Creating FAT32 partition"
|
||
|
partia=`gpart add -t fat32 /dev/$pathdi | cut -d ' ' -f1`
|
||
|
partia2="$partia"
|
||
|
echo "-----------------------------------"
|
||
|
echo "FAT32 formatting of the partition $pathdia2"
|
||
|
newfs_msdos -L $namepartfat /dev/$partia2
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The erase, partition creation, and formatting are completed"
|
||
|
echo "All you have to do now is mount the partition $partia2 wherever you like, if it doesn't mount automatically"
|
||
|
echo "-----------------------------------"
|
||
|
echo "Press any key to return to the previous menu"
|
||
|
read ENTER
|
||
|
|
||
|
MainMenu
|
||
|
}
|
||
|
|
||
|
Format-USB-NTFS () {
|
||
|
|
||
|
bsddialog --msgbox "Please connect your USB device now" 5 38
|
||
|
sleep 7
|
||
|
|
||
|
if [ ! -x /usr/local/sbin/mkntfs ]; then
|
||
|
|
||
|
pkg ins -y fuse fusefs-ntfs fusefs-exfat
|
||
|
|
||
|
fi
|
||
|
|
||
|
if kldstat | grep -q "fusefs"; then
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "fusefs is loaded"
|
||
|
|
||
|
else
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "fusefs is not loaded"
|
||
|
printf "\n"
|
||
|
|
||
|
kldload fusefs
|
||
|
|
||
|
fi
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "I am running the command 'camcontrol devlist' for you,"
|
||
|
echo "Please find in the list below,"
|
||
|
echo "the disk you want to erase, partition, and format in NTFS"
|
||
|
sleep 2
|
||
|
echo "-----------------------------------"
|
||
|
camcontrol devlist
|
||
|
echo "-----------------------------------"
|
||
|
echo "Enter the name of the disk (examples: da0, da1 ...)"
|
||
|
read pathdi
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Would you like to proceed with a secure erase (dd)? [y/n]"
|
||
|
echo "(The erasing process can take several hours, or even days !)"
|
||
|
read effsec
|
||
|
|
||
|
case $effsec in
|
||
|
y|Y)
|
||
|
|
||
|
umount -f /dev/fuse
|
||
|
umount -f /dev/$pathdi*
|
||
|
gpart destroy -F $pathdi
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The secure erase is starting"
|
||
|
printf "\n"
|
||
|
sleep 1
|
||
|
dd if=/dev/zero of=/dev/$pathdi bs=8m status=progress
|
||
|
;;
|
||
|
n|N)
|
||
|
|
||
|
umount -f /dev/fuse
|
||
|
umount -f /dev/$pathdi*
|
||
|
gpart destroy -F $pathdi
|
||
|
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Creating GPT table"
|
||
|
gpart create -s GPT $pathdi
|
||
|
echo "-----------------------------------"
|
||
|
echo "Creating ms-basic-data partition"
|
||
|
partia=`gpart add -t ms-basic-data $pathdi | cut -d ' ' -f1`
|
||
|
partia2="$partia"
|
||
|
echo "-----------------------------------"
|
||
|
echo "NTFS formatting of the partition $pathdia2"
|
||
|
chmod 760 /dev/$partia2
|
||
|
export NTFS_USE_UBLIO=0
|
||
|
mkntfs -vFQ /dev/$partia2
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The erase, partition creation, and formatting are completed"
|
||
|
echo "All you have to do now is mount the partition $partia2 wherever you like, if it doesn't mount automatically"
|
||
|
echo "-----------------------------------"
|
||
|
echo "Press any key to return to the previous menu"
|
||
|
read ENTER
|
||
|
|
||
|
MainMenu
|
||
|
}
|
||
|
|
||
|
Secure-erase-USB () {
|
||
|
|
||
|
bsddialog --msgbox "Please connect your USB device now" 5 38
|
||
|
sleep 7
|
||
|
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "I am running the command 'camcontrol devlist' for you,"
|
||
|
echo "Please find in the list below,"
|
||
|
echo "the disk you want to securely erase"
|
||
|
sleep 2
|
||
|
echo "-----------------------------------"
|
||
|
camcontrol devlist
|
||
|
echo "-----------------------------------"
|
||
|
echo "Enter the name of the disk (examples: da0, da1 ...)"
|
||
|
read pathdi
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Do you confirm that you want to erase this device? [y/n]"
|
||
|
echo "(The erasing process can take several hours, or even days !)"
|
||
|
read effsec
|
||
|
|
||
|
case $effsec in
|
||
|
y|Y)
|
||
|
|
||
|
umount -f /dev/fuse
|
||
|
umount -f /dev/$pathdi*
|
||
|
gpart destroy -F $pathdi
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The secure erase is starting"
|
||
|
printf "\n"
|
||
|
sleep 1
|
||
|
dd if=/dev/zero of=/dev/$pathdi bs=8m status=progress
|
||
|
;;
|
||
|
n|N)
|
||
|
|
||
|
MainMenu
|
||
|
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The erase is completed"
|
||
|
echo "All you have to do now is mount the partition $partia2 wherever you like, if it doesn't mount automatically"
|
||
|
echo "-----------------------------------"
|
||
|
echo "Press any key to return to the previous menu"
|
||
|
read ENTER
|
||
|
|
||
|
MainMenu
|
||
|
}
|
||
|
|
||
|
Burn-iso-USB () {
|
||
|
|
||
|
bsddialog --msgbox "Please connect your USB device now" 5 38
|
||
|
sleep 7
|
||
|
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "I am running the command 'camcontrol devlist' for you,"
|
||
|
echo "Please find in the list below,"
|
||
|
echo "the disk you want to securely erase"
|
||
|
sleep 2
|
||
|
echo "-----------------------------------"
|
||
|
camcontrol devlist
|
||
|
echo "-----------------------------------"
|
||
|
echo "Enter the name of the disk (examples: da0, da1 ...)"
|
||
|
read pathdi
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
TMPFILE=$(mktemp)
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Please navigate in your system until you find the IMAGE.iso"
|
||
|
sleep 3
|
||
|
|
||
|
ls > $TMPFILE
|
||
|
options=$(cat -n $TMPFILE)
|
||
|
|
||
|
i=0
|
||
|
while [ $i -lt 30 ]; do
|
||
|
whereamI=$(pwd)
|
||
|
ls > $TMPFILE
|
||
|
options=$(cat -n $TMPFILE)
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "You're in $whereamI"
|
||
|
printf "\n"
|
||
|
|
||
|
echo " 0 (go back to parent folder)"
|
||
|
cat -n $TMPFILE
|
||
|
|
||
|
printf "\n"
|
||
|
echo "-----------------------------------"
|
||
|
echo "Enter the index of your choice (or 'q' to quit):"
|
||
|
read opt
|
||
|
|
||
|
if [ "$opt" = "q" ]; then
|
||
|
exit
|
||
|
elif [ "$opt" -eq 0 ]; then
|
||
|
cd ..
|
||
|
elif [ "$opt" -eq "$opt" ] 2>/dev/null && [ "$opt" -ge 1 ] && [ "$opt" -le "$(wc -l < $TMPFILE)" ]; then
|
||
|
selected_file=$(sed -n "${opt}p" $TMPFILE)
|
||
|
if [ -d "$selected_file" ]; then
|
||
|
cd "$selected_file"
|
||
|
i=$((i+1))
|
||
|
else
|
||
|
IMAGE=$(realpath "$selected_file")
|
||
|
i=$((i+31))
|
||
|
fi
|
||
|
else
|
||
|
echo "Invalid input. Please enter a valid index."
|
||
|
sleep 1
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
|
||
|
rm -f "$TMPFILE"
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The image is currently being burned."
|
||
|
printf "\n"
|
||
|
|
||
|
umount -f /dev/$pathdi*
|
||
|
dd if="$IMAGE" of=/dev/$pathdi bs=8m status=progress
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The burning is complete"
|
||
|
echo "-----------------------------------"
|
||
|
echo "Press any key to return to the previous menu"
|
||
|
read ENTER
|
||
|
|
||
|
MainMenu
|
||
|
}
|
||
|
|
||
|
Burn-iso-DVD-BD () {
|
||
|
|
||
|
if [ ! -x /usr/local/bin/growisofs ]; then
|
||
|
|
||
|
pkg ins -y dvd+rw-tools cdrtools
|
||
|
|
||
|
fi
|
||
|
|
||
|
# Check if hw.ata.atapi_dma="1" is already added to /boot/loader.conf or not
|
||
|
if grep -qxF 'hw.ata.atapi_dma="1"' /boot/loader.conf; then
|
||
|
echo "hw.ata.atapi_dma="1" is already added to /boot/loader.conf"
|
||
|
else
|
||
|
# Si la ligne n'existe pas, l'ajouter
|
||
|
echo 'hw.ata.atapi_dma="1"' | sudo tee -a /boot/loader.conf
|
||
|
echo "hw.ata.atapi_dma="1" has been added to /boot/loader.conf"
|
||
|
fi
|
||
|
|
||
|
# Check if [system 10] is already added to /etc/devfs.rules or not
|
||
|
if grep -qxF '[system 10]' /etc/devfs.rules; then
|
||
|
echo "[system 10] is already added to /etc/devfs.rules"
|
||
|
else
|
||
|
# Si la ligne n'existe pas, l'ajouter
|
||
|
echo '[system 10]' | sudo tee -a /etc/devfs.rules
|
||
|
echo "[system 10] has been added to /etc/devfs.rules"
|
||
|
fi
|
||
|
|
||
|
# Check if 'add path 'cd*' mode 666' is already added to /etc/devfs.rules or not
|
||
|
if grep -qxF "add path 'cd*' mode 666" /etc/devfs.rules; then
|
||
|
echo "add path 'cd*' mode 666 is already added to /etc/devfs.rules"
|
||
|
else
|
||
|
# Si la ligne n'existe pas, l'ajouter
|
||
|
echo "add path 'cd*' mode 666" | sudo tee -a /etc/devfs.rules
|
||
|
echo "add path 'cd*' mode 666 has been added to /etc/devfs.rules"
|
||
|
fi
|
||
|
|
||
|
# Check if 'add path 'pass0' mode 666' is already added to /etc/devfs.rules or not
|
||
|
if grep -qxF "add path 'pass0' mode 666" /etc/devfs.rules; then
|
||
|
echo "add path 'pass0' mode 666 is already added to /etc/devfs.rules"
|
||
|
else
|
||
|
# Si la ligne n'existe pas, l'ajouter
|
||
|
echo "add path 'pass0' mode 666" | sudo tee -a /etc/devfs.rules
|
||
|
echo "add path 'pass0' mode 666 has been added to /etc/devfs.rules"
|
||
|
fi
|
||
|
|
||
|
# Check if 'add path 'xpt0' mode 666' is already added to /etc/devfs.rules or not
|
||
|
if grep -qxF "add path 'xpt0' mode 666" /etc/devfs.rules; then
|
||
|
echo "add path 'xpt0' mode 666 is already added to /etc/devfs.rules"
|
||
|
else
|
||
|
# Si la ligne n'existe pas, l'ajouter
|
||
|
echo "add path 'xpt0' mode 666" | sudo tee -a /etc/devfs.rules
|
||
|
echo "add path 'xpt0' mode 666 has been added to /etc/devfs.rules"
|
||
|
fi
|
||
|
|
||
|
sysrc devfs_system_ruleset=system
|
||
|
service devfs restart
|
||
|
|
||
|
|
||
|
bsddialog --msgbox "Please insert the blank media now" 5 38
|
||
|
sleep 7
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
TMPFILE=$(mktemp)
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "Please navigate in your system until you find the IMAGE.iso"
|
||
|
sleep 3
|
||
|
|
||
|
ls > $TMPFILE
|
||
|
options=$(cat -n $TMPFILE)
|
||
|
|
||
|
i=0
|
||
|
while [ $i -lt 30 ]; do
|
||
|
whereamI=$(pwd)
|
||
|
ls > $TMPFILE
|
||
|
options=$(cat -n $TMPFILE)
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "You're in $whereamI"
|
||
|
printf "\n"
|
||
|
|
||
|
echo " 0 (go back to parent folder)"
|
||
|
cat -n $TMPFILE
|
||
|
|
||
|
printf "\n"
|
||
|
echo "-----------------------------------"
|
||
|
echo "Enter the index of your choice (or 'q' to quit):"
|
||
|
read opt
|
||
|
|
||
|
if [ "$opt" = "q" ]; then
|
||
|
exit
|
||
|
elif [ "$opt" -eq 0 ]; then
|
||
|
cd ..
|
||
|
elif [ "$opt" -eq "$opt" ] 2>/dev/null && [ "$opt" -ge 1 ] && [ "$opt" -le "$(wc -l < $TMPFILE)" ]; then
|
||
|
selected_file=$(sed -n "${opt}p" $TMPFILE)
|
||
|
if [ -d "$selected_file" ]; then
|
||
|
cd "$selected_file"
|
||
|
i=$((i+1))
|
||
|
else
|
||
|
IMAGE=$(realpath "$selected_file")
|
||
|
i=$((i+31))
|
||
|
fi
|
||
|
else
|
||
|
echo "Invalid input. Please enter a valid index."
|
||
|
sleep 1
|
||
|
fi
|
||
|
|
||
|
done
|
||
|
|
||
|
rm -f "$TMPFILE"
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The image is currently being burned."
|
||
|
printf "\n"
|
||
|
|
||
|
growisofs -speed=4 -Z /dev/cd0="$IMAGE"
|
||
|
|
||
|
clear
|
||
|
echo "-----------------------------------"
|
||
|
echo "The burning is complete"
|
||
|
echo "-----------------------------------"
|
||
|
echo "Press any key to return to the previous menu"
|
||
|
read ENTER
|
||
|
|
||
|
MainMenu
|
||
|
}
|
||
|
|
||
|
Split-Rejoin-file () {
|
||
|
|
||
|
if [ ! -x /usr/local/bin/renamex ]; then
|
||
|
|
||
|
pkg ins -y rename
|
||
|
|
||
|
fi
|
||
|
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "This module allows you to search, recursively, in the folder of your choice, for files whose size exceeds the value of your choice, and to split them into blocks of the size you choose."
|
||
|
echo "It also allows you to restore (rejoin) the files previously split"
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "During the splitting process, the module will create, at the location of each file to be split, a folder bearing the name of the file to be split (with -split at the end of the name) that will contain the split files"
|
||
|
echo "Unless you want to perform the rejoining yourself (without using this module), DO NOT MODIFY what has been generated by the splitting.. Neither the names of the split-folders nor the names of the files contained within these split-folders"
|
||
|
echo "During the rejoining, the module will restore the original hierarchical structure (as before splitting), identically"
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "Would you like to continue? [y/n]"
|
||
|
read abrc
|
||
|
|
||
|
case $abrc in
|
||
|
y|N)
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "Would you like to split or rejoin? [s/r]"
|
||
|
read deccol
|
||
|
|
||
|
case $deccol in
|
||
|
s|S)
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "Please specify the absolute path of the folder to process"
|
||
|
echo "(Do not end the path with a /)"
|
||
|
read abhtp
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "What is the maximum file size to target?"
|
||
|
echo " Examples:"
|
||
|
echo " - (for 300 kilobytes, specify 300K)"
|
||
|
echo " - (for 500 megabytes, specify 500M)"
|
||
|
echo " - (for 2 gigabytes, specify 2G)"
|
||
|
read ciblesize
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "What should be the size of the split files?"
|
||
|
echo " Examples:"
|
||
|
echo " - (for 300 kilobytes, specify 300K)"
|
||
|
echo " - (for 500 megabytes, specify 500M)"
|
||
|
echo " - (for 2 gigabytes, specify 2G)"
|
||
|
read splitsize
|
||
|
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "The operation is in progress, please wait"
|
||
|
sleep 2
|
||
|
|
||
|
# Remove all spaces from file names
|
||
|
cd "$abhtp"
|
||
|
renamex -A -R -s/' '/PqxX8XxqP/g "$abhtp"/
|
||
|
|
||
|
for chacun in `find $abhtp -type f -size +$ciblesize`
|
||
|
do
|
||
|
filepath="$chacun"
|
||
|
filename="$(basename "$filepath")"
|
||
|
path="${filepath%/*}"
|
||
|
cd "$path"
|
||
|
mkdir "$filename-split"
|
||
|
mv "$filename" "$filename"-split/
|
||
|
cd "$filename"-split
|
||
|
split -b $splitsize "$filename"
|
||
|
rm -f "$filename"
|
||
|
touch "these-files-have-been-split-abZd.txt"
|
||
|
echo "UNLESS YOU REJOIN MANUALLY, DO NOT TOUCH THIS FILE!" > "these-files-have-been-split-abZd.txt"
|
||
|
echo "use the global-freebsd.sh script to remerge these files" >> "these-files-have-been-split-abZd.txt"
|
||
|
echo "otherwise, use cat x* > folder-name-without-the-split-dash and place the obtained file in the upper folder" >> "these-files-have-been-split-abZd.txt"
|
||
|
done
|
||
|
|
||
|
# Restore all spaces in file names
|
||
|
renamex -A -R -s/PqxX8XxqP/' '/g "$abhtp"/
|
||
|
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "The operation is over"
|
||
|
sleep 2
|
||
|
clear
|
||
|
;;
|
||
|
r|R)
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "This module allows you to rejoin files that have already been split by this module"
|
||
|
echo "Do not use this part unless you have previously used the split function!!"
|
||
|
echo "Would you like to continue? [y/n]"
|
||
|
read arbt
|
||
|
case $arbt in
|
||
|
y|Y)
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "Please specify the absolute path of the folder to process"
|
||
|
echo "(Do not end the path with a /)"
|
||
|
read abhtp
|
||
|
|
||
|
# Remove all spaces from file names
|
||
|
cd "$abhtp"
|
||
|
renamex -A -R -s/' '/PqxX8XxqP/g "$abhtp"/
|
||
|
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "The operation is in progress, please wait"
|
||
|
sleep 2
|
||
|
for chacun in `find $abhtp -type f -name "these-files-have-been-split-abZd.txt"`
|
||
|
do
|
||
|
filepath="$chacun"
|
||
|
filename=$(basename "$filepath")
|
||
|
path=${filepath%/*}
|
||
|
foldernamesplit=$(basename "$path")
|
||
|
cd "$path"
|
||
|
cat x* > "$foldernamesplit"
|
||
|
rm -f x* these-files-have-been-split-abZd.txt
|
||
|
renamex -s/'-split'//g "$foldernamesplit"
|
||
|
mv ./* ../
|
||
|
cd ..
|
||
|
rm -rf "$foldernamesplit"
|
||
|
done
|
||
|
|
||
|
# Restore all spaces in file names
|
||
|
renamex -A -R -s/PqxX8XxqP/' '/g "$abhtp"/
|
||
|
|
||
|
clear
|
||
|
echo "----------------------------------------------------------------------"
|
||
|
echo "The operation is over"
|
||
|
sleep 2
|
||
|
clear
|
||
|
;;
|
||
|
n|N)
|
||
|
break
|
||
|
;;
|
||
|
esac
|
||
|
break
|
||
|
;;
|
||
|
esac
|
||
|
;;
|
||
|
n|N)
|
||
|
break
|
||
|
;;
|
||
|
esac
|
||
|
break
|
||
|
|
||
|
MainMenu
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
######################################################################
|
||
|
|
||
|
# 3) Update_menu
|
||
|
Update_menu() {
|
||
|
choix=$(bsddialog --clear \
|
||
|
--backtitle "Global-FreeBSD" \
|
||
|
--title "Update Menu" \
|
||
|
--menu "Select:" \
|
||
|
10 70 10 \
|
||
|
1 "Update the full system : freebsd-update" \
|
||
|
2 "Update your services : pkg upgrade" \
|
||
|
3 "Change the time zone : tzsetup" \
|
||
|
3>&1 1>&2 2>&3)
|
||
|
|
||
|
case $choix in
|
||
|
1) Update-full-system ;;
|
||
|
2) pkg upgrade -y ;;
|
||
|
3) tzsetup ;;
|
||
|
esac
|
||
|
|
||
|
MainMenu
|
||
|
}
|
||
|
|
||
|
######################################################################
|
||
|
|
||
|
# 6.1) Web-Browsers_menu
|
||
|
|
||
|
Web-Browsers_menu() {
|
||
|
|
||
|
# check if applications are already installed or not
|
||
|
if [ -x /usr/local/bin/firefox ]; then
|
||
|
s_firefox="on"
|
||
|
else
|
||
|
s_firefox="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/ungoogled-chromium ]; then
|
||
|
s_ungoogledchromium="on"
|
||
|
else
|
||
|
s_ungoogledchromium="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /compat/ubuntu/bin/chrome ]; then
|
||
|
s_ubuntuchrome="on"
|
||
|
else
|
||
|
s_ubuntuchrome="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/qutebrowser ]; then
|
||
|
s_qutebrowser="on"
|
||
|
else
|
||
|
s_qutebrowser="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/iridium ]; then
|
||
|
s_iridium="on"
|
||
|
else
|
||
|
s_iridium="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/tor-browser ]; then
|
||
|
s_torbrowser="on"
|
||
|
else
|
||
|
s_torbrowser="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/otter-browser ]; then
|
||
|
s_otterbrowser="on"
|
||
|
else
|
||
|
s_otterbrowser="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/surf ]; then
|
||
|
s_surfbrowser="on"
|
||
|
else
|
||
|
s_surfbrowser="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/midori ]; then
|
||
|
s_midori="on"
|
||
|
else
|
||
|
s_midori="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/links ]; then
|
||
|
s_links="on"
|
||
|
else
|
||
|
s_links="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/elinks ]; then
|
||
|
s_elinks="on"
|
||
|
else
|
||
|
s_elinks="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/lynx ]; then
|
||
|
s_lynx="on"
|
||
|
else
|
||
|
s_lynx="off"
|
||
|
fi
|
||
|
|
||
|
# Install usual programs
|
||
|
TMPFILE=$(mktemp)
|
||
|
|
||
|
allchoices="firefox ungoogled-chromium chrome-linux qutebrowser iridium-browser tor-browser otter-browser surf-browser midori links elinks lynx"
|
||
|
|
||
|
bsddialog --backtitle "Select programs" \
|
||
|
--title "Installing applications" \
|
||
|
--checklist "Select programs:" 30 70 20 \
|
||
|
"firefox " "Firefox web browser" $s_firefox \
|
||
|
"ungoogled-chromium " "Chromium web browser without Google" $s_ungoogledchromium \
|
||
|
"chrome-linux " "Linux compat chrome for Netflix" $s_ubuntuchrome \
|
||
|
"qutebrowser " "Qutebrowser vim-like web browser" $s_qutebrowser \
|
||
|
"iridium-browser " "Iridium browser" $s_iridium \
|
||
|
"tor-browser " "Tor Browser for FreeBSD" $s_torbrowser \
|
||
|
"otter-bowser " "Browser based on Qt 5" $s_otterbrowser \
|
||
|
"surf-browser " "Simple Web brower based on WebKit2/GTK" $s_surfbrowser \
|
||
|
"midori " "Midori web browser" $s_midori \
|
||
|
"links " "Lynx-like text WWW browser" $s_links \
|
||
|
"elinks " "Links text WWW browser" $s_elinks \
|
||
|
"lynx " "Non-graphical, text-based World-Wide Web Client" $s_lynx 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
|
||
|
;;
|
||
|
*)
|
||
|
pkg ins -y "$choice"
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
done
|
||
|
|
||
|
# Remove non selected programs
|
||
|
for choice in $allchoices; do
|
||
|
# Vérifie si le choix est dans la liste des choix sélectionnés
|
||
|
if ! echo "$choices" | grep -qw "$choice"; then
|
||
|
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 deinstall chrome
|
||
|
cd ..
|
||
|
rm -r linux-browser-installer
|
||
|
;;
|
||
|
*)
|
||
|
pkg remove -y "$choice"
|
||
|
;;
|
||
|
esac
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
|
||
|
rm -f "$TMPFILE"
|
||
|
|
||
|
MainMenu
|
||
|
|
||
|
}
|
||
|
|
||
|
######################################################################
|
||
|
|
||
|
# 6.2) Mail-Clients_menu
|
||
|
|
||
|
Mail-Clients_menu() {
|
||
|
|
||
|
# check if applications are already installed or not
|
||
|
if [ -x /usr/local/bin/thunderbird ]; then
|
||
|
s_thunderbird="on"
|
||
|
else
|
||
|
s_thunderbird="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/claws-mail ]; then
|
||
|
s_clawsmail="on"
|
||
|
else
|
||
|
s_clawsmail="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/kmail ]; then
|
||
|
s_kmail="on"
|
||
|
else
|
||
|
s_kmail="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/mutt ]; then
|
||
|
s_mutt="on"
|
||
|
else
|
||
|
s_mutt="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/neomutt ]; then
|
||
|
s_neomutt="on"
|
||
|
else
|
||
|
s_neomutt="off"
|
||
|
fi
|
||
|
|
||
|
# Install usual programs
|
||
|
TMPFILE=$(mktemp)
|
||
|
|
||
|
allchoices="thunderbird claws-mail kmail mutt neomutt"
|
||
|
|
||
|
bsddialog --backtitle "Select programs" \
|
||
|
--title "Installing applications" \
|
||
|
--checklist "Select programs:" 12 70 20 \
|
||
|
"thunderbird " "Mozilla Thunderbird is standalone mail and news that stands above" $s_thunderbird \
|
||
|
"claws-mail " "Lightweight and featureful GTK based e-mail and news client" $s_clawsmail \
|
||
|
"kmail " "KDE mail client" $s_kmail \
|
||
|
"mutt " "Small but powerful text based program for read/writing e-mail" $s_mutt \
|
||
|
"neomutt " "Bringing together all the Mutt Code" $s_neomutt 2>$TMPFILE
|
||
|
|
||
|
choices=$(sed 's/"//g' < $TMPFILE | tr ' ' '\n')
|
||
|
|
||
|
# Install the selected programs.
|
||
|
for choice in $choices; do
|
||
|
|
||
|
pkg ins -y "$choice"
|
||
|
|
||
|
done
|
||
|
|
||
|
# Remove non selected programs
|
||
|
for choice in $allchoices; do
|
||
|
# Vérifie si le choix est dans la liste des choix sélectionnés
|
||
|
if ! echo "$choices" | grep -qw "$choice"; then
|
||
|
|
||
|
pkg remove -y "$choice"
|
||
|
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
|
||
|
rm -f "$TMPFILE"
|
||
|
|
||
|
MainMenu
|
||
|
|
||
|
}
|
||
|
|
||
|
######################################################################
|
||
|
|
||
|
# 6.3) Easy Package Manager
|
||
|
|
||
|
Office-suite_menu() {
|
||
|
|
||
|
# check if applications are already installed or not
|
||
|
if [ -x /usr/local/bin/libreoffice ]; then
|
||
|
s_libreoffice="on"
|
||
|
else
|
||
|
s_libreoffice="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/abiword ]; then
|
||
|
s_abiword="on"
|
||
|
else
|
||
|
s_abiword="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/openoffice-4.1 ]; then
|
||
|
s_openoffice="on"
|
||
|
else
|
||
|
s_openoffice="off"
|
||
|
fi
|
||
|
|
||
|
if [ -x /usr/local/bin/r7-office ]; then
|
||
|
s_r7office="on"
|
||
|
else
|
||
|
s_r7office="off"
|
||
|
fi
|
||
|
|
||
|
# Install usual programs
|
||
|
TMPFILE=$(mktemp)
|
||
|
|
||
|
allchoices="libreoffice abiword apache-openoffice r7-office"
|
||
|
|
||
|
bsddialog --backtitle "Select programs" \
|
||
|
--title "Installing applications" \
|
||
|
--checklist "Select programs:" 11 70 20 \
|
||
|
"libreoffice " "Full integrated office productivity suite" $s_libreoffice \
|
||
|
"abiword " "Open-source, cross-platform WYSIWYG word processor" $s_abiword \
|
||
|
"apache-openoffice " "Integrated wordprocessor/dbase/spreadsheet/drawing/chart/browser" $s_openoffice \
|
||
|
"r7-office " "Russian office suite" $s_r7office 2>$TMPFILE
|
||
|
|
||
|
choices=$(sed 's/"//g' < $TMPFILE | tr ' ' '\n')
|
||
|
|
||
|
# Install the selected programs.
|
||
|
for choice in $choices; do
|
||
|
|
||
|
pkg ins -y "$choice"
|
||
|
|
||
|
done
|
||
|
|
||
|
# Remove non selected programs
|
||
|
for choice in $allchoices; do
|
||
|
# Vérifie si le choix est dans la liste des choix sélectionnés
|
||
|
if ! echo "$choices" | grep -qw "$choice"; then
|
||
|
|
||
|
pkg remove -y "$choice"
|
||
|
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
|
||
|
rm -f "$TMPFILE"
|
||
|
|
||
|
MainMenu
|
||
|
|
||
|
}
|
||
|
|
||
|
######################################################################
|
||
|
|
||
|
# 6) Easy Package Manager
|
||
|
Package-Manager_menu() {
|
||
|
|
||
|
choix=$(bsddialog --clear \
|
||
|
--backtitle "Global-FreeBSD" \
|
||
|
--title "Easy Package-Manager Menu" \
|
||
|
--menu "Select:" \
|
||
|
17 70 10 \
|
||
|
1 "Web Browsers" \
|
||
|
2 "Mail Clients" \
|
||
|
3 "Office" \
|
||
|
4 "Multimedia" \
|
||
|
5 "Network Tools" \
|
||
|
6 "Web Servers" \
|
||
|
7 "Mail Servers" \
|
||
|
8 "XMPP" \
|
||
|
9 "DNS" \
|
||
|
10 "SQL" \
|
||
|
11 "Hypervisor" \
|
||
|
12 "Webmin" \
|
||
|
13 "FTP" \
|
||
|
3>&1 1>&2 2>&3)
|
||
|
|
||
|
case $choix in
|
||
|
1) Web-Browsers_menu ;;
|
||
|
2) Mail-Clients_menu ;;
|
||
|
3) Office-suite_menu ;;
|
||
|
3) Multimedia_menu ;;
|
||
|
4) Network-Tools_menu ;;
|
||
|
5) XMPP_menu ;;
|
||
|
6) Web-Servers_menu ;;
|
||
|
7) Mail-Servers_menu ;;
|
||
|
8) XMPP_menu ;;
|
||
|
9) DNS_menu ;;
|
||
|
10) SQL_menu ;;
|
||
|
11) Hypervisor_menu ;;
|
||
|
12) Webmin_menu ;;
|
||
|
13) FTP_menu ;;
|
||
|
esac
|
||
|
|
||
|
MainMenu
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
######################################################################
|
||
|
|
||
|
# 8) Disk management
|
||
|
|
||
|
Disk-Management_menu() {
|
||
|
|
||
|
choix=$(bsddialog --clear \
|
||
|
--backtitle "Global-FreeBSD" \
|
||
|
--title "Disk Management Menu" \
|
||
|
--menu "Select:" \
|
||
|
14 70 10 \
|
||
|
1 "Format a USB device to UFS (one partition)" \
|
||
|
2 "Format a USB device to FAT32 (one partition)" \
|
||
|
3 "Format a USB device to NTFS (one partition)" \
|
||
|
4 "Securely erase a USB device (dd)" \
|
||
|
5 "Burn an IMAGE.iso on a USB device" \
|
||
|
6 "Burn an IMAGE.iso on a DVD/BD" \
|
||
|
7 "Splitting/Rejoining files based on custom size" \
|
||
|
3>&1 1>&2 2>&3)
|
||
|
|
||
|
case $choix in
|
||
|
1) Format-USB-UFS ;;
|
||
|
2) Format-USB-FAT32 ;;
|
||
|
3) Format-USB-NTFS ;;
|
||
|
4) Secure-erase-USB ;;
|
||
|
5) Burn-iso-USB ;;
|
||
|
6) Burn-iso-DVD-BD ;;
|
||
|
7) Split-Rejoin-file ;;
|
||
|
esac
|
||
|
|
||
|
MainMenu
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
######################################################################
|
||
|
|
||
|
# MainMenu
|
||
|
|
||
|
MainMenu () {
|
||
|
choix=$(bsddialog --clear \
|
||
|
--backtitle "Global-FreeBSD" \
|
||
|
--title "Main Menu" \
|
||
|
--menu "Select your Menu:" \
|
||
|
16 70 10 \
|
||
|
1 "Network" \
|
||
|
2 "Hostname and FQDN" \
|
||
|
3 "Update your system" \
|
||
|
4 "Security" \
|
||
|
5 "Users, Groups and permissions" \
|
||
|
6 "Easy Package-Manager" \
|
||
|
7 "Web Server" \
|
||
|
8 "Disk Management" \
|
||
|
9 "Desktop Environment" \
|
||
|
3>&1 1>&2 2>&3)
|
||
|
|
||
|
case $choix in
|
||
|
1) Network_menu ;;
|
||
|
2) Hostname-FQDN_menu ;;
|
||
|
3) Update_menu ;;
|
||
|
4) Security_menu ;;
|
||
|
5) Users-Groups-perms_menu ;;
|
||
|
6) Package-Manager_menu ;;
|
||
|
7) Web-Server_menu ;;
|
||
|
8) Disk-Management_menu ;;
|
||
|
9) Desktop-Environment_menu ;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
MainMenu
|