Archived
4
2

Make functional stub function download_hpr_sql

This commit is contained in:
Roan Horning 2023-03-03 20:41:29 -05:00
parent ee6a4e601d
commit 13aeb647ad
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769

View File

@ -79,7 +79,37 @@ function clean_working_dir {
# PARAMETERS: # PARAMETERS:
# RETURNS: # RETURNS:
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
function download_hpr_sql { echo; } function download_hpr_sql {
if [[ ! -d $1 ]] || ! expr $1 : '.*/tmp.*' ;
then
echo "Please provide the temporary directory when calling this function"
return 1
fi
local CURL=`which curl`
local WGET=`which wget`
local HPR_URL=https://www.hackerpublicradio.org/hpr.sql
if [ -f $1/hpr.sql ];
then
echo "Removing temporary hpr.sql"
rm $1/hpr.sql
else
echo "No temporary hpr.sql found"
fi
if [ "$CURL" != "" ];
then
curl $HPR_URL --output $1/hpr.sql
elif [ "$WGET" != "" ];
then
wget --directory-prefix=$1 $HPR_URL
else
echo "Could not download file. Please install either curl or wget."
return 1
fi
}
#--- FUNCTION ---------------------------------------------------------------- #--- FUNCTION ----------------------------------------------------------------
# NAME: make_hpr_sqlite_db # NAME: make_hpr_sqlite_db