Skip to content

Commit

Permalink
Update snap package list after 24h without update this
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbruno committed Nov 23, 2024
1 parent 1118c90 commit 274d4c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion usr/share/biglinux/bigstore-cli/snap_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ FileToSaveCacheFiltered="$cacheFolderHome/snap_filtered.json"
AllSnapCache="$cacheFolderHome/snap_all_pkgs.cache"
InstalledSnap="$cacheFolderHome/snap_Installed_pkgs.cache"

# If user not root, cache doesn't exist or is older than 24 hours, generate it
if [ "$UID" -ne 0 ] && { [[ ! -e $AllSnapCache ]] || [[ $(find "$AllSnapCache" -mmin +1440 -print) ]]; }; then
snap_download.sh
fi

# # Installed packages
LANG=C snap list | awk 'NR>1 { print $1 "\t" $2}' | sort -u >$InstalledSnap &

Expand Down Expand Up @@ -94,4 +99,4 @@ else
awk_file="$awk_folder/snap_cache_without_translate.awk"
fi

awk -v installedPackages="$InstalledSnap" $awk_translate -f $awk_file "$AllSnapCache" | sort -u >$FileToSaveCacheFiltered
awk -v installedPackages="$InstalledSnap" $awk_translate -f $awk_file "$AllSnapCache" | sort -u >$FileToSaveCacheFiltered

0 comments on commit 274d4c7

Please sign in to comment.