Browse Source

runVoidError

bookworm
pvincent 3 years ago
parent
commit
3fa4d68d64
  1. 18
      src/main

18
src/main

@ -3,7 +3,7 @@
## FUNCTIONS ## FUNCTIONS
## --------- ## ---------
function trap_error(){
function trap_error {
error_code=$1 error_code=$1
error_line=$2 error_line=$2
@ -14,18 +14,16 @@ function trap_error(){
} }
function runVoid(){
function runVoid {
trap - ERR trap - ERR
local COMMAND="$@" local COMMAND="$@"
bash -c "${COMMAND}" >/dev/null 2>&1 bash -c "${COMMAND}" >/dev/null 2>&1
error=$?
runVoidError=$?
trap 'trap_error $? $LINENO' ERR trap 'trap_error $? $LINENO' ERR
return $error
} }
function askConfirmation (){
function askConfirmation {
case "$1" in case "$1" in
y|Y|yes|YES ) y|Y|yes|YES )
QUESTION="(Y/n)?" QUESTION="(Y/n)?"
@ -48,7 +46,6 @@ function askConfirmation (){
## --------- ## ---------
BASEDIR=/opt/debian-gnome BASEDIR=/opt/debian-gnome
GIT_REPOSITORY_RAW="https://git.artcode.re/pvincent/debian-gnome/raw/master"
ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed! ALLOWED_USERS=$(id -un) #CUSTOMIZE if needed!
REQUIRED_PACKAGES=( \ REQUIRED_PACKAGES=( \
vim git wget curl \ vim git wget curl \
@ -73,12 +70,11 @@ else
echo "repositories recently updated!" echo "repositories recently updated!"
fi fi
echo "# required packages" echo "# required packages"
echo "===================" echo "==================="
for package in ${REQUIRED_PACKAGES[@]}; do for package in ${REQUIRED_PACKAGES[@]}; do
runVoid dpkg-query --status $package runVoid dpkg-query --status $package
if [ $? -ne 0 ] ; then
if [ $runVoidError -ne 0 ] ; then
echo -n "installing package <$package> ... " ; echo -n "installing package <$package> ... " ;
sudo apt install -y $package sudo apt install -y $package
echo "DONE" echo "DONE"
@ -105,7 +101,7 @@ echo "## openssh-server"
echo "=================" echo "================="
PGKNAME='openssh-server' PGKNAME='openssh-server'
runVoid dpkg-query --status $PGKNAME runVoid dpkg-query --status $PGKNAME
if [ $? -ne 0 ] ; then
if [ $runVoidError -ne 0 ] ; then
set -e set -e
sudo apt install -y $PGKNAME sudo apt install -y $PGKNAME
sudo /opt/debian-bash/tools/append_or_replace "^#\?PermitRootLogin.*$" "PermitRootLogin no" /etc/ssh/sshd_config sudo /opt/debian-bash/tools/append_or_replace "^#\?PermitRootLogin.*$" "PermitRootLogin no" /etc/ssh/sshd_config
@ -190,7 +186,7 @@ fi
echo "## gnome-extensions-cli" echo "## gnome-extensions-cli"
echo "=======================" echo "======================="
runVoid command gnome-extensions-cli runVoid command gnome-extensions-cli
if [[ $? -ne 0 ]]; then
if [[ $runVoidError -ne 0 ]]; then
sudo pip3 install gnome-extensions-cli sudo pip3 install gnome-extensions-cli
else else
echo "gnome-extensions-cli already installed!" echo "gnome-extensions-cli already installed!"

Loading…
Cancel
Save