|
|
@ -3,18 +3,17 @@ |
|
|
|
## 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 |
|
|
|
local COMMAND="$@" |
|
|
|
bash -c "${COMMAND}" >/dev/null 2>&1 |
|
|
@ -22,24 +21,23 @@ function runVoid { |
|
|
|
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 |
|
|
@ -47,19 +45,18 @@ function askConfirmation { |
|
|
|
|
|
|
|
BASEDIR=/opt/debian-gnome |
|
|
|
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 |
|
|
|
## --------- |
|
|
|
|
|
|
|
[ `id -u` -eq 0 ] && echo 'normal user required' && exit -1 |
|
|
|
[ $(id -u) -eq 0 ] && echo 'normal user required' && exit -1 |
|
|
|
|
|
|
|
echo "# updating repositories" |
|
|
|
echo "===================" |
|
|
@ -72,10 +69,10 @@ fi |
|
|
|
|
|
|
|
echo "# required packages" |
|
|
|
echo "===================" |
|
|
|
for package in ${REQUIRED_PACKAGES[@]}; do |
|
|
|
for package in ${REQUIRED_PACKAGES[@]}; do |
|
|
|
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 |
|
|
|
echo "DONE" |
|
|
|
fi |
|
|
@ -101,7 +98,7 @@ echo "## openssh-server" |
|
|
|
echo "=================" |
|
|
|
PGKNAME='openssh-server' |
|
|
|
runVoid dpkg-query --status $PGKNAME |
|
|
|
if [ $runVoidError -ne 0 ] ; then |
|
|
|
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 |
|
|
@ -115,19 +112,18 @@ fi |
|
|
|
|
|
|
|
echo "## allow hotplug eth0" |
|
|
|
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 |
|
|
|
else |
|
|
|
echo "allow-hotplug already set up" |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
|
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 chown $USER /opt/firefox |
|
|
|
tar -xjf firefox-latest.tar.bz2 -C /opt |
|
|
@ -145,7 +141,7 @@ 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 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 |
|
|
@ -167,7 +163,7 @@ fi |
|
|
|
|
|
|
|
echo "## gnome default settings" |
|
|
|
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.nautilus.preferences click-policy 'single' |
|
|
|
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 natural-scroll false |
|
|
|
|
|
|
|
|
|
|
|
echo "## favorite apps" |
|
|
|
echo "================" |
|
|
|
favorite_apps=$(gsettings get org.gnome.shell favorite-apps) |
|
|
@ -194,7 +189,7 @@ fi |
|
|
|
|
|
|
|
echo "## gnome-shell install several extensions" |
|
|
|
echo "=========================================" |
|
|
|
EXTENSIONS=( |
|
|
|
EXTENSIONS=( |
|
|
|
"appindicatorsupport@rgcjonas.gmail.com" |
|
|
|
"system-monitor@paradoxxx.zero.gmail.com" |
|
|
|
"dash-to-dock@micxgx.gmail.com" |
|
|
@ -203,7 +198,7 @@ EXTENSIONS=( |
|
|
|
|
|
|
|
NEED_GNOME_SHELL_RESTART=false |
|
|
|
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 |
|
|
|
gnome-extensions-cli --backend file install $extension |
|
|
|
if [[ -d $HOME/.local/share/gnome-shell/extensions/$extension/schemas ]]; then |
|
|
@ -215,7 +210,6 @@ for extension in "${EXTENSIONS[@]}"; do |
|
|
|
fi |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
echo "# gnome extra settings" |
|
|
|
echo "======================" |
|
|
|
gsettings set org.gnome.shell.extensions.system-monitor show-tooltip true |
|
|
|