fix: stat syntax error; apt output in update menu

This commit is contained in:
Cameron Ryder
2023-06-07 23:46:55 -04:00
parent 5d674f3263
commit f22b9da734

View File

@@ -359,11 +359,12 @@ function create_required_folders() {
} }
function update_system_package_lists() { function update_system_package_lists() {
local cache_mtime update_age local cache_mtime update_age silent
if [[ $1 == '--silent' ]]; then silent=1; shift; fi
if [[ -e /var/lib/apt/periodic/update-success-stamp ]]; then if [[ -e /var/lib/apt/periodic/update-success-stamp ]]; then
cache_mtime="$(stat -c $Y /var/lib/apt/periodic/update-success-stamp)" cache_mtime="$(stat -c %Y /var/lib/apt/periodic/update-success-stamp)"
elif [[ -e /var/lib/apt/lists ]]; then elif [[ -e /var/lib/apt/lists ]]; then
cache_mtime="$(stat -c $Y /var/lib/apt/lists)" cache_mtime="$(stat -c %Y /var/lib/apt/lists)"
else else
log_warning "Failure determining package cache age, forcing update" log_warning "Failure determining package cache age, forcing update"
cache_mtime=0 cache_mtime=0
@@ -373,10 +374,10 @@ function update_system_package_lists() {
# update if cache is greater than 48 hours old # update if cache is greater than 48 hours old
if [[ $update_age -gt $((48*60*60)) ]]; then if [[ $update_age -gt $((48*60*60)) ]]; then
status_msg "Updating package lists..." if [[ ! $silent ]]; then status_msg "Updating package lists..."; fi
if ! sudo apt-get update --allow-releaseinfo-change; then if ! sudo apt-get update --allow-releaseinfo-change; then
log_error "Failure while updating package lists!" log_error "Failure while updating package lists!"
error_msg "Updating package lists failed!" if [[ ! $silent ]]; then error_msg "Updating package lists failed!"; fi
exit 1 exit 1
fi fi
else else
@@ -386,7 +387,7 @@ function update_system_package_lists() {
function check_system_updates() { function check_system_updates() {
local updates_avail status local updates_avail status
if ! update_system_package_lists; then if ! update_system_package_lists --silent; then
status="${red}Update check failed! ${white}" status="${red}Update check failed! ${white}"
else else
updates_avail="$(apt list --upgradeable 2>/dev/null | sed "1d")" updates_avail="$(apt list --upgradeable 2>/dev/null | sed "1d")"