mirror of
https://github.com/endeavouros-team/PKGBUILDS.git
synced 2026-07-29 05:35:23 +00:00
[iso-create-ml] create-ml: added option --progress-mode
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Maintainer : manuel at endeavouros.com
|
||||
|
||||
pkgname=iso-create-ml
|
||||
pkgver=26.7
|
||||
pkgver=26.7.1
|
||||
pkgrel=1
|
||||
pkgdesc="Create a mirrorlist for the ISO"
|
||||
arch=('any')
|
||||
@@ -15,9 +15,9 @@ source=(
|
||||
create-ml-country-mapping-arch.conf
|
||||
create-ml-active-mirrors-arch.conf
|
||||
)
|
||||
sha256sums=('7d4f72efc967efc25ca469762fd7a165fa4b0a4aa1a3fc5388eb2729600b4ec1'
|
||||
'7e560eb19dc568ea20fbbbc203b16b3131468b04e35cdabc719107c01417b670'
|
||||
'265db6391c5f1b8d3d48cf5b33a338b1ed59d39278d58dda9c25a06108f96257'
|
||||
sha256sums=('a197ea76f0213bb9c7a3336c9cc6eb19db63240a9530b3b2aa080efb04111891'
|
||||
'ee638a19f10ace863443ee09f1aa8d1ea448a3192f52f997203708b6714c8e6d'
|
||||
'3d8fa528eb712164d065dc0d92efe0699c5db4c6ed0c0d4464ea3c96152baa8e'
|
||||
'a4b50820f58c4469c8daaad09f8e03a6a5e52cfc9a1516cf889d1ffb25003604'
|
||||
'a52800cf08a67ca685e0943c5e6746b984904e7176a5897813ffa2f78314c367'
|
||||
'26d01bd0830ebefa90e70627ba8983f98ec7b30cb3f973e1d9d2d53295dff03a')
|
||||
|
||||
+22
-3
@@ -294,7 +294,13 @@ Main2() {
|
||||
[ $show_failed = yes ] && rankmirrors_opt+=(--show-failed)
|
||||
[ $parallel = yes ] && rankmirrors_opt+=(-p)
|
||||
|
||||
echo2 -n "==> Ranking mirrors ... "
|
||||
case "$progress_mode" in
|
||||
mirrors) echo2 "==> Ranking mirrors:" ;;
|
||||
dots) echo2 -n "==> Ranking mirrors " ;;
|
||||
none) ;;
|
||||
*) DIE "--progress-mode: value '$progress_mode' not supported" ;;
|
||||
esac
|
||||
rankmirrors_opt+=(--progress-mode "$progress_mode")
|
||||
{
|
||||
# shellcheck disable=SC2016
|
||||
ranked_out=$(create-ml-rankmirrors-arch "${rankmirrors_opt[@]}" "$tmplist" | column -t -s'|' | sed 's|/lastupdate|/$repo/os/$arch|')
|
||||
@@ -315,7 +321,11 @@ Main2() {
|
||||
echo "$ranked_out"
|
||||
fi
|
||||
} > "$mirrorlist"
|
||||
echo2 " done."
|
||||
case "$progress_mode" in
|
||||
mirrors) echo2 "==> Mirror ranking done." ;;
|
||||
dots) echo2 " done." ;;
|
||||
none) ;;
|
||||
esac
|
||||
else
|
||||
local msg_not_ranked="NOTE: this mirrorlist was NOT ranked due to unavailable internet connection."
|
||||
local msg_not_ranked2="We strongly recommend to rank it soon."
|
||||
@@ -451,6 +461,13 @@ Parameters() {
|
||||
--timeout-mirror) TIMEOUT_MIRROR="$2"; shift ;;
|
||||
--time-format) time_format="$2"; shift; TimeFormatCheck ;;
|
||||
--conf-name) echo "$configfile"; exit 0 ;;
|
||||
--progress-mode) progress_mode="$2"
|
||||
case "$progress_mode" in
|
||||
dots|mirrors|none) ;;
|
||||
*) DIE "--progress-mode: '$progress_mode' is not supported"
|
||||
esac
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
cat <<EOF >&2
|
||||
Usage: $progname [options]
|
||||
@@ -483,6 +500,7 @@ Options: --help, -h This help.
|
||||
--timeout-mirror='seconds' Max time to rank before timing out a mirror. Default: $timeout_mirror_def.
|
||||
--prefs='regexp-list' List of preferred mirrors as regexps for grep (advanced).
|
||||
Use single quotes around the list. Separate items by a space.
|
||||
--progress-mode=* Show mirror ranking progress with 'dots' (default), 'mirrors', or 'none'.
|
||||
--conf-name Show the name of the config file and exit.
|
||||
Tip: you can modify the config file contents with your favorite editor, for example:
|
||||
kate \$($progname --conf-name)
|
||||
@@ -512,12 +530,13 @@ Main() {
|
||||
local -r configfile="/etc/$progname.conf"
|
||||
local -r recommended_countries="/etc/${progname}-recommended-cc.conf"
|
||||
local -r stored_country_file="/etc/${progname}-saved-cc.conf"
|
||||
local progress_mode=dots
|
||||
|
||||
local -r sep="&"
|
||||
local OPTS=""
|
||||
OPTS+="help${sep}h,http,nolocal,offline,save,savefile:,no-recommended-countries,rsync,sequential"
|
||||
OPTS+=",user-countries,fake-country:,verbose${sep}v,dump-options,dump-ccs,update-supports,prefs:,issue-test"
|
||||
OPTS+=",use-saved-cc,timeout-mirror:,countries:${sep}c:,show-failed,conf-name"
|
||||
OPTS+=",use-saved-cc,timeout-mirror:,countries:${sep}c:,show-failed,conf-name,progress-mode:"
|
||||
OPTS+=",time-format:"
|
||||
|
||||
local -r user_fav_countries=$HOME/user-countries.txt
|
||||
|
||||
@@ -57,6 +57,7 @@ Options:
|
||||
-v, --verbose be verbose in output
|
||||
-w, --working-only only output mirrors that respond within the timeout
|
||||
-V, --version display version information and exit
|
||||
--progress-mode <val> display ranking progress with 'dots' (default), 'mirrors', or 'none'
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
@@ -203,6 +204,10 @@ while [[ $1 ]]; do
|
||||
show-failed) SHOW_FAILED=1; shift ;;
|
||||
version) version ;;
|
||||
working-only) WORKING_ONLY=1; shift ;;
|
||||
progress-mode)
|
||||
[[ $2 ]] || err "Must specify 'dots', 'mirrors', or 'none'";
|
||||
PROGRESS_MODE="$2"
|
||||
shift 2 ;;
|
||||
*) err "'$1' is an invalid argument." ;;
|
||||
esac
|
||||
elif [[ ${1:0:1} = - ]]; then
|
||||
@@ -284,7 +289,12 @@ fi
|
||||
|
||||
get_url_time() {
|
||||
server=$1
|
||||
echo -n "." >&2
|
||||
case "$PROGRESS_MODE" in
|
||||
mirrors) echo " -> ${server%/lastupdate}" >&2 ;;
|
||||
dots) echo -n "." >&2 ;;
|
||||
none) ;; # show no progress indicator
|
||||
*) ;; # ignore unsupported value
|
||||
esac
|
||||
url="$(getfetchurl "$server")"
|
||||
[[ $url = fail ]] && err "URL '$server' is malformed."
|
||||
if time=$(gettime "$url") ; then #|| ! [[ $WORKING_ONLY ]]; then
|
||||
@@ -307,7 +317,7 @@ tmpfile=$(mktemp)
|
||||
if [[ $PARALLEL ]]; then
|
||||
servers=()
|
||||
# Exports for GNU parallel
|
||||
export MAX_TIME ARCH TARGETREPO VERBOSE SHOW_FAILED TIMESONLY WORKING_ONLY tmpfile
|
||||
export MAX_TIME ARCH TARGETREPO VERBOSE SHOW_FAILED PROGRESS_MODE TIMESONLY WORKING_ONLY tmpfile
|
||||
export -f getfetchurl gettime get_url_time
|
||||
fi
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ _create_ml_() {
|
||||
--fake-country) _create_ml_complete "$(_create_ml_list_ccs)" ;;
|
||||
--timeout-mirror) _create_ml_complete_nr ;;
|
||||
--time-format) COMPREPLY=($(compgen -W "datetime epoch" -- "$cur")) ;;
|
||||
--progress-mode) COMPREPLY=($(compgen -W "dots mirrors none" -- "$cur")) ;;
|
||||
*)
|
||||
# Handle all top-level parameters.
|
||||
case "$cur" in
|
||||
|
||||
Reference in New Issue
Block a user