Browse Source

fix numlock-state

bookworm
pvincent@x260 3 years ago
parent
commit
31fdd6ea4d
  1. 2
      README.md
  2. 98
      src/main

2
README.md

@ -7,4 +7,4 @@ utilisé lors des Instalalis dispensées par Libre.re
install one-liner install one-liner
----------------- -----------------
`wget -q https://git.artcode.re/pvincent/debian-gnome/raw/branch/master/src/main -O /tmp/main && bash /tmp/main`
`curl https://git.artcode.re/pvincent/debian-gnome/raw/branch/master/src/main | pkexec bash -s --`

98
src/main

@ -3,18 +3,17 @@
## FUNCTIONS ## 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 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 {
function runVoid() {
trap - ERR trap - ERR
local COMMAND="$@" local COMMAND="$@"
bash -c "${COMMAND}" >/dev/null 2>&1 bash -c "${COMMAND}" >/dev/null 2>&1
@ -22,24 +21,23 @@ function runVoid {
trap 'trap_error $? $LINENO' ERR 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
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 # Variables and constants
@ -47,19 +45,18 @@ function askConfirmation {
BASEDIR=/opt/debian-gnome BASEDIR=/opt/debian-gnome
ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed!
REQUIRED_PACKAGES=( \
vim git wget curl \
htop tilix jq unzip python3-pip gir1.2-gtop-2.0 \
tilix bash-completion \
nextcloud-desktop nautilus-nextcloud nautilus-share nautilus-image-converter \
cups hplip-data \
)
REQUIRED_PACKAGES=(
vim git wget curl
htop tilix jq unzip python3-pip gir1.2-gtop-2.0
tilix bash-completion
nextcloud-desktop nautilus-nextcloud nautilus-share nautilus-image-converter
cups hplip-data
)
## MAIN ## MAIN
## --------- ## ---------
[ `id -u` -eq 0 ] && echo 'normal user required' && exit -1
[ $(id -u) -eq 0 ] && echo 'normal user required' && exit -1
echo "# updating repositories" echo "# updating repositories"
echo "===================" echo "==================="
@ -72,10 +69,10 @@ fi
echo "# required packages" echo "# required packages"
echo "===================" echo "==================="
for package in ${REQUIRED_PACKAGES[@]}; do
for package in ${REQUIRED_PACKAGES[@]}; do
runVoid dpkg-query --status $package runVoid dpkg-query --status $package
if [ $runVoidError -ne 0 ] ; then
echo -n "installing package <$package> ... " ;
if [ $runVoidError -ne 0 ]; then
echo -n "installing package <$package> ... "
sudo DEBIAN_FRONTEND=noninteractive apt install -y $package sudo DEBIAN_FRONTEND=noninteractive apt install -y $package
echo "DONE" echo "DONE"
fi fi
@ -101,7 +98,7 @@ echo "## openssh-server"
echo "=================" echo "================="
PGKNAME='openssh-server' PGKNAME='openssh-server'
runVoid dpkg-query --status $PGKNAME runVoid dpkg-query --status $PGKNAME
if [ $runVoidError -ne 0 ] ; then
if [ $runVoidError -ne 0 ]; then
set -e set -e
sudo apt install -y $PGKNAME 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 "^#\?PermitRootLogin.*$" "PermitRootLogin no" /etc/ssh/sshd_config
@ -115,19 +112,18 @@ fi
echo "## allow hotplug eth0" echo "## allow hotplug eth0"
echo "=====================" echo "====================="
if [[ $(grep 'auto eth0' /etc/network/interfaces.d/setup ) ]];then
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 sudo /opt/debian-bash/tools/append_or_replace "^auto eth0.*$" "allow-hotplug eth0" /etc/network/interfaces.d/setup
else else
echo "allow-hotplug already set up" echo "allow-hotplug already set up"
fi fi
echo "## firefox latest" echo "## firefox latest"
echo "================="
if [[ ! /usr/local/bin/firefox -ef /opt/firefox/firefox ]];then
echo "================="
if [[ ! /usr/local/bin/firefox -ef /opt/firefox/firefox ]]; then
set -e set -e
cd /tmp 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
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 mkdir /opt/firefox -p
sudo chown $USER /opt/firefox sudo chown $USER /opt/firefox
tar -xjf firefox-latest.tar.bz2 -C /opt tar -xjf firefox-latest.tar.bz2 -C /opt
@ -145,7 +141,7 @@ StartupNotify=true
StartupWMClass=Firefox StartupWMClass=Firefox
EOF EOF
sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox 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 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 remove -y firefox-esr
set +e set +e
else else
@ -167,7 +163,7 @@ fi
echo "## gnome default settings" echo "## gnome default settings"
echo "=============" echo "============="
gsettings set org.gnome.settings-daemon.peripherals.keyboard remember-numlock-state true
#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.desktop.interface clock-show-date true
gsettings set org.gnome.nautilus.preferences click-policy 'single' gsettings set org.gnome.nautilus.preferences click-policy 'single'
gsettings set org.gnome.mutter dynamic-workspaces false gsettings set org.gnome.mutter dynamic-workspaces false
@ -175,7 +171,6 @@ gsettings set org.gnome.desktop.wm.preferences num-workspaces 1
gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true
gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false
echo "## favorite apps" echo "## favorite apps"
echo "================" echo "================"
favorite_apps=$(gsettings get org.gnome.shell favorite-apps) favorite_apps=$(gsettings get org.gnome.shell favorite-apps)
@ -194,7 +189,7 @@ fi
echo "## gnome-shell install several extensions" echo "## gnome-shell install several extensions"
echo "=========================================" echo "========================================="
EXTENSIONS=(
EXTENSIONS=(
"appindicatorsupport@rgcjonas.gmail.com" "appindicatorsupport@rgcjonas.gmail.com"
"system-monitor@paradoxxx.zero.gmail.com" "system-monitor@paradoxxx.zero.gmail.com"
"dash-to-dock@micxgx.gmail.com" "dash-to-dock@micxgx.gmail.com"
@ -203,7 +198,7 @@ EXTENSIONS=(
NEED_GNOME_SHELL_RESTART=false NEED_GNOME_SHELL_RESTART=false
for extension in "${EXTENSIONS[@]}"; do for extension in "${EXTENSIONS[@]}"; do
if [[ ! -d $HOME/.local/share/gnome-shell/extensions/$extension ]];then
if [[ ! -d $HOME/.local/share/gnome-shell/extensions/$extension ]]; then
NEED_GNOME_SHELL_RESTART=true NEED_GNOME_SHELL_RESTART=true
gnome-extensions-cli --backend file install $extension gnome-extensions-cli --backend file install $extension
if [[ -d $HOME/.local/share/gnome-shell/extensions/$extension/schemas ]]; then if [[ -d $HOME/.local/share/gnome-shell/extensions/$extension/schemas ]]; then
@ -215,7 +210,6 @@ for extension in "${EXTENSIONS[@]}"; do
fi fi
done done
echo "# gnome extra settings" echo "# gnome extra settings"
echo "======================" echo "======================"
gsettings set org.gnome.shell.extensions.system-monitor show-tooltip true gsettings set org.gnome.shell.extensions.system-monitor show-tooltip true

Loading…
Cancel
Save