|
|
@ -3,7 +3,7 @@ |
|
|
|
## FUNCTIONS |
|
|
|
## --------- |
|
|
|
|
|
|
|
function trap_error { |
|
|
|
function trap_error() { |
|
|
|
error_code=$1 |
|
|
|
error_line=$2 |
|
|
|
|
|
|
@ -13,8 +13,7 @@ function trap_error { |
|
|
|
exit $error_code |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function runVoid { |
|
|
|
function runVoid() { |
|
|
|
trap - ERR |
|
|
|
local COMMAND="$@" |
|
|
|
bash -c "${COMMAND}" >/dev/null 2>&1 |
|
|
@ -22,23 +21,22 @@ function runVoid { |
|
|
|
trap 'trap_error $? $LINENO' ERR |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function askConfirmation { |
|
|
|
function askConfirmation() { |
|
|
|
case "$1" in |
|
|
|
y|Y|yes|YES ) |
|
|
|
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;; |
|
|
|
y | Y | yes | YES) return 0 ;; #true |
|
|
|
n | no | N | NO) return 1 ;; #false |
|
|
|
*) return $DEFAULT ;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
@ -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 "===================" |
|
|
@ -74,8 +71,8 @@ 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> ... " ; |
|
|
|
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 |
|
|
|
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 |
|
|
@ -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) |
|
|
@ -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 |
|
|
|