Skip to content

Instantly share code, notes, and snippets.

@przemoc
Last active February 6, 2018 13:46
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 przemoc/7513701 to your computer and use it in GitHub Desktop.
Save przemoc/7513701 to your computer and use it in GitHub Desktop.
#!/bin/sh
# SPDX-License-Identifier: MIT
## Copyright (C) 2013 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Simple script for downloading program stored on CNET:
# - AOMEI Partition Assistant Standard
# Tested on 2013-11-17.
set -e
get_page() { curl -LsS "$1"; }
get_href() { sed '/'"$1"'/!d;s,.*<a href=",,;s,".*,,;q'; }
get_rurl() { sed '/.*<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/I!d;s,,,;s,".*,,;q'; }
strip_pq() { sed 's,.*/,,;s,?.*,,'; }
download() { curl -R "$1" -o "$2"; }
echo "Finding download link for AOMEI Partition Assistant Standard:"
HOMEPAGE="http://www.disk-partition.com/download-home.html"
echo "- $HOMEPAGE"
CNETPAGE="$(get_page "$HOMEPAGE" | get_href "Local Download Freeware")"
echo "- $CNETPAGE"
CNETLINK="$(get_page "$CNETPAGE" | get_href "Download Now")"
echo "- $CNETLINK"
CNETDURL="$(get_page "$CNETLINK" | get_rurl)"
echo "- $CNETDURL"
FILENAME="$(echo "$CNETDURL" | strip_pq)"
echo
echo "Downloading $FILENAME:"
download "$CNETDURL" "$FILENAME"
@przemoc
Copy link
Author

przemoc commented Feb 6, 2018

commit 0b903631667f7e76e6f444544261757468471d59
Author: Przemyslaw Pawelczyk <przemoc@gmail.com>
Date:   2018-02-06 14:44:00 +0100

    download_PAssist_Std.exe.sh: Add copyright notice and MIT license notice.

commit 979ba93c1c81a8c848a8548e9acbd8717dec23ae
Author: Przemyslaw Pawelczyk <przemoc@gmail.com>
Date:   2018-02-06 14:45:08 +0100

    Add SPDX License Identifier.

    The Software Package Data Exchange (SPDX) is a good initiative, it has
    matured over time and deserves accelerated adoption in open-source.

    https://spdx.org/learn
    https://spdx.org/using-spdx
    https://spdx.org/license-list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment