-
Notifications
You must be signed in to change notification settings - Fork 6
/
postinstall-debian-gui
148 lines (127 loc) · 4.35 KB
/
postinstall-debian-gui
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
function main() {
if [[ -f /usr/bin/konsole ]]; then
if [[ -f /usr/bin/kdialog ]]; then
password=$( kdialog --password "Entrez votre mot de passe SUDO" )
else
konsole -- -e "sudo apt install -y kdialog"
main
fi
elif [[ -f /usr/bin/gnome-terminal ]]; then
if [[ -f /usr/bin/zenity ]]; then
password=$( zenity --password --text="Entrez votre mot de passe SUDO" )
else
gnome-terminal -x "sudo apt install -y zenity"
main
fi
else
echo "Configuration du script non possible. Installez manuellement zenity (sudo apt install zenity)"
exit 1
fi
chkroot=$(echo $password | sudo -S whoami)
if [[ "$password" = "" ]]; then
main
exit
elif [[ "$chkroot" != "root" ]]; then
if [[ $DESKTOP_SESSION == "plasma" ]]; then
kdialog --error "Mauvais mot de passe"
exit 1
elif [[ $DESKTOP_SESSION == "plasmawayland" ]]; then
kdialog --error "Mauvais mot de passe"
exit 1
elif [[ $DESKTOP_SESSION == "gnome" ]]; then
zenity --error --text="Mauvais mot de passe"
exit 1
elif [[ -f /usr/bin/zenity ]]; then
zenity --error --text="Mauvais mot de passe"
exit 1
fi
exit
fi
chmod +x data/*.sh
chmod +x extra/*.sh
chmod +x SECUREBOOT/*.sh
logo="./source/logo.png"
install_zenity="echo $password | sudo -S apt install -y zenity"
if [[ -f /usr/bin/zenity ]]; then
if [[ -f /usr/bin/yad ]]; then
echo "rien à faire"
else
(echo $password | sudo -S apt -y install yad bash-completion curl dbus-x11) | zenity --progress --pulsate --title="Préparation de YAD" --text="Installation de YAD" --auto-close
fi
else
if [[ -f /usr/bin/konsole ]] ; then
konsole -- -e $install_zenity
elif [[ -f /usr/bin/gnome-terminal ]] ; then
gnome-terminal -x $install_zenity
fi
if [[ -f /usr/bin/yad ]]; then
echo "rien à faire"
else
(echo $password | sudo -S apt -y install yad bash-completion curl dbus-x11) | zenity --progress --pulsate --title="Préparation de YAD" --text="Installation de YAD" --auto-close
fi
fi
(echo $password | sudo -S apt-add-repository -y contrib && \
echo $password | sudo -S apt-add-repository -y non-free && \
echo $password | sudo -S dpkg --add-architecture i386) | yad --center --window-icon="$logo" --progress --pulsate --title "Préparation de système" --progress-text="Vérification des dépôts additionnels" --width 500 --height 100 --no-buttons --auto-close
if [[ $DESKTOP_SESSION == "gnome" ]]; then
if [[ -f /usr/bin/flatpak ]]; then
echo "Rien à faire."
else
(echo $password | sudo -S apt -y install gnome-software-plugin-flatpak flatpak && \
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo) | yad --center --window-icon="$logo" --progress --pulsate --title "Préparation du système Gnome" --progress-text="Configuration de Flatpak pour Gnome" --width 500 --height 100 --no-buttons --auto-close
fi
fi
if [[ -f /usr/bin/konsole ]] ; then
(echo $password | sudo -S apt -y install pipewire-audio) | yad --center --window-icon="$logo" --progress --pulsate --title "Préparation du système..." --progress-text="Installation de pipewire" --width 500 --height 100 --no-buttons --auto-close
fi
if [[ -f /etc/sysctl.d/80-gamecompatibility.conf ]]; then
echo "vm.max_map_count déjà configuré"
else
echo $password | sudo -S echo "vm.max_map_count = 2147483642" | sudo tee /etc/sysctl.d/80-gamecompatibility.conf && \
echo $password | sudo -S sysctl --system
fi
cp ./source/logo.png /tmp/
echo $password | sudo -S bash -e ./source/menu-gui.sh
}
function error() {
case $1 in
kdialog)
kdialog --error "Version de Debian non-supportée. Veuillez utiliser la TUI."
;;
zenity)
zenity --error --text="Version de Debian non-supportée. Veuillez utiliser la TUI."
;;
konsole)
konsole -- -e "bash -c $srcdir/source/error.sh"
;;
gnome-terminal)
gnome-terminal -x "bash -c $srcdir/source/error.sh"
;;
*)
echo "Version de Debian non-supportée. Veuillez utiliser la TUI"
;;
esac
exit 1
}
srcdir=$(pwd)
chmod +x $srcdir/source/*.sh
debian_version="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d '=' -f 2)"
if [[ -f /usr/bin/kdialog ]]; then
compat="kdialog"
elif [[ -f /usr/bin/zenity ]]; then
compat="zenity"
elif [[ -f /usr/bin/konsole ]]; then
compat="konsole"
elif [[ -f /usr/bin/gnome-terminal ]]; then
compat="gnome-terminal"
fi
echo "compat : $compat"
case $debian_version in
bookworm|stable|faye)
main
;;
*)
error $compat
;;
esac