Skip to content

Instantly share code, notes, and snippets.

@popey
Created April 30, 2021 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popey/c048d3769320ddce4103b6563410d92c to your computer and use it in GitHub Desktop.
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)
#!/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