pvincent
1 year ago
3 changed files with 282 additions and 623 deletions
-
291src/bookworm
-
330src/bullseye
-
284src/main
@ -1,291 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
## FUNCTIONS |
|||
## --------- |
|||
|
|||
function trap_error() { |
|||
error_code=$1 |
|||
error_line=$2 |
|||
|
|||
printf "\nEXIT #${error_code} due to error at line ${error_line} : \n-----------------------------------------\n" |
|||
sed "${error_line}q;d" $0 |
|||
echo |
|||
exit $error_code |
|||
} |
|||
|
|||
function runVoid() { |
|||
trap - ERR |
|||
local COMMAND="$@" |
|||
bash -c "${COMMAND}" >/dev/null 2>&1 |
|||
runVoidError=$? |
|||
trap 'trap_error $? $LINENO' ERR |
|||
} |
|||
|
|||
function askConfirmation() { |
|||
case "$1" in |
|||
y | Y | yes | YES) |
|||
QUESTION="(Y/n)?" |
|||
DEFAULT=0 |
|||
;; |
|||
*) |
|||
QUESTION="(y/N)?" |
|||
DEFAULT=1 |
|||
;; |
|||
esac |
|||
read -p "$QUESTION : " choice |
|||
case "$choice" in |
|||
y | Y | yes | YES) return 0 ;; #true |
|||
n | no | N | NO) return 1 ;; #false |
|||
*) return $DEFAULT ;; |
|||
esac |
|||
} |
|||
|
|||
# Variables and constants |
|||
## --------- |
|||
|
|||
BASEDIR=/opt/debian-gnome |
|||
ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! |
|||
REQUIRED_PACKAGES=( |
|||
bash-completion |
|||
vim git wget curl |
|||
htop jq unzip |
|||
python3-pip |
|||
gir1.2-gtop-2.0 gir1.2-nm-1.0 gir1.2-clutter-1.0 gnome-system-monitor |
|||
tilix wl-clipboard |
|||
nextcloud-desktop nautilus-nextcloud nautilus-share nautilus-image-converter |
|||
cups hplip |
|||
ttf-mscorefonts-installer |
|||
) |
|||
|
|||
## MAIN |
|||
## --------- |
|||
|
|||
[ $(id -u) -eq 0 ] && echo 'normal user required' && exit -1 |
|||
|
|||
echo "# configure apt sources to the mithril's" |
|||
echo "========================================" |
|||
if grep cdrom /etc/apt/sources.list; then |
|||
echo "deb http://debian.mithril.re/debian bookworm main contrib non-free-firmware" | sudo tee /etc/apt/sources.list |
|||
echo "deb http://debian.mithril.re/debian bookworm-updates main contrib non-free-firmware" | sudo tee -a /etc/apt/sources.list |
|||
echo "deb http://debian.mithril.re/debian-security bookworm-security main contrib non-free-firmware" | sudo tee -a /etc/apt/sources.list |
|||
sudo apt update |
|||
sudo apt autoremove -y |
|||
else |
|||
echo "# updating repositories" |
|||
echo "===================" |
|||
if [[ $(date --date='-12 hours' +%s) -gt $(date -d "$(stat -c %y /var/lib/apt/lists/partial)" +%s) ]]; then |
|||
sudo apt update |
|||
sudo apt autoremove -y |
|||
else |
|||
echo "repositories recently updated!" |
|||
fi |
|||
fi |
|||
|
|||
|
|||
|
|||
echo "# required packages" |
|||
echo "===================" |
|||
for package in ${REQUIRED_PACKAGES[@]}; do |
|||
runVoid dpkg-query --status $package |
|||
if [ $runVoidError -ne 0 ]; then |
|||
echo -n "installing package <$package> ... " |
|||
sudo DEBIAN_FRONTEND=noninteractive apt install -y $package |
|||
echo "DONE" |
|||
fi |
|||
done |
|||
|
|||
echo "## debian-bash" |
|||
echo "==============" |
|||
if [[ ! -d /opt/debian-bash ]]; then |
|||
curl https://git.artcode.re/pvincent/debian-bash/raw/branch/master/install.sh | sudo bash -s -- --host |
|||
else |
|||
echo "debian-bash already installed!" |
|||
fi |
|||
|
|||
echo "## openssh-server" |
|||
echo "=================" |
|||
PGKNAME='openssh-server' |
|||
runVoid dpkg-query --status $PGKNAME |
|||
if [ $runVoidError -ne 0 ]; then |
|||
set -e |
|||
sudo apt install -y $PGKNAME |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?PermitRootLogin.*$" "PermitRootLogin no" /etc/ssh/sshd_config |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?PasswordAuthentication.*$" "PasswordAuthentication no" /etc/ssh/sshd_config |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?AllowUsers.*$" "AllowUsers $ALLOWED_USERS" /etc/ssh/sshd_config |
|||
sudo systemctl restart sshd |
|||
set +e |
|||
else |
|||
echo "${PGKNAME} already installed!" |
|||
fi |
|||
|
|||
|
|||
firefox_lang=$(echo $LANG | cut -d_ -f1) |
|||
[[ $firefox_lang == "en" ]] && firefox_lang="en-US" |
|||
echo $firefox_lang |
|||
|
|||
|
|||
echo "## firefox latest" |
|||
echo "=================" |
|||
if [[ ! /usr/local/bin/firefox -ef /opt/firefox/firefox ]]; then |
|||
set -e |
|||
cd /tmp |
|||
wget $(curl "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=$firefox_lang" | cut -d '"' -f2) -O firefox-latest.tar.bz2 |
|||
sudo mkdir /opt/firefox -p |
|||
sudo chown $USER /opt/firefox |
|||
tar -xjf firefox-latest.tar.bz2 -C /opt |
|||
cat <<EOF | sudo tee -a /usr/share/applications/firefox-stable.desktop |
|||
[Desktop Entry] |
|||
Name=Firefox Stable |
|||
Comment=Web Browser |
|||
Exec=/opt/firefox/firefox %u |
|||
Terminal=false |
|||
Type=Application |
|||
Icon=/opt/firefox/browser/chrome/icons/default/default128.png |
|||
Categories=Network;WebBrowser; |
|||
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https; |
|||
StartupNotify=true |
|||
StartupWMClass=Navigator |
|||
Actions=new-window;new-private-window;profile-manager; |
|||
|
|||
[Desktop Action new-window] |
|||
Name=New Window |
|||
Exec=/opt/firefox/firefox --new-window %u |
|||
|
|||
[Desktop Action new-private-window] |
|||
Name=New Private Window |
|||
Exec=/opt/firefox/firefox --private-window %u |
|||
|
|||
[Desktop Action profile-manager] |
|||
Name=Profile Manager |
|||
Exec=/opt/firefox/firefox -P %u |
|||
EOF |
|||
sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox |
|||
sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200 && sudo update-alternatives --set x-www-browser /opt/firefox/firefox |
|||
sudo apt remove -y firefox-esr |
|||
sudo apt install -y libdbus-glib-1-2 |
|||
set +e |
|||
else |
|||
echo "firefox latest already installed!" |
|||
fi |
|||
|
|||
echo "## firefox by default" |
|||
echo "=====================" |
|||
xdg-settings set default-web-browser firefox-stable.desktop |
|||
|
|||
|
|||
echo "## gnome default settings" |
|||
echo "=============" |
|||
gsettings set org.gnome.nautilus.preferences click-policy 'single' |
|||
gsettings set org.gnome.mutter dynamic-workspaces false |
|||
gsettings set org.gnome.desktop.wm.preferences num-workspaces 1 |
|||
gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true |
|||
|
|||
|
|||
echo "## favorite apps" |
|||
echo "================" |
|||
favorite_apps=$(gsettings get org.gnome.shell favorite-apps) |
|||
if [[ "$favorite_apps" == "['firefox-esr.desktop', 'org.gnome.Evolution.desktop', 'rhythmbox.desktop', 'libreoffice-writer.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop', 'yelp.desktop']" ]]; then |
|||
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop','firefox-stable.desktop','org.gnome.Software.desktop']" |
|||
fi |
|||
|
|||
|
|||
echo "## gnome-extensions-cli" |
|||
echo "=======================" |
|||
if [[ ! -f ~/.local/bin/gext ]]; then |
|||
pip install gnome-extensions-cli --break-system-packages |
|||
else |
|||
echo "gnome-extensions-cli already installed!" |
|||
fi |
|||
|
|||
echo "## gnome-shell install several extensions" |
|||
echo "=========================================" |
|||
EXTENSIONS=( |
|||
"appindicatorsupport@rgcjonas.gmail.com" |
|||
"system-monitor-next@paradoxxx.zero.gmail.com" |
|||
"dash-to-dock@micxgx.gmail.com" |
|||
"gsconnect@andyholmes.github.io" |
|||
"network-stats@gnome.noroadsleft.xyz" |
|||
) |
|||
|
|||
for extension in "${EXTENSIONS[@]}"; do |
|||
if [[ ! -d $HOME/.local/share/gnome-shell/extensions/$extension ]]; then |
|||
~/.local/bin/gext install "$extension" |
|||
sudo cp $HOME/.local/share/gnome-shell/extensions/$extension/schemas/*.gschema.xml /usr/share/glib-2.0/schemas/ |
|||
else |
|||
echo "extension <${extension}> already installed!" |
|||
fi |
|||
done |
|||
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/ |
|||
|
|||
echo "# gnome extra settings" |
|||
echo "======================" |
|||
gsettings set org.gnome.shell.extensions.system-monitor show-tooltip true |
|||
gsettings set org.gnome.shell.extensions.system-monitor cpu-show-text false |
|||
gsettings set org.gnome.shell.extensions.system-monitor cpu-graph-width 60 |
|||
gsettings set org.gnome.shell.extensions.system-monitor memory-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor net-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor net-show-text false |
|||
gsettings set org.gnome.shell.extensions.system-monitor net-graph-width 40 |
|||
gsettings set org.gnome.shell.extensions.system-monitor disk-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor icon-display false |
|||
|
|||
#gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed true |
|||
gsettings set org.gnome.shell.extensions.dash-to-dock apply-custom-theme true |
|||
#gsettings set org.gnome.shell.extensions.dash-to-dock extend-height true |
|||
#gsettings set org.gnome.shell.extensions.dash-to-dock multi-monitor true |
|||
|
|||
echo "# firefox addons" |
|||
echo "================" |
|||
declare -A FIREFOX_ADDONS |
|||
FIREFOX_ADDONS['uBlock0@raymondhill.net']="3740966/ublock_origin-1.34.0-an+fx.xpi" |
|||
FIREFOX_ADDONS['fr-dicollecte@dictionaries.addons.mozilla.org']='3581786/dictionnaire_francais-7.0b.xpi' |
|||
FIREFOX_ADDONS['chrome-gnome-shell@gnome.org']='898030/gnome_shell_integration-10.1-an+fx-linux.xpi' |
|||
FIREFOX_ADDONS['jid1-ZAdIEUB7XOzOJw@jetpack']='3741831/duckduckgo_privacy_essentials-2021.3.8-an+fx.xpi' |
|||
|
|||
mkdir -p /opt/firefox/distribution/extensions |
|||
for addon_id in "${!FIREFOX_ADDONS[@]}"; do |
|||
addon_part_url="${FIREFOX_ADDONS[$addon_id]}" |
|||
addon_xpi="/opt/firefox/distribution/extensions/${addon_id}.xpi" |
|||
if [[ ! -f "$addon_xpi" ]]; then |
|||
echo -n "Firefox addon <$addon_id> installing ..." |
|||
wget -q "https://addons.mozilla.org/firefox/downloads/file/${addon_part_url}" -O $addon_xpi |
|||
echo DONE |
|||
else |
|||
echo "Firefox addon <$addon_id> already installed!" |
|||
fi |
|||
done |
|||
|
|||
echo "# Firefox default settings" |
|||
echo "#=========================" |
|||
|
|||
if [[ ! -f /opt/firefox/firefox.cfg ]]; then |
|||
cat <<EOF | sudo tee -a /opt/firefox/firefox.cfg |
|||
// IMPORTANT: Start your code on the 2nd line |
|||
|
|||
lockPref("browser.pocket.enabled", false); |
|||
lockPref("extensions.pocket.enabled", false); |
|||
lockPref("browser.shell.checkDefaultBrowser", false); |
|||
EOF |
|||
cat <<EOF | sudo tee -a /opt/firefox/defaults/pref/autoconfig.js |
|||
pref("general.config.filename", "firefox.cfg"); |
|||
pref("general.config.obscure_value", 0); |
|||
EOF |
|||
|
|||
else |
|||
echo "Firefox default settings already defined!" |
|||
fi |
|||
|
|||
echo "# favourite apps" |
|||
echo "#===============" |
|||
runVoid "gsettings get org.gnome.shell favorite-apps | grep firefox-esr" |
|||
if [[ "$runVoidError" == 0 ]]; then |
|||
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop','firefox-stable.desktop','org.gnome.Software.desktop']" |
|||
else |
|||
echo "preserve existing apps!" |
|||
fi |
|||
|
|||
echo |
|||
echo |
|||
echo "# DEBIAN-GNOME successfully installed!" |
|||
echo |
|||
|
@ -1,330 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
## FUNCTIONS |
|||
## --------- |
|||
|
|||
function trap_error() { |
|||
error_code=$1 |
|||
error_line=$2 |
|||
|
|||
printf "\nEXIT #${error_code} due to error at line ${error_line} : \n-----------------------------------------\n" |
|||
sed "${error_line}q;d" $0 |
|||
echo |
|||
exit $error_code |
|||
} |
|||
|
|||
function runVoid() { |
|||
trap - ERR |
|||
local COMMAND="$@" |
|||
bash -c "${COMMAND}" >/dev/null 2>&1 |
|||
runVoidError=$? |
|||
trap 'trap_error $? $LINENO' ERR |
|||
} |
|||
|
|||
function askConfirmation() { |
|||
case "$1" in |
|||
y | Y | yes | YES) |
|||
QUESTION="(Y/n)?" |
|||
DEFAULT=0 |
|||
;; |
|||
*) |
|||
QUESTION="(y/N)?" |
|||
DEFAULT=1 |
|||
;; |
|||
esac |
|||
read -p "$QUESTION : " choice |
|||
case "$choice" in |
|||
y | Y | yes | YES) return 0 ;; #true |
|||
n | no | N | NO) return 1 ;; #false |
|||
*) return $DEFAULT ;; |
|||
esac |
|||
} |
|||
|
|||
# Variables and constants |
|||
## --------- |
|||
|
|||
BASEDIR=/opt/debian-gnome |
|||
ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! |
|||
REQUIRED_PACKAGES=( |
|||
vim git wget |
|||
python3 python3-pip |
|||
gir1.2-gtop-2.0 |
|||
htop tilix jq unzip |
|||
tilix bash-completion |
|||
nextcloud-desktop nautilus-nextcloud nautilus-share nautilus-image-converter |
|||
wl-clipboard |
|||
cups hplip |
|||
ttf-mscorefonts-installer |
|||
) |
|||
|
|||
## MAIN |
|||
## --------- |
|||
|
|||
[ $(id -u) -eq 0 ] && echo 'normal user required' && exit -1 |
|||
|
|||
echo "# configure apt sources to the mithril's" |
|||
echo "========================================" |
|||
|
|||
if ! grep -q debian.mithril.re /etc/apt/sources.list; then |
|||
echo "deb http://debian.mithril.re/debian bullseye main contrib non-free" | sudo tee /etc/apt/sources.list |
|||
echo "deb http://debian.mithril.re/debian bullseye-updates main contrib non-free" | sudo tee -a /etc/apt/sources.list |
|||
echo "deb http://debian.mithril.re/debian-security/ bullseye-security main contrib non-free" | sudo tee -a /etc/apt/sources.list |
|||
sudo apt update |
|||
sudo apt autoremove -y |
|||
else |
|||
echo "# updating repositories" |
|||
echo "===================" |
|||
if [[ $(date --date='-12 hours' +%s) -gt $(date -d "$(stat -c %y /var/lib/apt/lists/partial)" +%s) ]]; then |
|||
sudo apt update |
|||
sudo apt autoremove -y |
|||
else |
|||
echo "repositories recently updated!" |
|||
fi |
|||
fi |
|||
|
|||
echo "# required packages" |
|||
echo "===================" |
|||
for package in ${REQUIRED_PACKAGES[@]}; do |
|||
runVoid dpkg-query --status $package |
|||
if [ $runVoidError -ne 0 ]; then |
|||
echo -n "installing package <$package> ... " |
|||
sudo DEBIAN_FRONTEND=noninteractive apt install -y $package |
|||
echo "DONE" |
|||
fi |
|||
done |
|||
|
|||
#echo "## remove hplip annoyance" |
|||
#echo "=========================" |
|||
#if [[ -f /etc/xdg/autostart/hplip-systray.desktop ]]; then |
|||
# sudo rm /etc/xdg/autostart/hplip-systray.desktop |
|||
#else |
|||
# echo "hplip annoyance already removed!" |
|||
#fi |
|||
|
|||
echo "## debian-bash" |
|||
echo "==============" |
|||
if [[ ! -d /opt/debian-bash ]]; then |
|||
curl https://git.artcode.re/pvincent/debian-bash/raw/branch/master/install.sh | sudo bash -s -- --host |
|||
else |
|||
echo "debian-bash already installed!" |
|||
fi |
|||
|
|||
echo "## openssh-server" |
|||
echo "=================" |
|||
PGKNAME='openssh-server' |
|||
runVoid dpkg-query --status $PGKNAME |
|||
if [ $runVoidError -ne 0 ]; then |
|||
set -e |
|||
sudo apt install -y $PGKNAME |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?PermitRootLogin.*$" "PermitRootLogin no" /etc/ssh/sshd_config |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?PasswordAuthentication.*$" "PasswordAuthentication no" /etc/ssh/sshd_config |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?AllowUsers.*$" "AllowUsers $ALLOWED_USERS" /etc/ssh/sshd_config |
|||
sudo systemctl restart sshd |
|||
set +e |
|||
else |
|||
echo "${PGKNAME} already installed!" |
|||
fi |
|||
|
|||
echo "## allow hotplug eth0" |
|||
echo "=====================" |
|||
if [[ $(grep 'auto eth0' /etc/network/interfaces.d/setup) ]]; then |
|||
sudo /opt/debian-bash/tools/append_or_replace "^auto eth0.*$" "allow-hotplug eth0" /etc/network/interfaces.d/setup |
|||
else |
|||
echo "allow-hotplug already set up" |
|||
fi |
|||
|
|||
echo "## firefox latest" |
|||
echo "=================" |
|||
if [[ ! /usr/local/bin/firefox -ef /opt/firefox/firefox ]]; then |
|||
set -e |
|||
cd /tmp |
|||
wget $(curl 'https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US' | cut -d '"' -f2) -O firefox-latest.tar.bz2 |
|||
sudo mkdir /opt/firefox -p |
|||
sudo chown $USER /opt/firefox |
|||
tar -xjf firefox-latest.tar.bz2 -C /opt |
|||
cat <<EOF | sudo tee -a /usr/share/applications/firefox-stable.desktop |
|||
[Desktop Entry] |
|||
Name=Firefox Stable |
|||
Comment=Web Browser |
|||
Exec=/opt/firefox/firefox %u |
|||
Terminal=false |
|||
Type=Application |
|||
Icon=/opt/firefox/browser/chrome/icons/default/default128.png |
|||
Categories=Network;WebBrowser; |
|||
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https; |
|||
StartupNotify=true |
|||
StartupWMClass=firefox |
|||
EOF |
|||
sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox |
|||
sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200 && sudo update-alternatives --set x-www-browser /opt/firefox/firefox |
|||
sudo apt remove -y firefox-esr |
|||
set +e |
|||
else |
|||
echo "firefox latest already installed!" |
|||
fi |
|||
|
|||
echo "## firefox by default" |
|||
echo "=====================" |
|||
xdg-settings set default-web-browser firefox-stable.desktop |
|||
|
|||
echo "## disable apparmor evince" |
|||
echo "==========================" |
|||
if [[ ! -L /etc/apparmor.d/disable/usr.bin.evince ]]; then |
|||
sudo ln -s /etc/apparmor.d/usr.bin.evince /etc/apparmor.d/disable/ |
|||
sudo apparmor_parser -R /etc/apparmor.d/disable/usr.bin.evince |
|||
else |
|||
echo "evince apparmor already disabled!" |
|||
fi |
|||
|
|||
echo "## gnome default settings" |
|||
echo "=============" |
|||
#gsettings set org.gnome.settings-daemon.peripherals.keyboard remember-numlock-state true |
|||
gsettings set org.gnome.desktop.interface clock-show-date true |
|||
gsettings set org.gnome.nautilus.preferences click-policy 'single' |
|||
gsettings set org.gnome.mutter dynamic-workspaces false |
|||
gsettings set org.gnome.desktop.wm.preferences num-workspaces 1 |
|||
gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true |
|||
|
|||
echo "## favorite apps" |
|||
echo "================" |
|||
favorite_apps=$(gsettings get org.gnome.shell favorite-apps) |
|||
if [[ "$favorite_apps" == "['firefox-esr.desktop', 'org.gnome.Evolution.desktop', 'rhythmbox.desktop', 'libreoffice-writer.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop', 'yelp.desktop']" ]]; then |
|||
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop','firefox-stable.desktop','org.gnome.Software.desktop']" |
|||
fi |
|||
|
|||
echo "## gnome-extensions-cli" |
|||
echo "=======================" |
|||
runVoid command gnome-extensions-cli |
|||
if [[ $runVoidError -ne 0 ]]; then |
|||
sudo pip3 install gnome-extensions-cli |
|||
else |
|||
echo "gnome-extensions-cli already installed!" |
|||
fi |
|||
|
|||
echo "## gnome-shell install several extensions" |
|||
echo "=========================================" |
|||
EXTENSIONS=( |
|||
"appindicatorsupport@rgcjonas.gmail.com" |
|||
"system-monitor@paradoxxx.zero.gmail.com" |
|||
"dash-to-dock@micxgx.gmail.com" |
|||
"netspeed@hedayaty.gmail.com" |
|||
"gsconnect@andyholmes.github.io" |
|||
) |
|||
|
|||
NEED_GNOME_SHELL_RESTART=false |
|||
for extension in "${EXTENSIONS[@]}"; do |
|||
if [[ ! -d $HOME/.local/share/gnome-shell/extensions/$extension ]]; then |
|||
NEED_GNOME_SHELL_RESTART=true |
|||
gnome-extensions-cli --backend file install "$extension" |
|||
if [[ -d $HOME/.local/share/gnome-shell/extensions/$extension/schemas ]]; then |
|||
sudo cp $HOME/.local/share/gnome-shell/extensions/$extension/schemas/*.gschema.xml /usr/share/glib-2.0/schemas/ |
|||
fi |
|||
else |
|||
gnome-extensions-cli --backend file update "$extension" |
|||
echo "extension <${extension}> already installed!" |
|||
fi |
|||
done |
|||
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/ # recompile each time |
|||
|
|||
echo "# gnome extra settings" |
|||
echo "======================" |
|||
gsettings set org.gnome.shell.extensions.system-monitor show-tooltip true |
|||
gsettings set org.gnome.shell.extensions.system-monitor cpu-show-text false |
|||
gsettings set org.gnome.shell.extensions.system-monitor cpu-graph-width 60 |
|||
gsettings set org.gnome.shell.extensions.system-monitor memory-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor net-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor disk-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor icon-display false |
|||
|
|||
gsettings set org.gnome.shell.extensions.netspeed show-sum true |
|||
gsettings set org.gnome.shell.extensions.netspeed use-bytes true |
|||
|
|||
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed true |
|||
gsettings set org.gnome.shell.extensions.dash-to-dock apply-custom-theme true |
|||
gsettings set org.gnome.shell.extensions.dash-to-dock extend-height true |
|||
gsettings set org.gnome.shell.extensions.dash-to-dock multi-monitor true |
|||
|
|||
echo "# firefox addons" |
|||
echo "================" |
|||
declare -A FIREFOX_ADDONS |
|||
FIREFOX_ADDONS['uBlock0@raymondhill.net']="3740966/ublock_origin-1.34.0-an+fx.xpi" |
|||
FIREFOX_ADDONS['fr-dicollecte@dictionaries.addons.mozilla.org']='3581786/dictionnaire_francais-7.0b.xpi' |
|||
FIREFOX_ADDONS['chrome-gnome-shell@gnome.org']='898030/gnome_shell_integration-10.1-an+fx-linux.xpi' |
|||
FIREFOX_ADDONS['jid1-ZAdIEUB7XOzOJw@jetpack']='3741831/duckduckgo_privacy_essentials-2021.3.8-an+fx.xpi' |
|||
|
|||
mkdir -p /opt/firefox/distribution/extensions |
|||
for addon_id in "${!FIREFOX_ADDONS[@]}"; do |
|||
addon_part_url="${FIREFOX_ADDONS[$addon_id]}" |
|||
addon_xpi="/opt/firefox/distribution/extensions/${addon_id}.xpi" |
|||
if [[ ! -f "$addon_xpi" ]]; then |
|||
echo -n "Firefox addon <$addon_id> installing ..." |
|||
wget -q "https://addons.mozilla.org/firefox/downloads/file/${addon_part_url}" -O $addon_xpi |
|||
echo DONE |
|||
else |
|||
echo "Firefox addon <$addon_id> already installed!" |
|||
fi |
|||
done |
|||
|
|||
echo "# Firefox default settings" |
|||
echo "#=========================" |
|||
|
|||
if [[ ! -f /opt/firefox/firefox.cfg ]]; then |
|||
cat <<EOF | sudo tee -a /opt/firefox/firefox.cfg |
|||
// IMPORTANT: Start your code on the 2nd line |
|||
|
|||
lockPref("browser.pocket.enabled", false); |
|||
lockPref("extensions.pocket.enabled", false); |
|||
lockPref("browser.shell.checkDefaultBrowser", false); |
|||
EOF |
|||
cat <<EOF | sudo tee -a /opt/firefox/defaults/pref/autoconfig.js |
|||
pref("general.config.filename", "firefox.cfg"); |
|||
pref("general.config.obscure_value", 0); |
|||
EOF |
|||
|
|||
else |
|||
echo "Firefox default settings already defined!" |
|||
fi |
|||
|
|||
echo "# favourite apps" |
|||
echo "#===============" |
|||
runVoid "gsettings get org.gnome.shell favorite-apps | grep firefox-esr" |
|||
if [[ "$runVoidError" == 0 ]]; then |
|||
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop','firefox-stable.desktop','org.gnome.Software.desktop']" |
|||
else |
|||
echo "preserve existing apps!" |
|||
fi |
|||
|
|||
echo "# AppImageLauncher" |
|||
echo "#===============" |
|||
# TEST ABSENCE |
|||
if [[ ! $(dpkg -l | grep appimagelauncher) ]]; then |
|||
# INSTALL |
|||
wget https://github.com/TheAssassin/AppImageLauncher/releases/download/v2.2.0/appimagelauncher_2.2.0-travis995.0f91801.bionic_amd64.deb -O /tmp/appimagelauncher.deb |
|||
sudo dpkg -i /tmp/appimagelauncher.deb |
|||
else |
|||
# ELSE ALREADY INSTALLED |
|||
echo "AppImageLauncher already installed!" |
|||
fi |
|||
|
|||
echo |
|||
echo |
|||
echo "# DEBIAN-GNOME successfully installed!" |
|||
echo |
|||
|
|||
if [[ $NEED_GNOME_SHELL_RESTART == true ]]; then |
|||
|
|||
#INTERESTING: nested wayland!!! |
|||
#dbus-run-session -- gnome-shell --nested --wayland |
|||
trap - ERR |
|||
zenity --question --title "Rechargement de la session demandée" --width 600 --text "Des extensions GNOME ont été rajoutées à votre session.\n Voulez-vous rechargez votre session pour voir les changements ?" --timeout 10 |
|||
case $? in |
|||
0) |
|||
echo "You answered yes" |
|||
killall -3 gnome-shell |
|||
;; |
|||
1) echo "You answered no" ;; |
|||
5) echo "Time out" ;; |
|||
*) echo "Unexpected!" ;; |
|||
esac |
|||
|
|||
fi |
@ -1,4 +1,284 @@ |
|||
#!/bin/bash |
|||
|
|||
codename=$(lsb_release -c | cut -f2) |
|||
curl https://git.artcode.re/pvincent/debian-gnome/raw/branch/master/src/$codename | bash -s -- |
|||
## FUNCTIONS |
|||
## --------- |
|||
|
|||
function trap_error() { |
|||
error_code=$1 |
|||
error_line=$2 |
|||
|
|||
printf "\nEXIT #${error_code} due to error at line ${error_line} : \n-----------------------------------------\n" |
|||
sed "${error_line}q;d" $0 |
|||
echo |
|||
exit $error_code |
|||
} |
|||
|
|||
function runVoid() { |
|||
trap - ERR |
|||
local COMMAND="$@" |
|||
bash -c "${COMMAND}" >/dev/null 2>&1 |
|||
runVoidError=$? |
|||
trap 'trap_error $? $LINENO' ERR |
|||
} |
|||
|
|||
function askConfirmation() { |
|||
case "$1" in |
|||
y | Y | yes | YES) |
|||
QUESTION="(Y/n)?" |
|||
DEFAULT=0 |
|||
;; |
|||
*) |
|||
QUESTION="(y/N)?" |
|||
DEFAULT=1 |
|||
;; |
|||
esac |
|||
read -p "$QUESTION : " choice |
|||
case "$choice" in |
|||
y | Y | yes | YES) return 0 ;; #true |
|||
n | no | N | NO) return 1 ;; #false |
|||
*) return $DEFAULT ;; |
|||
esac |
|||
} |
|||
|
|||
# Variables and constants |
|||
## --------- |
|||
|
|||
BASEDIR=/opt/debian-gnome |
|||
ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! |
|||
REQUIRED_PACKAGES=( |
|||
bash-completion |
|||
vim git wget curl |
|||
htop jq unzip |
|||
python3-pip |
|||
gir1.2-gtop-2.0 gir1.2-nm-1.0 gir1.2-clutter-1.0 gnome-system-monitor |
|||
tilix wl-clipboard |
|||
cups hplip |
|||
ttf-mscorefonts-installer |
|||
nautilus-share nautilus-image-converter |
|||
goldendict |
|||
) |
|||
|
|||
## MAIN |
|||
## --------- |
|||
|
|||
[ $(id -u) -eq 0 ] && echo 'normal user required' && exit -1 |
|||
|
|||
echo "# configure apt sources to the mithril's" |
|||
echo "========================================" |
|||
if grep cdrom /etc/apt/sources.list; then |
|||
echo "deb http://debian.mithril.re/debian bookworm main contrib non-free-firmware" | sudo tee /etc/apt/sources.list |
|||
echo "deb http://debian.mithril.re/debian bookworm-updates main contrib non-free-firmware" | sudo tee -a /etc/apt/sources.list |
|||
echo "deb http://debian.mithril.re/debian-security bookworm-security main contrib non-free-firmware" | sudo tee -a /etc/apt/sources.list |
|||
sudo apt update |
|||
sudo apt autoremove -y |
|||
else |
|||
echo "# updating repositories" |
|||
echo "===================" |
|||
if [[ $(date --date='-12 hours' +%s) -gt $(date -d "$(stat -c %y /var/lib/apt/lists/partial)" +%s) ]]; then |
|||
sudo apt update |
|||
sudo apt autoremove -y |
|||
else |
|||
echo "repositories recently updated!" |
|||
fi |
|||
fi |
|||
|
|||
echo "# required packages" |
|||
echo "===================" |
|||
for package in ${REQUIRED_PACKAGES[@]}; do |
|||
runVoid dpkg-query --status $package |
|||
if [ $runVoidError -ne 0 ]; then |
|||
echo -n "installing package <$package> ... " |
|||
sudo DEBIAN_FRONTEND=noninteractive apt install -y $package |
|||
echo "DONE" |
|||
fi |
|||
done |
|||
|
|||
echo "## debian-bash" |
|||
echo "==============" |
|||
if [[ ! -d /opt/debian-bash ]]; then |
|||
curl https://git.artcode.re/pvincent/debian-bash/raw/branch/master/install.sh | sudo bash -s -- --host |
|||
else |
|||
echo "debian-bash already installed!" |
|||
fi |
|||
|
|||
echo "## openssh-server" |
|||
echo "=================" |
|||
PGKNAME='openssh-server' |
|||
runVoid dpkg-query --status $PGKNAME |
|||
if [ $runVoidError -ne 0 ]; then |
|||
set -e |
|||
sudo apt install -y $PGKNAME |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?PermitRootLogin.*$" "PermitRootLogin no" /etc/ssh/sshd_config |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?PasswordAuthentication.*$" "PasswordAuthentication no" /etc/ssh/sshd_config |
|||
sudo /opt/debian-bash/tools/append_or_replace "^#\?AllowUsers.*$" "AllowUsers $ALLOWED_USERS" /etc/ssh/sshd_config |
|||
sudo systemctl restart sshd |
|||
set +e |
|||
else |
|||
echo "${PGKNAME} already installed!" |
|||
fi |
|||
|
|||
firefox_lang=$(echo $LANG | cut -d_ -f1) |
|||
[[ $firefox_lang == "en" ]] && firefox_lang="en-US" |
|||
echo $firefox_lang |
|||
|
|||
echo "## firefox latest" |
|||
echo "=================" |
|||
if [[ ! /usr/local/bin/firefox -ef /opt/firefox/firefox ]]; then |
|||
set -e |
|||
cd /tmp |
|||
wget $(curl "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=$firefox_lang" | cut -d '"' -f2) -O firefox-latest.tar.bz2 |
|||
sudo mkdir /opt/firefox -p |
|||
sudo chown $USER /opt/firefox |
|||
tar -xjf firefox-latest.tar.bz2 -C /opt |
|||
cat <<EOF | sudo tee -a /usr/share/applications/firefox.desktop |
|||
[Desktop Entry] |
|||
Name=Firefox |
|||
Comment=Web Browser |
|||
Exec=/opt/firefox/firefox %u |
|||
Terminal=false |
|||
Type=Application |
|||
Icon=/opt/firefox/browser/chrome/icons/default/default128.png |
|||
Categories=Network;WebBrowser; |
|||
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https; |
|||
StartupNotify=true |
|||
StartupWMClass=Navigator |
|||
Actions=new-window;new-private-window;profile-manager; |
|||
|
|||
[Desktop Action new-window] |
|||
Name=New Window |
|||
Exec=/opt/firefox/firefox --new-window %u |
|||
|
|||
[Desktop Action new-private-window] |
|||
Name=New Private Window |
|||
Exec=/opt/firefox/firefox --private-window %u |
|||
|
|||
[Desktop Action profile-manager] |
|||
Name=Profile Manager |
|||
Exec=/opt/firefox/firefox -P %u |
|||
EOF |
|||
sudo ln -sf /opt/firefox/firefox /usr/local/bin/firefox |
|||
sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 200 && sudo update-alternatives --set x-www-browser /opt/firefox/firefox |
|||
sudo apt remove -y firefox-esr |
|||
sudo apt install -y libdbus-glib-1-2 |
|||
set +e |
|||
else |
|||
echo "firefox latest already installed!" |
|||
fi |
|||
|
|||
echo "## firefox by default" |
|||
echo "=====================" |
|||
xdg-settings set default-web-browser firefox.desktop |
|||
|
|||
echo "## gnome default settings" |
|||
echo "=============" |
|||
gsettings set org.gnome.nautilus.preferences click-policy 'single' |
|||
gsettings set org.gnome.mutter dynamic-workspaces false |
|||
gsettings set org.gnome.desktop.wm.preferences num-workspaces 1 |
|||
gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true |
|||
|
|||
echo "## favorite apps" |
|||
echo "================" |
|||
favorite_apps=$(gsettings get org.gnome.shell favorite-apps) |
|||
if [[ "$favorite_apps" == "['firefox-esr.desktop', 'org.gnome.Evolution.desktop', 'rhythmbox.desktop', 'libreoffice-writer.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop', 'yelp.desktop']" ]]; then |
|||
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop','firefox-stable.desktop','org.gnome.Software.desktop']" |
|||
fi |
|||
|
|||
echo "## gnome-extensions-cli" |
|||
echo "=======================" |
|||
if [[ ! -f ~/.local/bin/gext ]]; then |
|||
pip install gnome-extensions-cli --break-system-packages |
|||
else |
|||
echo "gnome-extensions-cli already installed!" |
|||
fi |
|||
|
|||
echo "## gnome-shell install several extensions" |
|||
echo "=========================================" |
|||
EXTENSIONS=( |
|||
"appindicatorsupport@rgcjonas.gmail.com" |
|||
"system-monitor-next@paradoxxx.zero.gmail.com" |
|||
"dash-to-dock@micxgx.gmail.com" |
|||
"gsconnect@andyholmes.github.io" |
|||
"network-stats@gnome.noroadsleft.xyz" |
|||
) |
|||
|
|||
for extension in "${EXTENSIONS[@]}"; do |
|||
if [[ ! -d $HOME/.local/share/gnome-shell/extensions/$extension ]]; then |
|||
~/.local/bin/gext install "$extension" |
|||
sudo cp $HOME/.local/share/gnome-shell/extensions/$extension/schemas/*.gschema.xml /usr/share/glib-2.0/schemas/ |
|||
else |
|||
echo "extension <${extension}> already installed!" |
|||
fi |
|||
done |
|||
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/ |
|||
|
|||
echo "# gnome extra settings" |
|||
echo "======================" |
|||
gsettings set org.gnome.shell.extensions.system-monitor show-tooltip true |
|||
gsettings set org.gnome.shell.extensions.system-monitor cpu-show-text false |
|||
gsettings set org.gnome.shell.extensions.system-monitor cpu-graph-width 60 |
|||
gsettings set org.gnome.shell.extensions.system-monitor memory-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor net-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor net-show-text false |
|||
gsettings set org.gnome.shell.extensions.system-monitor net-graph-width 40 |
|||
gsettings set org.gnome.shell.extensions.system-monitor disk-display false |
|||
gsettings set org.gnome.shell.extensions.system-monitor icon-display false |
|||
|
|||
#gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed true |
|||
gsettings set org.gnome.shell.extensions.dash-to-dock apply-custom-theme true |
|||
#gsettings set org.gnome.shell.extensions.dash-to-dock extend-height true |
|||
gsettings set org.gnome.shell.extensions.dash-to-dock multi-monitor true |
|||
|
|||
echo "# firefox addons" |
|||
echo "================" |
|||
declare -A FIREFOX_ADDONS |
|||
FIREFOX_ADDONS['uBlock0@raymondhill.net']="3740966/ublock_origin-1.34.0-an+fx.xpi" |
|||
FIREFOX_ADDONS['fr-dicollecte@dictionaries.addons.mozilla.org']='3581786/dictionnaire_francais-7.0b.xpi' |
|||
FIREFOX_ADDONS['chrome-gnome-shell@gnome.org']='898030/gnome_shell_integration-10.1-an+fx-linux.xpi' |
|||
FIREFOX_ADDONS['jid1-ZAdIEUB7XOzOJw@jetpack']='3741831/duckduckgo_privacy_essentials-2021.3.8-an+fx.xpi' |
|||
|
|||
mkdir -p /opt/firefox/distribution/extensions |
|||
for addon_id in "${!FIREFOX_ADDONS[@]}"; do |
|||
addon_part_url="${FIREFOX_ADDONS[$addon_id]}" |
|||
addon_xpi="/opt/firefox/distribution/extensions/${addon_id}.xpi" |
|||
if [[ ! -f "$addon_xpi" ]]; then |
|||
echo -n "Firefox addon <$addon_id> installing ..." |
|||
wget -q "https://addons.mozilla.org/firefox/downloads/file/${addon_part_url}" -O $addon_xpi |
|||
echo DONE |
|||
else |
|||
echo "Firefox addon <$addon_id> already installed!" |
|||
fi |
|||
done |
|||
|
|||
echo "# Firefox default settings" |
|||
echo "#=========================" |
|||
|
|||
if [[ ! -f /opt/firefox/firefox.cfg ]]; then |
|||
cat <<EOF | sudo tee -a /opt/firefox/firefox.cfg |
|||
// IMPORTANT: Start your code on the 2nd line |
|||
|
|||
lockPref("browser.pocket.enabled", false); |
|||
lockPref("extensions.pocket.enabled", false); |
|||
lockPref("browser.shell.checkDefaultBrowser", false); |
|||
EOF |
|||
cat <<EOF | sudo tee -a /opt/firefox/defaults/pref/autoconfig.js |
|||
pref("general.config.filename", "firefox.cfg"); |
|||
pref("general.config.obscure_value", 0); |
|||
EOF |
|||
|
|||
else |
|||
echo "Firefox default settings already defined!" |
|||
fi |
|||
|
|||
echo "# favourite apps" |
|||
echo "#===============" |
|||
runVoid "gsettings get org.gnome.shell favorite-apps | grep firefox-esr" |
|||
if [[ "$runVoidError" == 0 ]]; then |
|||
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop','firefox-stable.desktop','org.gnome.Software.desktop']" |
|||
else |
|||
echo "preserve existing apps!" |
|||
fi |
|||
|
|||
echo |
|||
echo |
|||
echo "# DEBIAN-GNOME successfully installed!" |
|||
echo |
Write
Preview
Loading…
Cancel
Save
Reference in new issue