Skip to content

Commit

Permalink
Merge pull request #44 from archetipico/main
Browse files Browse the repository at this point in the history
Refactor code closes #43
  • Loading branch information
MasterCruelty authored Jun 28, 2021
2 parents 22b1e1a + 7efff94 commit 0acfea0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
6 changes: 1 addition & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,5 @@ else
printProgress "Setup completed."
fi

printf "${RED}"
read -p "Press enter, the process will be killed:\nif your terminal closes, open a new one to see changes." text
printf "${NORMAL}"

kill -9 $PPID
exec bash
exit 0
4 changes: 2 additions & 2 deletions src/test/integrity_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi
printProgress "\ncheck ./src/utils/*: starting"
while read LINE; do
if [[ -f "$SRC/utils/$LINE.sh" && $LINE != "" ]]; then
printf "${LOGO}passed\t$LINE.sh\n"
printf "${LOGO}passed\t$LINE.sh\n${NORMAL}"
else
printProgress "$SRC/utils/$LINE.sh is missing: aborting script\n"
exit 1
Expand All @@ -42,7 +42,7 @@ printProgress "check ./src/utils/*: completed"
printProgress "check ./src/package/*: starting"
while read LINE; do
if [[ -f "$SRC/package/$LINE.sh" && $LINE != "" ]]; then
printf "${LOGO}passed\t$LINE.sh\n"
printf "${LOGO}passed\t$LINE.sh\n${NORMAL}"
else
printProgress "$SRC/package/$LINE.sh is missing: aborting script\n"
exit 1
Expand Down
20 changes: 14 additions & 6 deletions src/utils/cache_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@
OUT="$(pwd | awk -F 'Updater/src/utils' '{print $1}')\n"

# array that contain all package manager
pkg=("pacman" "apt-get" "flatpak" "emerge" "zypper" "yum" "snap" "pkg")
system=("archlinux" "debian" "flatpak" "gentoo" "opensuse" "rpm" "snap" "termux")
declare -A pkg
pkg=(
["pacman"]="archlinux"
["apt-get"]="debian"
["flatpak"]="flatpak"
["emerge"]="gentoo"
["zypper"]="opensuse"
["yum"]="rpm"
["snap"]="snap"
["pkg"]="termux"
)

# check for privileges
if [[ $(command -v pkg) ]]; then
Expand All @@ -15,10 +24,9 @@ else
fi

# I check for every package which one is available on the system.
for i in "${!pkg[@]}"
do
if [[ $(command -v ${pkg[i]}) ]]; then
OUT+="package/${system[i]}\n"
for i in ${!pkg[@]}; do
if [[ $(command -v $i) ]]; then
OUT+="package/${pkg[$i]}\n"
fi
done

Expand Down
7 changes: 2 additions & 5 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ source src/utils/global.sh
sed -i "/alias up=/d" ~/.bashrc
printf "${RED}Alias 'up' removed\n"

printf "\nUninstallation completed\n"
printf "\nUninstallation completed\n${NORMAL}"

read -p "Press enter, the process will be killed. If your terminal closes, open a new one." text
printf "${NORMAL}"

kill -9 $PPID
exec bash
exit 0

0 comments on commit 0acfea0

Please sign in to comment.