switched packages variable to array

This commit is contained in:
pyr0ball 2023-04-12 13:11:10 -07:00
parent eed0ee893d
commit 6f3f7b90df

View file

@ -23,11 +23,11 @@ installed_files=()
#-----------------------------------------------------------------# #-----------------------------------------------------------------#
# List of dependency packaged to be istalled via apt # List of dependency packaged to be istalled via apt
packages="git packages=(git
vim vim
lm-sensors lm-sensors
curl curl
" )
# OS distribution auto-detection # OS distribution auto-detection
if type lsb_release >/dev/null 2>&1; then if type lsb_release >/dev/null 2>&1; then
@ -66,8 +66,7 @@ fi
# Add apt-notifier-common required packages # Add apt-notifier-common required packages
if [[ $OS_DETECTED == "Debian" ]] || [[ $OS_DETECTED == "Ubuntu" ]]; then if [[ $OS_DETECTED == "Debian" ]] || [[ $OS_DETECTED == "Ubuntu" ]]; then
packages="$packages packages+=(apt-config-auto-update)
apt-config-auto-update"
fi fi
bashrc_append=" bashrc_append="
@ -112,7 +111,7 @@ detectvim(){
} }
check-deps(){ check-deps(){
for pkg in $packages ; do for pkg in ${packages[@]} ; do
local _pkg=$(dpkg -l $pkg 2>&1 >/dev/null ; echo $?) local _pkg=$(dpkg -l $pkg 2>&1 >/dev/null ; echo $?)
if [[ $_pkg != 0 ]] ; then if [[ $_pkg != 0 ]] ; then
bins_missing+=($pkg) bins_missing+=($pkg)
@ -226,6 +225,7 @@ userinstall(){
# Check for existing bashrc config, append if missing # Check for existing bashrc config, append if missing
if [[ $(cat ${HOME}/.bashrc | grep -c 'bashrc.d') == 0 ]] ; then if [[ $(cat ${HOME}/.bashrc | grep -c 'bashrc.d') == 0 ]] ; then
take-backup $HOME/.bashrc
echo -e "$bashrc_append" >> $HOME/.bashrc && boxborder "bashc.d installed..." || warn "Malformed append on ${lbl}${HOME}/.bashrc${dfl}. Check this file for errors" echo -e "$bashrc_append" >> $HOME/.bashrc && boxborder "bashc.d installed..." || warn "Malformed append on ${lbl}${HOME}/.bashrc${dfl}. Check this file for errors"
echo -e "$prbl_bashrc" >> $HOME/.bashrc.d/00-prbl.bashrc && boxborder "bashc.d/00-prbl installed..." || warn "Malformed append on ${lbl}${HOME}/.bashrc.d/00-prbl.bashrc${dfl}. Check this file for errors" echo -e "$prbl_bashrc" >> $HOME/.bashrc.d/00-prbl.bashrc && boxborder "bashc.d/00-prbl installed..." || warn "Malformed append on ${lbl}${HOME}/.bashrc.d/00-prbl.bashrc${dfl}. Check this file for errors"
fi fi
@ -365,25 +365,20 @@ update(){
case $1 in case $1 in
-i | --install) -i | --install)
install install && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Installed${dfl}]"
success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Installed${dfl}]"
;; ;;
-r | --remove) -r | --remove)
remove remove && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Removed${dfl}]"
success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Removed${dfl}]"
;; ;;
-d | --dependencies) -d | --dependencies)
install-deps install-deps && success "${red}P${lrd}R${ylw}b${ong}L${dfl} Dependencies installed!"
success "${red}P${lrd}R${ylw}b${ong}L${dfl} Dependencies installed!"
;; ;;
-u | --update) -u | --update)
update update && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Updated${dfl}]"
success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Updated${dfl}]"
;; ;;
-f | --force) -f | --force)
remove-arbitrary remove-arbitrary
install install && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Installed${dfl}]"
success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Installed${dfl}]"
;; ;;
-h | --help) -h | --help)
usage usage