Support URLs pointing to a zip file
This commit is contained in:
@@ -3,9 +3,11 @@
|
|||||||
# Configuration file for icscheck.sh
|
# Configuration file for icscheck.sh
|
||||||
# https://winklerfamilie.eu/git/SmallThings/icsutils.git
|
# https://winklerfamilie.eu/git/SmallThings/icsutils.git
|
||||||
|
|
||||||
local icsconf_url="https://somethi.ng"
|
readonly icsconf_url="https://somethi.ng"
|
||||||
local icsconf_output="${HOME}/my.ics"
|
# Only set icsconf_zip if the url points to a zip file
|
||||||
local icsconf_useragent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0"
|
readonly icsconf_zip="ics_name_inside_zip_$(date +%Y).ics"
|
||||||
|
readonly icsconf_output="${HOME}/my.ics"
|
||||||
|
readonly icsconf_useragent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0"
|
||||||
|
|
||||||
# icsError
|
# icsError
|
||||||
# Called if the download from ${icsconf_url} failed
|
# Called if the download from ${icsconf_url} failed
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ icscheck() {
|
|||||||
|
|
||||||
for arg in "${@}" ; do
|
for arg in "${@}" ; do
|
||||||
case "${1:-}" in
|
case "${1:-}" in
|
||||||
|
--debug|-d)
|
||||||
|
set -o xtrace && shift ;;
|
||||||
--help|-h)
|
--help|-h)
|
||||||
icsusage && return 0 ;;
|
icsusage && return 0 ;;
|
||||||
--renew|-r)
|
--renew|-r)
|
||||||
@@ -79,6 +81,11 @@ icscheck() {
|
|||||||
|
|
||||||
curl -L "${ics_url}" -H "User-Agent: ${icsconf_useragent:?}" -o "${ics_down_file}" >/dev/null 2>&1
|
curl -L "${ics_url}" -H "User-Agent: ${icsconf_useragent:?}" -o "${ics_down_file}" >/dev/null 2>&1
|
||||||
|
|
||||||
|
if [ -n "${icsconf_zip:-}" ]; then
|
||||||
|
unzip -oqq "${ics_down_file}" "${icsconf_zip}" -d "${ics_temp_dir}"
|
||||||
|
mv -f "${ics_temp_dir}/${icsconf_zip}" "${ics_down_file}"
|
||||||
|
fi
|
||||||
|
|
||||||
# -s : exists and size greater zero
|
# -s : exists and size greater zero
|
||||||
if [ ! -s "$ics_down_file" ] || [ ! -r "$ics_down_file" ]; then
|
if [ ! -s "$ics_down_file" ] || [ ! -r "$ics_down_file" ]; then
|
||||||
icsError
|
icsError
|
||||||
@@ -105,3 +112,4 @@ icscheck() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
icscheck "${@}"
|
icscheck "${@}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user