|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
# . ./build.vars and set -o errexit -o noglob are assumed.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
# See warning at the top of build.vars.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cpu_get_fnames() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
if test_cmd pkg_${cu_name}_check_updates; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
pkg_${cu_name}_check_updates get_fnames;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
if [ -z "${cu_fnames}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
if [ "${cu_url#*://github.com/*}" != "${cu_url}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
_cpugf_uname="${cu_url#*/github.com/}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
_cpugf_uname="${_cpugf_uname%%/*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
_cpugf_pname="${cu_url#*/github.com/${_cpugf_uname}/}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
_cpugf_pname="${_cpugf_pname%%/*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
cu_url_index="https://github.com/${_cpugf_uname%%/*}/${_cpugf_pname%%/*}/releases/";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
unset _cpu_uname _cpu_pname;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
cu_fnames="$(wget ${WGET_ARGS} -qO- ${cu_url_index} |\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
09c779 |
sed -n '//s/^.*\([a-zA-Z]\+-\|v\|\)\(.\+\)<\/span>.*$/\3/p')";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
cu_fname_base="${cu_name}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
cu_fname_ext="${cu_fname#v${cu_version}.}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
cu_url_index="${cu_url%/*}/";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
cu_fnames="$(wget ${WGET_ARGS} -qO- "${cu_url_index}" |\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
sed -n '/[hH][rR][eE][fF]="[^"]\+"/s/^.*[hH][rR][eE][fF]="\([^"]\+\)".*$/\1/p')";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
: ${cu_fname:="${cu_url##*/}"};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
: ${cu_fname_base:="${cu_fname%%-*}"};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
: ${cu_fname_ext:="${cu_fname#${cu_fname_base}-${cu_version}.}"};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cpu_get_version() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
unset cu_fname_version;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
if test_cmd pkg_${cu_name}_check_updates; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
pkg_${cu_name}_check_updates get_version;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
if [ -z "${cu_fname_version}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
if [ "${cu_url#*://github.com/*}" != "${cu_url}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
if [ "${cu_fname#${cu_fname_base}-}" = "${cu_fname}" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
&& [ "${cu_fname%.${cu_fname_ext}}" = "${cu_fname}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
cu_fname_version="${cu_fname}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
elif [ "${cu_fname#${cu_fname_base}-}" != "${cu_fname}" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
&& [ "${cu_fname%.${cu_fname_ext}}" != "${cu_fname}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cu_fname_version="${cu_fname#${cu_fname_base}-}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cu_fname_version="${cu_fname_version%.${cu_fname_ext}}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
check_pkg_updates() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cu_name="${1}"; cu_version="${2}"; cu_url="${3}"; cu_url_type="${4}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
. vars/check_updates.vars;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
if match_list "${CHECK_UPDATES_SKIP}" " " "${cu_name}"; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
log_msg vnfo "Skipping \`${cu_name}' (set in \${CHECK_UPDATES_SKIP}.)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
return 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
elif [ "${cu_url_type}" = "git" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
log_msg vnfo "Skipping \`${cu_name}' (URL_TYPE is Git.)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
return 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
elif [ -z "${cu_version}" -o -z "${cu_url}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
log_msg fail "Zero-length \${cu_version} and/or \${cu_url} for \`${cu_name}' (ignored.)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
return 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
log_msg vnfo "Checking ${cu_name} v${cu_version} for updates.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cpu_get_fnames; _cpu_versions="";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
for cu_fname in ${cu_fnames}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cu_fname="${cu_fname##*/}"; cpu_get_version;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
09c779 |
if [ -z "${cu_fname_version}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
09c779 |
continue;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
09c779 |
elif ! echo "${cu_fname_version}" | grep -Eq '^[-_.0-9a-zA-Z]+$' \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
|| echo "${cu_fname_version}" | grep -Eq '^[_.a-zA-Z]+'; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
09c779 |
log_msg varn "Skipping \`${cu_fname_version}' (invalid version.)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
_cpu_versions="${_cpu_versions:+${_cpu_versions} }${cu_fname_version}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
if [ -z "${_cpu_versions}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
log_msg warn "No versions available for \`${cu_name}' (Filename URL: ${cu_url}, index URL: ${cu_url_index}).";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
_cpu_versions="$(echo "${_cpu_versions}" |\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
sed 's/ /\n/g' | sort -rV | uniq |\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
head -n${CHECK_UPDATES_SHOW_NEW:-6} |\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
paste -d" " -s)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
if test_cmd pkg_${cu_name}_check_updates; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
pkg_${cu_name}_check_updates version_fixup;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
448904 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
if [ "${_cpu_versions%% *}" != "${cu_version}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
log_msg info "New release(s) available for ${cu_name} v${cu_version}: ${_cpu_versions}.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
log_msg vnfo "${cu_name} v${cu_version} is up to date.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
unset cu_fname cu_fname_base cu_fname_ext cu_fnames cu_fname_version \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cu_name cu_url cu_url_fname cu_url_fname_base cu_url_fname_ext \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
cu_url_index cu_url_type cu_version _cpu_versions;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
# vim:filetype=sh
|