Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored json Software section to accommodate the growing number titles #111

Merged
merged 33 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: improve see_current_apt function to check if package lists …
…are up-to-date pass optio n to update
Tearran committed Sep 24, 2024
commit 76a4a3a1ec9f72cb6947d1dcd7c890edf14f5055
12 changes: 7 additions & 5 deletions lib/armbian-configng/config.ng.functions.sh
Original file line number Diff line number Diff line change
@@ -842,8 +842,8 @@ module_options+=(
["see_current_apt,author"]="Joey Turner"
["see_current_apt,ref_link"]=""
["see_current_apt,feature"]="see_current_apt"
["see_current_apt,desc"]="Check when apt list was last updated"
["see_current_apt,example"]="see_current_apt"
["see_current_apt,desc"]="Check when apt list was last updated and suggest updating or update"
["see_current_apt,example"]="see_current_apt || see_current_apt update"
["see_current_apt,doc_link"]=""
["see_current_apt,status"]="Active"
)
@@ -852,6 +852,7 @@ module_options+=(
#
see_current_apt() {
# Number of seconds in a day
local update_apt="$1"
local day=86400
local ten_minutes=600
# Get the current date as a Unix timestamp
@@ -880,11 +881,12 @@ see_current_apt() {

# Check if the package list is up-to-date
if ((elapsed < ten_minutes)); then
echo "The package lists are up-to-date."
[[ "$update_apt" != "update" ]] && echo "The package lists are up-to-date."
return 0 # The package lists are up-to-date
else
echo "Update the package lists." # Suggest updating
return 1 # The package lists are not up-to-date
[[ "$update_apt" != "update" ]] && echo "Update the package lists." # Suggest updating
[[ "$update_apt" == "update" ]] && apt_install_wrapper apt-get update
return 0 # The package lists are not up-to-date
fi
}