Skip to content

Commit

Permalink
Update database.am: option -a, generate description for 3rd-party apps
Browse files Browse the repository at this point in the history
this will be taken from the list, if the app is listed and no markdown file is available, then a brief description will be added, without URLs
  • Loading branch information
ivan-hc authored Apr 6, 2024
1 parent 9da52db commit de3bd80
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions modules/database.am
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ case "$1" in
fi
}

function generate_3rd_party() {
local app_status=" STATUS: NOT INSTALLED"
local package_name=${1^^}

if grep -q "$arg : " "$AMPATH/$arch-apps"; then
printf " PACKAGE: %s\n" "$arg" | tr a-z A-Z

if [ -f "$APPSPATH/$1/remove" ]; then
local disk_usage=$(du -sm "$APPSPATH/$1" | cut -f1)
app_status=" STATUS: INSTALLED, ABOUT $disk_usage MB OF DISK SPACE IN USE"
fi

printf "%s\n" "$app_status"
echo ""
cat "$AMPATH/$arch-apps" | grep "$arg : " | cut -d':' -f2-
echo ""
echo " SOURCE: Third party repository"
echo ""
printf "%s\n" "-----------------------------------------------------------------------"
else
printf " \"%s\" IS NOT A VALID ARGUMENT\n" "$package_name"
fi
}

function download_lib() {
local lib_name_upper=${1^^}
printf "%s\n" " LIBRARY: $lib_name_upper"
Expand Down Expand Up @@ -103,6 +127,8 @@ case "$1" in
for arg in "${@:2}"; do
if curl -o /dev/null -sIf "$AMCATALOGUEMARKDOWNS/${arg}.md" 1>/dev/null; then
download_markdown "$arg"
elif grep -q "$arg : " "$AMPATH/$arch-apps"; then
generate_3rd_party
elif grep -q "$arg : " "$AMPATH/libs-list"; then
download_lib "$arg"
else
Expand Down

0 comments on commit de3bd80

Please sign in to comment.