From fbe0267512c55995aa9b1bb27c5715a0f1ee0405 Mon Sep 17 00:00:00 2001
From: Calin8u <alexis.calin9@etu.univ-lorraine.fr>
Date: Sun, 29 Jan 2023 14:16:17 +0100
Subject: [PATCH] big update

---
 README.md                    | 19 +++++++++++++
 fix-screen-tearing.sh        |  2 ++
 xinitrc.sh => install-dwm.sh |  9 ++++++
 setup-tui.sh                 | 54 ++++++++++++++++++++++++++++++++++++
 setup.sh                     | 51 ++++++++++++++++++++++++++++++++++
 5 files changed, 135 insertions(+)
 create mode 100644 README.md
 rename xinitrc.sh => install-dwm.sh (70%)
 create mode 100644 setup-tui.sh
 create mode 100644 setup.sh

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..584e785
--- /dev/null
+++ b/README.md
@@ -0,0 +1,19 @@
+Auto Gnu/Linux setup
+====================
+
+This repository contains dots file for dwm with french keyboard shortcuts and a script to setup the system how I like.
+
+Programs
+Here are the main programs:
+
+- dwm – the main graphical environment
+- st – the terminal
+- chromium - the Browser
+- newsboat - the RSS reader
+- thunderbird - the mail client
+- texlive - latex distribution
+- vscode - the text editor
+- libreoffice
+- pandoc
+
+It also can setup network manager and get rid of screen tearing.
\ No newline at end of file
diff --git a/fix-screen-tearing.sh b/fix-screen-tearing.sh
index 5db88b6..4193944 100644
--- a/fix-screen-tearing.sh
+++ b/fix-screen-tearing.sh
@@ -1,5 +1,7 @@
 #https://techstop.github.io/fix-screen-tearing-xfce/
 
+echo 'Fixing screen tearing for intel'
+
 sudo mkdir /usr/share/X11/xorg.conf.d/
 sudo echo 'Section "Device"
   Identifier  "Intel Graphics"
diff --git a/xinitrc.sh b/install-dwm.sh
similarity index 70%
rename from xinitrc.sh
rename to install-dwm.sh
index 2039a2b..b62c39b 100644
--- a/xinitrc.sh
+++ b/install-dwm.sh
@@ -1,3 +1,5 @@
+echo 'Create xinitrc for dwm' 
+
 echo '#keyboard config
 setxkbmap fr
 
@@ -14,4 +16,11 @@ done &
 xsetroot -bg black
 #feh --bg-fill ~/Images/Wallpaper/Favoris/ISS-view-4.jpg
 
+# lock screen when suspended
+xss-lock -- slock &
+
 exec /usr/local/bin/dwm' > ~/.xinitrc
+
+echo 'Compiling dwm'
+
+cd dwm && sudo make clean install && cd ..
diff --git a/setup-tui.sh b/setup-tui.sh
new file mode 100644
index 0000000..0d2c584
--- /dev/null
+++ b/setup-tui.sh
@@ -0,0 +1,54 @@
+# #!/bin/bash
+
+# PS3='Quelle distribution Linux utilisez-vous? '
+# options=("Debian" "Arch" "Quitter")
+# select opt in "${options[@]}"
+# do
+#     case $opt in
+#         "Debian")
+#             echo "Exécution du script Debian"
+#             ./script-deb.sh
+#             break
+#             ;;
+#         "Arch")
+#             echo "Exécution du script Arch"
+#             ./script-arch.sh
+#             break
+#             ;;
+#         "Quitter")
+#             break
+#             ;;
+#         *) echo "Option non valide";;
+#     esac
+# done
+
+#!/bin/bash
+
+# Initialisation de ncurses
+initscr
+
+# Désactivation de l'affichage des saisies
+noecho
+
+# Activation des touches de déplacement
+cbreak
+
+# Affichage du menu
+distro=$(whiptail --title "Distribution Linux" --menu "Quelle distribution Linux utilisez-vous?" 15 60 4 \
+"Debian" "Utilisez apt pour installer les programmes" \
+"Arch" "Utilisez pacman pour installer les programmes" \
+"Quitter" "Quitter" 3>&1 1>&2 2>&3)
+
+# Exécution du script en fonction de la réponse de l'utilisateur
+if [ "$distro" == "Debian" ]; then
+    echo "Exécution du script Debian"
+    ./script-deb.sh
+elif [ "$distro" == "Arch" ]; then
+    echo "Exécution du script Arch"
+    ./script-arch.sh
+else
+    echo "Quitter"
+fi
+
+# Fermeture de ncurses
+endwin
\ No newline at end of file
diff --git a/setup.sh b/setup.sh
new file mode 100644
index 0000000..cd11dff
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+# A implementer : setup de wireplumber and automate the things to install after minimal debian install
+# Tweak dwm to show cpu temp 
+
+echo "What GNU/Linux distribution are you using ? Enter 'Debian' or 'Arch'"
+read distro
+
+if [ "$distro" == "Debian" ]; then
+    echo 'Updating apt repositories'
+    sudo apt update
+
+    echo 'Install and setup DWM ? y or n'
+    read yn
+    if [ "$yn" == 'y' ]; then
+        # dwm depedencies
+        sudo apt install build-essential libx11-dev libxft-dev libxinerama-dev libfreetype6-dev libfontconfig1-dev
+        install-dwm
+        fix-screen-tearing
+    fi
+    
+
+    echo 'Install recommended programs ? y or n'
+    read yn
+    if [ "$yn" == 'y' ]; then
+        # programs
+        sudo apt install network-manager chromium newsboat thunderbird libreoffice pandoc texlive-full xss-lock slock xbacklight neofetch ranger htop
+        sudo systemctl enable --now NetworkManager && echo 'Enabled Network Manager'
+    fi
+
+    echo 'Install VScode ? (y or n)'
+    read yn
+    if [ "$yn" == 'y' ]; then
+        # vscode
+        curl https://go.microsoft.com/fwlink/?LinkID=760868 && sudo apt install ./code*.deb
+    fi
+
+    echo 'Install Mullvad vpn ? (y or n)'
+    read yn
+    if [ "$yn" == 'y' ]; then
+        # vscode
+        curl https://mullvad.net/download/app/deb/latest/ && sudo apt install ./Mullvad*.deb && sudo systemctl enable --now mullvad-daemon
+    fi
+
+elif [ "$distro" == "Arch" ]; then
+
+    sudo pacman -Sy
+    sudo pacman -S base-devel libx11 libxft libxinerama freetype2 fontconfig
+else
+    echo 'Non recognized distribution'
+    echo 'Quitting'
+fi
-- 
GitLab