diff --git a/src/main.bash b/src/main.bash index c3a5b69..162c09c 100755 --- a/src/main.bash +++ b/src/main.bash @@ -8,11 +8,31 @@ function runVoid(){ 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' @@ -59,19 +79,21 @@ else fi -# ublock origin -MOZILLA_GLOBAL_ADDONS_FOLDER="/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" -UBLOCK_ADDON="uBlock0@raymondhill.net" -if [[ ! -d "${MOZILLA_GLOBAL_ADDONS_FOLDER}/${UBLOCK_ADDON}" ]]; then - UBLOCK_URL=$(curl -s https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/ | grep -Poe "\"https://addons\.mozilla\.org/firefox/downloads/file.*?\"" | cut -d'"' -f2) - wget ${UBLOCK_URL} -O /tmp/ublock_origin.xpi - sudo mkdir -p ${MOZILLA_GLOBAL_ADDONS_FOLDER}/${UBLOCK_ADDON} - sudo unzip /tmp/ublock_origin.xpi -d ${MOZILLA_GLOBAL_ADDONS_FOLDER}/${UBLOCK_ADDON}/ +# firefox profile with ublock origin +if [[ -d $HOME/.mozilla/firefox ]];then + echo "Profile Firefox already created!" + echo -n "Need acknoledgment before resetting firefox profile from SCRATCH! Do you accept " + askConfirmation y +fi +if [ $? -eq 0 ];then + echo "resume processing new firefox profile" + wget $GIT_REPOSITORY_RAW/files/firefox.tgz -O /tmp/firefox.tgz + rm $HOME/.mozilla/firefox + tar -xzvf /tmp/firefox.tgz -C $HOME/.mozilla/ else - echo "ublock origin already installed!" + echo "omit firefox profile" fi - - +exit 1 ## gnome settings gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop','firefox-stable.desktop','org.gnome.Software.desktop']"