Created
April 30, 2021 14:48
-
-
Save popey/c048d3769320ddce4103b6563410d92c to your computer and use it in GitHub Desktop.
Downloads every snap from the store (brutal, don't use often, store team will kill you)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATESTAMP=$(date +%Y-%m-%d) | |
TIMESTAMP=$(date +%H%M%S) | |
FOLDER="$PWD"/"$DATESTAMP"-"$TIMESTAMP"-download | |
if mkdir -p "$FOLDER" ; then | |
echo "Created $FOLDER" | |
else | |
echo "Failed creating $FOLDER" | |
exit 1 | |
fi | |
LOGFILE="$FOLDER"/"$DATESTAMP"-"$TIMESTAMP"-log.txt | |
LISTFILE="$FOLDER"/names | |
cp /var/cache/snapd/names "$LISTFILE" | |
echo "Processing $LISTFILE" | |
cd "$FOLDER" | |
for f in $(cat "$LISTFILE"); | |
do | |
if snap download "$f" ; then | |
echo "$f" >> "$LOGFILE" | |
else | |
echo "$f - FAILED" >> "$LOGFILE" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment