#!/bin/bash ## FUNCTIONS function runVoid(){ local COMMAND="$@" bash -c "${COMMAND}" >/dev/null 2>&1 return $? } 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 } ## MAIN [ `id -u` -eq 0 ] && echo 'normal user required' && exit -1 # variables and constants BASEDIR=/opt/debian-gnome LOGOUT_REQUIRED=false GIT_REPOSITORY_RAW="https://git.artcode.re/pvincent/debian-gnome/raw/master" ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! REQUIRED_PACKAGES=( git wget curl htop tilix jq unzip ) # required packages for package in ${REQUIRED_PACKAGES[@]}; do runVoid dpkg-query --status $package if [ $? -ne 0 ] ; then echo -n "installing package <$package> ... " ; sudo apt install -y $package echo "DONE" fi done ## openssh-server PGKNAME='openssh-server' runVoid dpkg-query --status $PGKNAME if [ $? -ne 0 ] ; then set -e sudo apt install $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 latest 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 <..." $FILE_IGE --enable $key echo DONE gnome-shell-extension-tool -e "${value}" else echo "Extension <${value}> already installed!" fi done ## logout required if [[ $LOGOUT_REQUIRED == true ]];then echo echo "****************************************************************" echo "please consider logging out, then log in again to apply changes!" echo "****************************************************************" fi