Skip to content

Instantly share code, notes, and snippets.

@pkillnine
Created March 2, 2018 13:28
Show Gist options
  • Save pkillnine/598a46e895d732da10899d5e6d8a3aa1 to your computer and use it in GitHub Desktop.
Save pkillnine/598a46e895d732da10899d5e6d8a3aa1 to your computer and use it in GitHub Desktop.
A small script to automatically download the latest Maemo-Leste image from maedevu.maemo.org/images/n900
#!/bin/sh
DOWNLOAD_DIR="$HOME/Downloads"
if test -d $DOWNLOAD_DIR ; then
echo "Using specified download directory: $DOWNLOAD_DIR"
else
echo "Specified download directory doesn't exist: $DOWNLOAD_DIR"
exit
fi
newest=$(curl -s 'http://maedevu.maemo.org/images/n900/' | grep -Eo '[0-9]{8}' | uniq | tail -1)
filename="maemo-leste-1.0-armhf-n900-$newest.img.xz"
download_filepath=$DOWNLOAD_DIR/$filename
download_url="http://maedevu.maemo.org/images/n900/$newest/$filename"
#echo $url
if test -s $download_filepath ; then
echo "File exists: $download_filepath"
exit
else
echo "File doesn't exist, downloading $download_url"
wget $download_url -O $download_filepath
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment