diff --git a/src/launch b/src/launch new file mode 100644 index 0000000..7170b50 --- /dev/null +++ b/src/launch @@ -0,0 +1,4 @@ +cd /tmp +git clone https://git.artcode.re/pvincent/debian-gnome +cd debian-gnome +./src/main \ No newline at end of file diff --git a/src/main b/src/main new file mode 100755 index 0000000..70eaff9 --- /dev/null +++ b/src/main @@ -0,0 +1,130 @@ +#!/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 + +ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! +GIT_REPOSITORY_RAW="https://git.artcode.re/pvincent/debian-gnome/raw/master" + +## 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 <