summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorlabaman2022-07-19 09:08:33 +0300
committerlabaman2022-07-19 09:08:33 +0300
commit755cb96eff8f967eae53e33407bdb52ac5622455 (patch)
treef1b1ab9fe2a253ec27b116c981d7adc58dcd920c
parent8a1e127655a292c0e91703c0259a02c54f508f63 (diff)
downloadaur-755cb96eff8f967eae53e33407bdb52ac5622455.tar.gz
Update to version 3.1 (upstream EOS 2022.07.08 + icon fix + some dist-agnostic rework
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD41
-rwxr-xr-xlatest-arch-mirrorlist22
-rwxr-xr-xmirrorlist-rank-info137
-rwxr-xr-xreflector-simple520
-rw-r--r--reflector-simple-tool.conf42
-rw-r--r--reflector-simple.conf37
-rw-r--r--reflector-simple.desktop2
8 files changed, 304 insertions, 518 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 8d11d5407249..0cdd78d1d30f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,8 @@
pkgbase = reflector-simple
pkgdesc = Simple GUI wrapper for 'reflector'.
- pkgver = 2.0
- pkgrel = 2
- url = https://gitlab.com/garuda-linux/packages/stable-pkgbuilds/reflector-simple
+ pkgver = 3.1
+ pkgrel = 1
+ url = https://github.com/endeavouros-team/PKGBUILDS/tree/master/reflector-simple
arch = any
license = GPL
depends = bash
@@ -11,11 +11,22 @@ pkgbase = reflector-simple
depends = whois
depends = geoip
depends = bind
+ optdepends = reflector-bash-completion: useful for plain reflector usage
+ backup = etc/reflector-simple.conf
+ backup = etc/reflector-simple-tool.conf
source = reflector-simple
source = reflector-simple.desktop
+ source = reflector-simple.conf
+ source = reflector-simple-tool.conf
+ source = mirrorlist-rank-info
+ source = latest-arch-mirrorlist
source = reflector-simple.svg
- sha512sums = ace126e97637fbe7a4a196485f2ccbf004f9b585bfab0d0360f1caf97594ebdb3533e80a6364a4d5dc2ceff242f6df6f2d14ddd30560037dd169ec392ce401c8
- sha512sums = b3b6d69a9af877e02d07620d2df085d72811d5ac55d1e2a5ca3fab03663849be3054fde2c026da98cb630a77ea0912423aa40932361bd24d24e15f9fb8835ca2
+ sha512sums = f8b969e39a78edf16ffdf87086892e3b0256ca71ec0fce25695974528a8ac32d6ec126e21a9c72bb9512f30de2bee2bae8c4304593e6993b71bbdf93d8fd2d3f
+ sha512sums = ac9d9313d85e3f90b7a5b1e9daa4bb16bfac4329336bc4a1e3924633a3c249c63c28603f35ede7f030a09cf52591d23fb2b0bdde7f2dbb4292855897220e54c2
+ sha512sums = aa149c8fc273e6a9fb5ddc38bde8a37b8fb095ec8877a324b957be57e156ef583adbed5988f0184ef06d5d09ec13e01e4a58b81fffef5d6d316405a3881895c3
+ sha512sums = 8b101caac9f38238d30f293176a09f1bb483ec1cdc474ef126ec087a8b548b50eee5c35617f0616dd1618e4dce72e14b70270f47658577e20e04a133405510aa
+ sha512sums = c56090338b01f6eb251e3250d69d32c2b96c8393ebe921896de3ad1bd5c622c01ae637a09c6d0d0aa40e71d55be608a8d77066be05929d586723e79e0f24002c
+ sha512sums = 84fbd6a973dadaa8c11ddfb8ed505a332a8788f0d5e43cfcf234bba0441c0e4dde2534acb7ddbdf8d1422a2f57491ee79485ab4f7ebf4e6cf9d00aa12edb894b
sha512sums = 1d904cf0b7ae64052f70a77ff3a102e8741b54cd4bf81fce25eef2c3d475291aa79a3c8c39d63b13e28753d33ed4b0106bd896cd50952c26a7c79cbf5795157f
pkgname = reflector-simple
diff --git a/PKGBUILD b/PKGBUILD
index 1fdce2f73e07..106cd4fde93b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,23 +4,40 @@
pkgname=reflector-simple
pkgdesc="Simple GUI wrapper for 'reflector'."
-pkgver=2.0
-pkgrel=2
+pkgver=3.1
+pkgrel=1
arch=('any')
license=('GPL')
depends=(
- bash yad reflector whois geoip bind
+ bash yad reflector whois geoip bind
)
+optdepends=(
+ 'reflector-bash-completion: useful for plain reflector usage'
+)
+backup=(
+ etc/$pkgname.conf
+ etc/${pkgname}-tool.conf
+)
+
+#url=https://github.com/endeavouros-team/PKGBUILDS
+url=https://github.com/endeavouros-team/PKGBUILDS/tree/master/$pkgname
-url="https://gitlab.com/garuda-linux/packages/stable-pkgbuilds/reflector-simple"
source=(
$pkgname
$pkgname.desktop
+ $pkgname.conf
+ ${pkgname}-tool.conf
+ mirrorlist-rank-info
+ latest-arch-mirrorlist
$pkgname.svg
)
-sha512sums=('ace126e97637fbe7a4a196485f2ccbf004f9b585bfab0d0360f1caf97594ebdb3533e80a6364a4d5dc2ceff242f6df6f2d14ddd30560037dd169ec392ce401c8'
- 'b3b6d69a9af877e02d07620d2df085d72811d5ac55d1e2a5ca3fab03663849be3054fde2c026da98cb630a77ea0912423aa40932361bd24d24e15f9fb8835ca2'
+sha512sums=('f8b969e39a78edf16ffdf87086892e3b0256ca71ec0fce25695974528a8ac32d6ec126e21a9c72bb9512f30de2bee2bae8c4304593e6993b71bbdf93d8fd2d3f'
+ 'ac9d9313d85e3f90b7a5b1e9daa4bb16bfac4329336bc4a1e3924633a3c249c63c28603f35ede7f030a09cf52591d23fb2b0bdde7f2dbb4292855897220e54c2'
+ 'aa149c8fc273e6a9fb5ddc38bde8a37b8fb095ec8877a324b957be57e156ef583adbed5988f0184ef06d5d09ec13e01e4a58b81fffef5d6d316405a3881895c3'
+ '8b101caac9f38238d30f293176a09f1bb483ec1cdc474ef126ec087a8b548b50eee5c35617f0616dd1618e4dce72e14b70270f47658577e20e04a133405510aa'
+ 'c56090338b01f6eb251e3250d69d32c2b96c8393ebe921896de3ad1bd5c622c01ae637a09c6d0d0aa40e71d55be608a8d77066be05929d586723e79e0f24002c'
+ '84fbd6a973dadaa8c11ddfb8ed505a332a8788f0d5e43cfcf234bba0441c0e4dde2534acb7ddbdf8d1422a2f57491ee79485ab4f7ebf4e6cf9d00aa12edb894b'
'1d904cf0b7ae64052f70a77ff3a102e8741b54cd4bf81fce25eef2c3d475291aa79a3c8c39d63b13e28753d33ed4b0106bd896cd50952c26a7c79cbf5795157f')
package() {
@@ -29,10 +46,16 @@ package() {
sed -i $pkgname -e "s|local VERSION_INFO=.*$|local VERSION_INFO=${pkgver}-$pkgrel|"
install -d $pkgdir/usr/bin
+ install -d $pkgdir/etc
install -d $pkgdir/usr/share/applications
install -d $pkgdir/usr/share/pixmaps/
- install -Dm755 $pkgname $pkgdir/usr/bin/$pkgname
- install -Dm644 $pkgname.desktop $pkgdir/usr/share/applications/$pkgname.desktop
- install -Dm644 $pkgname.svg $pkgdir/usr/share/pixmaps/$pkgname.svg
+ install -Dm755 $pkgname $pkgdir/usr/bin/$pkgname
+ install -Dm755 latest-arch-mirrorlist $pkgdir/usr/bin/latest-arch-mirrorlist
+ install -Dm755 mirrorlist-rank-info $pkgdir/usr/bin/mirrorlist-rank-info
+ install -Dm644 $pkgname.svg $pkgdir/usr/share/pixmaps/$pkgname.svg
+
+ install -Dm644 $pkgname.conf $pkgdir/etc/$pkgname.conf
+ install -Dm644 ${pkgname}-tool.conf $pkgdir/etc/${pkgname}-tool.conf
+ install -Dm644 $pkgname.desktop $pkgdir/usr/share/applications/$pkgname.desktop
}
diff --git a/latest-arch-mirrorlist b/latest-arch-mirrorlist
new file mode 100755
index 000000000000..a1f9eda039e4
--- /dev/null
+++ b/latest-arch-mirrorlist
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Fetch the latest Arch mirrorlist.
+# Use the file as target if given, otherwise save it to /tmp.
+# Then display the full file path to stdout.
+
+Main()
+{
+ local full_list="$1"
+ local ARCH_SITE=https://www.archlinux.org
+
+ if [ -z "$full_list" ]; then
+ full_list=/tmp/arch-mirrorlist-latest.$(date +%Y-%m-%d)
+ fi
+
+ curl -Lsm 10 -o "$full_list" $ARCH_SITE/mirrorlist/all || {
+ return 1
+ }
+ echo "$full_list"
+}
+
+Main "$@"
diff --git a/mirrorlist-rank-info b/mirrorlist-rank-info
new file mode 100755
index 000000000000..0afd8a680536
--- /dev/null
+++ b/mirrorlist-rank-info
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+# Show up-to-date ranking information about the mirrors
+# in file /etc/pacman.d/mirrorlist.
+
+printf2() { printf "$@" >&2 ; }
+
+DIE() { echo "==> $progname: error: $1" >&2 ; exit 1 ; }
+WARN() { printf2 "\n==> Warning: $1\n" >&2 ; }
+
+Us2S() {
+ local us="$1"
+ local sec="$(echo "scale=6; $us / 1000000" | bc -l)"
+ [ "${sec::1}" = "." ] && sec="0$sec"
+ echo "$sec"
+}
+
+Age_Fetchtime()
+{
+ local mirror="$1" # An Arch mirror URL to folder where
+ # file 'lastupdate' exists.
+ local now="$2" # date +%s
+ local ofile=$HOME/.$file
+ local timestamp
+ local fetchtime
+ local age
+ local output
+
+ [ -n "$mirror" ] || DIE "parameter 'mirror' missing"
+ [ -n "$now" ] || now=$(date +%s)
+
+ IFS=' ' output=($(curl -Lsm 10 -w "%{time_total} %{http_code}" "$mirror"/$file -o$ofile))
+ case "$?" in
+ 0)
+ case "${output[1]}" in
+ ""|301|302) echo "fail" ; return 1 ;;
+ *)
+ if [ "${output[1]}" -ge 400 ] ; then
+ echo "fail"
+ return 1
+ fi
+ ;;
+ esac
+ ;;
+ *) echo "fail" ; return 1 ;;
+ esac
+
+ #fetchtime="$(Us2S ${output[0]})"
+ fetchtime="${output[0]}"
+
+ timestamp="$(cat $ofile)"
+ rm -f $ofile
+
+ if [ -n "$timestamp" ] ; then
+ age=$((now - timestamp))
+ output="$age|$fetchtime"
+ else
+ output="fail"
+ fi
+ echo "$output"
+}
+
+ShowLines() {
+ # Testing material:
+ # echo "atest1 110 0.50000"
+ # echo "atest2 10000 0.010000"
+
+ echo "Mirror Age(sec) Rate(sec)"
+ echo "~~~~~~ ~~~~~~~~ ~~~~~~~~~" # for sorting: tilde (~) is after Z in ascii table
+ for line in "${results[@]}" ; do
+ echo "$line"
+ done
+}
+
+Options() {
+ local arg
+ for arg in "$@" ; do
+ case "$arg" in
+ --age) sort=age ;;
+ --rate) sort=rate ;;
+ --help | -h) Usage ; exit 0 ;;
+ esac
+ done
+}
+Usage() {
+ cat <<EOF
+Usage: $progname [options]
+options:
+ --age Sorting precedence: 'age' over 'rate'.
+ --rate Sorting precedence: 'rate' over 'age'.
+ --help | -h This help.
+EOF
+}
+
+Main() {
+ export LC_ALL=C
+ local progname="$(basename "$0")"
+ local mlfile=/etc/pacman.d/mirrorlist
+
+ local mirrors="$(grep "^Server = " $mlfile | awk '{print $NF}' | sed 's|/$repo/os/$arch$||')"
+ local mirror m
+ local now=$(date +%s)
+ local result age fetchtime
+ local results=()
+ local sort=age
+ local file=lastupdate
+ local line
+ local ix=0
+ local count="$(echo "$mirrors" | wc -l)"
+
+ printf2 "Show up-to-date ranking information about mirrors in file $mlfile.\n"
+
+ Options "$@"
+
+ printf2 "==> Use option --help for more info.\n"
+
+ for mirror in $mirrors ; do
+ printf2 "\r==> %d/%d ranking..." "$((++ix))" "$count"
+ result="$(Age_Fetchtime "$mirror" "$now")"
+ if [ "$result" != "fail" ] ; then
+ age=$( echo "$result" | cut -d '|' -f1)
+ fetchtime=$(echo "$result" | cut -d '|' -f2)
+ m="$mirror"'/$repo/os/$arch'
+ results+=("$m $age $fetchtime")
+ else
+ WARN "fetching file '$mirror/$file' failed."
+ fi
+ done
+ printf2 "\n==> Sorting by %s.\n\n" "$sort"
+
+ case "$sort" in
+ age) ShowLines | sort -n -k2,2 -k3,3 | column -t ;;
+ rate) ShowLines | sort -n -k3,3 -k2,2 | column -t ;;
+ esac
+}
+
+Main "$@"
diff --git a/reflector-simple b/reflector-simple
index b5f7d7483b06..97ec179283a1 100755
--- a/reflector-simple
+++ b/reflector-simple
@@ -3,6 +3,9 @@
# Select pacman mirrors with a simple GUI.
#
+#source /usr/share/endeavouros/scripts/eos-script-lib-yad || exit 1
+#export -f eos_yad
+# EOS script lib function implementation for some dist-agnostic
EOS_ROOTER=pkexec
export EOS_YAD_STARTER_CMD="/usr/bin/yad --window-icon=update"
@@ -10,443 +13,6 @@ eos_yad() {
GDK_BACKEND=x11 $EOS_YAD_STARTER_CMD "$@" | grep -v "^WINDOW DECORATIONS RELOADED$"
return ${PIPESTATUS[0]}
}
-#export -f eos_yad
-
-eos_GetArch() {
- local arch="$(/usr/bin/uname -m)"
- case "$arch" in
- armv7* | aarch64) arch=armv7h ;;
- esac
- printf "%s" "$arch"
-}
-
-eos_GetProgName() { /usr/bin/basename "$0" ; }
-
-eos_select_browser() {
- # Select an existing browser.
- # User may export a variable _WELCOME_BROWSER to use the preferred browser.
-
- if [ -n "$_WELCOME_BROWSER" ] ; then
- echo "$_WELCOME_BROWSER"
- return
- fi
-
- local browser
- for browser in xdg-open exo-open firefox chromium vivaldi-stable opera ; do
- if (/usr/bin/which "$browser" >& /dev/null) ; then
- echo "$browser"
- return
- fi
- done
- eos_yad_WARN "$FUNCNAME: cannot find a browser"
-}
-
-eos_yad_terminal() {
- local conf=/etc/eos-script-lib-yad.conf
- if [ -r $conf ] ; then
- source $conf
- if [ -n "$EOS_YAD_TERMINAL" ] ; then
- if [ -x /usr/bin/"$EOS_YAD_TERMINAL" ] || [ -x "$EOS_YAD_TERMINAL" ] ; then
- echo "$EOS_YAD_TERMINAL"
- return
- fi
- echo "Sorry, terminal program '$EOS_YAD_TERMINAL' is not available. Please check your configuration file $conf." | \
- eos_yad --text-info --title=Warning --height=100 --width=500 --wrap --button=yad-ok:0
- fi
- fi
-
- # Show a terminal that is capable of supporting option -e properly. Empty if not found.
- # Requires: yad
- #
- # These terminal programs are known not to work with this program:
- # - putty
- # The following terminals are known to work:
- local suitable_terminals=(
- xfce4-terminal
- konsole
- gnome-terminal
- mate-terminal
- lxterminal
- deepin-terminal
- terminator
- qterminal
- alacritty
- tilix
- termite
- xterm
- kitty
- terminology
- sakura
- )
- local eos_terminal_prog=""
- local xx
-
- for xx in "${suitable_terminals[@]}" ; do
- if [ -x "/usr/bin/$xx" ] ; then
- eos_terminal_prog="/usr/bin/$xx"
- echo "$eos_terminal_prog"
- return 0
- fi
- done
-
- printf "%s\n %s\n%s" \
- "Sorry, none of the terminal programs:" \
- "${suitable_terminals[*]}" \
- "is installed. Some features may not work as expected." \
- | eos_yad --text-info \
- --title="Warning" --height=200 --width=700 --wrap --button=yad-ok:0
- return 1
-}
-
-eos_yad_check_internet_connection() {
- local verbose="$1" # yes|verbose = show dialog, otherwise don't show dialog
- local waitrounds="$2" # try max $waitrounds times for a connection, test once per $onewait
- local onewait="$3" # time to wait in one waiting round
- local caller="$4" # who is calling this function (often empty)
- local ix
- local title="Warning"
- local checker="ping -c 1 8.8.8.8"
-
- case "$EOS_CONNECTION_CHECKER" in
- curl)
- # checker="curl --silent --connect-timeout 8 https://8.8.8.8"
- checker=/usr/bin/eos-connection-checker
- ;;
- esac
-
- test -z "$verbose" && verbose=no
- test -z "$waitrounds" && waitrounds=5
- test -z "$onewait" && onewait=1s
-
- if [ -n "$caller" ] ; then
- title+=" at $caller"
- fi
-
- for ((ix=0; ix<waitrounds; ix++)) ; do
- $checker >/dev/null && return 0 # is connected
- sleep $onewait
- done
-
- $checker >/dev/null || {
- case "$verbose" in
- [yY]*|1|true|TRUE|True|on|enable*|verbose)
- echo "No internet connection!" | \
- eos_yad --text-info --title="$title" \
- --height=100 --width=300 --justify=center --wrap \
- --button=yad-quit:1 \
- --button=" Continue anyway!go-next!Don't stop me now":0
- ;;
- *)
- return 1
- ;;
- esac
- }
-}
-
-eos_yad_GetArgVal() {
- echo "${1#*=}"
- #e cho "$1" | cut -d '=' -f 2
-}
-
-eos_yad_RunCmdTermBashOpt() { # like eos_yad_RunCmdTermBash, but supports certain options
- local cmd=""
- local prompt=""
- local termopts=""
- local waitopt=""
- local opts
-
- # Handle options for variables cmd ... waitopt.
- opts="$(getopt -o=p:t:w:E --longoptions prompt:,term:,wait:,no-enter-wait --name "$FUNCNAME" -- "$@")"
- [ $? -eq 0 ] || return 1
- eval set -- "$opts"
- while true ; do
- case "$1" in
- --prompt | -p)
- prompt="$2" ; shift ;;
- --term | -t)
- termopts="$2" ; shift ;; # e.g. --term="-T 'my title' --geometry=100x200"
- --wait | -w)
- waitopt="$2" ; shift ;; # e.g. --wait="--no-enter-wait"
- --no-enter-wait | -E)
- waitopt="--no-enter-wait" ;; # alternative to --wait
- --)
- shift; break ;;
- esac
- shift
- done
- cmd="$*"
- [ -n "$cmd" ] || { echo "$FUNCNAME: warning: required command is missing." >&2; return 1; }
-
- # Get the available/configured terminal.
- local term="$(eos_yad_terminal)"
- test -n "$term" || return 1
-
- mkdir -p "$HOME/.cache"
- local tmpfile=$(mktemp "$HOME/.cache/$FUNCNAME.XXXXX")
-
- echo "#!/bin/bash" >> $tmpfile
- test -n "$prompt" && echo "echo $prompt" >> $tmpfile
- echo "$cmd" >> $tmpfile
- echo "echo" >> $tmpfile
- case "$term" in
- /usr/bin/deepin-terminal | deepin-terminal) ;;
- *)
- _init_translations
- if [ "$waitopt" != "--no-enter-wait" ] ; then
- echo "read -p '$(ltr updt_press_enter): '" >> $tmpfile
- fi
- ;;
- esac
- echo "rm -f $tmpfile" >> $tmpfile # this may cause issues in very special cases!
-
- chmod +x $tmpfile
-
- # Try make sure terminal $term does not return to the caller immediately
- # but waits until the commands from $tmpfile are executed.
- case "$term" in
- /usr/bin/gnome-terminal | gnome-terminal)
- $term $termopts --wait -- $tmpfile ;;
- /usr/bin/xfce4-terminal | xfce4-terminal)
- $term --disable-server $termopts -e $tmpfile ;;
- *)
- $term $termopts -e $tmpfile ;;
- esac
-
- # The following DOES NOT WORK with plain gnome-terminal:
- #echo "Deleting '$tmpfile'."
- #rm -f $tmpfile
-}
-
-eos_yad_RunCmdTermBash() {
- local cmd="$1"
- local prompt="$2"
- local termopts="$3"
- local waitopt="$4"
-
- eos_yad_RunCmdTermBashOpt --prompt="$prompt" --term="$termopts" --wait="$waitopt" "$cmd"
-}
-
-eos_yad_problem() {
- local title="$1"
- shift
- eos_yad --text-info --title="$title" --wrap --image=error \
- --width=700 --height=500 --button=yad-quit:0 "$@"
- # removed --tail
-}
-
-eos_yad_DIE() {
- # This function is only for small messages.
- # The local Usage can be used only if it is
- # - defined before sourcing this file
- # - exported
-
- local msg="$1"
- local title="Error"
- shift
- while true ; do
- echo "$msg"
- # run Usage function if available (usually is not ...)
- test -n "$(declare -F | grep -w '^declare -f Usage$')" && Usage
- break
- done | eos_yad_problem "$title" "$@"
- exit 1
-}
-
-eos_yad_WARN() {
- local msg="$1"
- local title="Warning"
- shift
- echo "$msg" | eos_yad_problem "$title" --image=dialog-warning "$@"
-}
-
-# Function detectDE is copied from: https://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-utils-common.in
-
-#--------------------------------------
-# Checks for known desktop environments
-# set variable DE to the desktop environments name, lowercase
-
-eos_yad__detectDE()
-{
- # see https://bugs.freedesktop.org/show_bug.cgi?id=34164
- unset GREP_OPTIONS
-
- if [ -n "${XDG_CURRENT_DESKTOP}" ]; then
- case "${XDG_CURRENT_DESKTOP}" in
- # only recently added to menu-spec, pre-spec X- still in use
- Budgie*)
- DE=budgie
- ;;
- Cinnamon|X-Cinnamon)
- DE=cinnamon;
- ;;
- DEEPIN|[Dd]eepin)
- DE=deepin;
- ;;
- ENLIGHTENMENT|Enlightenment)
- DE=enlightenment;
- ;;
- # GNOME, GNOME-Classic:GNOME, or GNOME-Flashback:GNOME
- GNOME*|gnome)
- DE=gnome;
- ;;
- KDE)
- DE=kde;
- ;;
- LXDE)
- DE=lxde;
- ;;
- LXQt)
- DE=lxqt;
- ;;
- MATE)
- DE=mate;
- ;;
- XFCE)
- DE=xfce
- ;;
- X-Generic)
- DE=generic
- ;;
- i3)
- DE=i3
- ;;
- esac
- fi
-
- if [ x"$DE" = x"" ]; then
- # classic fallbacks
- if [ x"$KDE_FULL_SESSION" != x"" ]; then DE=kde;
- elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
- elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate;
- elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
- elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
- elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce
- elif echo $DESKTOP | grep -q '^Enlightenment'; then DE=enlightenment;
- elif [ x"$LXQT_SESSION_CONFIG" != x"" ]; then DE=lxqt;
- fi
- fi
-
- if [ x"$DE" = x"" ]; then
- # fallback to checking $DESKTOP_SESSION
- case "$DESKTOP_SESSION" in
- gnome)
- DE=gnome;
- ;;
- LXDE|Lubuntu)
- DE=lxde;
- ;;
- MATE)
- DE=mate;
- ;;
- xfce|xfce4|'Xfce Session')
- DE=xfce;
- ;;
- openbox)
- DE=openbox
- ;;
- esac
- fi
-
- if [ x"$DE" = x"" ]; then
- # fallback to uname output for other platforms
- case "$(uname 2>/dev/null)" in
- CYGWIN*)
- DE=cygwin;
- ;;
- Darwin)
- DE=darwin;
- ;;
- esac
- fi
-
- if [ x"$DE" = x"gnome" ]; then
- # gnome-default-applications-properties is only available in GNOME 2.x
- # but not in GNOME 3.x
- which gnome-default-applications-properties > /dev/null 2>&1 || DE="gnome3"
- fi
-
- if [ -f "$XDG_RUNTIME_DIR/flatpak-info" ]; then
- DE="flatpak"
- fi
-
- if [ -z "$DE" ] ; then
- # neofetch fails: Enlightenment, openbox
- # neofetch differs: KDE -> plasma (with DESKTOP_SESSION=openbox-kde and DESKTOP_SESSION=plasma)
- [ -x /usr/bin/neofetch ] && DE="$(neofetch --enable de --de_version off | awk '{print $NF}' | tr [:upper:] [:lower:])"
- fi
-}
-
-eos_yad_GetDesktopName() { # return DE name in uppercase letters
- local de=$(eos_yad__detectDE && echo "$DE" | tr '[:lower:]' '[:upper:]')
- echo "$de"
-}
-
-eos_IsSway() {
- case "$DESKTOP_SESSION" in
- sway | */sway) return 0 ;;
- esac
- case "$XDG_SESSION_DESKTOP" in
- sway | */sway) return 0 ;;
- esac
- [ -x /usr/bin/swaybg ] && return 0
- return 1
-}
-
-eos_IsBspwm() {
- case "$DESKTOP_SESSION" in
- bspwm | */bspwm) return 0 ;;
- esac
- case "$XDG_SESSION_DESKTOP" in
- bspwm | */bspwm) return 0 ;;
- esac
- [ -x /usr/bin/bspwm ] && return 0
- return 1
-}
-
-eos_GetDeOrWm() {
- local de="$(eos_yad_GetDesktopName)"
- if [ "$de" = "" ] ; then
- if (eos_IsSway) ; then
- de=SWAY
- elif (eos_IsBspwm) ; then
- de=BSPWM
- fi
- fi
- echo "$de"
-}
-
-# DIE() { eos_yad_DIE "$@" ; } # deprecated
-# WARN() { eos_yad_WARN "$@" ; } # deprecated
-
-#SetBrowser() {
-# local xx
-# for xx in xdg-open exo-open firefox chromium ; do # use one of these browser commands
-# if [ -x /usr/bin/$xx ] ; then
-# _BROWSER=/usr/bin/$xx # for showing external links
-# return
-# fi
-# done
-# DIE "$FUNCNAME: cannot find a browser"
-#}
-
-eos_yad_nothing_todo() {
- local text="$1"
- local timeout="$2" # optional, default set below
- local title="$3" # optional, default set below
- local image="$4" # optional, default set below
-
- [ -n "$timeout" ] || timeout=10
- [ -n "$title" ] || title="Info"
- [ -n "$image" ] || image=info
-
- local cmd=(
- eos_yad --form --text="$text" --title="$title" --no-focus
- --height=100 --width=300 --timeout=$timeout --timeout-indicator=left
- --button=yad-close:0
- )
- "${cmd[@]}"
-}
-
FindAvailableMonoFont() {
local size="$1"
@@ -468,51 +34,6 @@ FindAvailableMonoFont() {
echo "$font $size"
}
-ProgressBar() { # This function was converted from the work of @Kresimir, thanks!
- local msg="$1"
- local percent="$2"
- local barlen="$3"
- local c
- local columns="$COLUMNS" # nr of columns on the terminal
- [ -n "$columns" ] || columns=80 # guess nr of columns on the terminal
- local msglen=$((columns - barlen - 9)) # max space for the msg
- [ "${#msg}" -gt "$msglen" ] && msg="${msg::$msglen}" # msg must be truncated
- [ "${msg: -1}" = ":" ] || msg+=":" # make sure a colon is after msg
-
- printf "\r%-*s %3d%% [" "$msglen" "$msg" $percent >&2
- for ((c = 0; c < $barlen; c++)) ; do
- if (( $c <= $percent * $barlen / 100 )); then
- echo -ne "#" >&2
- else
- echo -ne " " >&2
- fi
- done;
- stdbuf -oL printf "]" >&2 # flush stdout
-}
-ProgressBarInit() {
- # progress bar initialization
- trap 'printf "\x1B[?25h" >&2' EXIT # cursor on
- printf "\x1B[?25l" >&2 # cursor off
-}
-ProgressBarEnd() {
- printf "\n" >&2
-}
-
-YadProgressPulsate() {
- local lockfile="$1"
- local text="$2"
-
- while true ; do
- [ -r "$lockfile" ] || return
- echo 0
- sleep 0.1s
- done | eos_yad --progress \
- --title="Progress indicator" \
- --text="$text" \
- --auto-close \
- --width=400 --hide-text --pulsate
-}
-
eos_FormMonoText() {
local txt="$1"
local size="$2" # optional
@@ -520,23 +41,9 @@ eos_FormMonoText() {
[ -n "$size" ] && size=" $size"
printf "<span font='Mono$size'>%s</span>" "$txt"
}
-
-# check the config:
-case "$EOS_ROOTER" in
- su | "su -c" | "/usr/bin/su -c" | "") export EOS_ROOTER="eos-run-cmd-with-su" ;; # default!
- sudo | "sudo bash -c" | "/usr/bin/sudo bash -c") export EOS_ROOTER="sudo bash -c" ;;
- pkexec | "pkexec bash -c" | "/usr/bin/pkexec bash -c") export EOS_ROOTER="/usr/bin/pkexec bash -c" ;;
- su-c_wrapper) export EOS_ROOTER="/usr/bin/su-c_wrapper bash -c" ;;
- *)
- eos_yad_DIE "Error: configuration '$EOS_ROOTER' for EOS_ROOTER in file /etc/eos-script-lib-yad.conf is not supported!"
- ;;
-esac
-
-
-export -f eos_yad
-export -f eos_yad_terminal
-export -f eos_yad_RunCmdTermBash
-
+#export -f eos_yad_terminal
+#export -f eos_yad_RunCmdTermBash
+# End of EOS lib function implementation
DIE() {
eos_yad --form --width=400 --title="reflector-simple problem" --image=error --text="$1" --button=yad-quit
@@ -579,8 +86,7 @@ CCCheck() { # check validity of country code
}
Method0() {
- # use https://ipinfo.io/country
- local code="$(curl -Lsm 10 https://ipinfo.io/country)"
+ local code="$(show-location-info country)"
CCCheck "$code"
}
Method1() {
@@ -943,17 +449,23 @@ AskCountriesAndOptions() {
else
command+=(--field="Max number of freshest mirrors":num $default_number) # --latest
fi
+ command+=(--field="Download timeout in seconds":num 5) # --download-timeout
local free_params=""
if [ -r "$free_params_file" ] ; then
free_params="$(/usr/bin/cat "$free_params_file" | tr '\n' ' ')"
fi
command+=(--field="Optional reflector params" " $free_params") # note the initial space in value !!!
+
+ command+=(--button="Changelog!applications-development!reflector-simple changelog":2 --button=yad-cancel:1 --button=yad-ok:0)
Verbose "done."
reflector_info="$("${command[@]}")"
case "$?" in
1) Destructor ; exit 1 ;;
+ 2)
+ $(eos_select_browser) $(eos-github2gitlab https://github.com/endeavouros-team/PKGBUILDS/commits/master/reflector-simple)
+ Destructor ; exit 0 ;;
esac
test -z "$(echo "$reflector_info" | tr -d ' ')" && exit 1 # stop if $reflector_info has no words
if [ "$(echo "$reflector_info" | wc -l)" != "1" ] ; then
@@ -1014,6 +526,7 @@ BuildReflectorCommand() {
else
reflector_cmd+=(--latest "${reflector_info[$((ix++))]}")
fi
+ reflector_cmd+=(--download-timeout "${reflector_info[$((ix++))]}")
# add optional free parameters to the command and save free params to file
printf "" > "$free_params_file"
@@ -1046,7 +559,7 @@ AddCountryNamesToMirrors() {
return 1
}
else
- eos-latest-arch-mirrorlist $full_list || {
+ latest-arch-mirrorlist $full_list || {
WARN "cannot fetch Arch mirror list."
rm -f $full_list
return 1
@@ -1270,8 +783,9 @@ Main() {
local ranklog=/tmp/mirror-rating.log
local progress_cmd=(
- eos_yad --progress --enable-log --log-on-top --log-expanded --image=update --image-on-top --log-height 200 --auto-close
+ eos_yad --progress --enable-log --log-on-top --log-expanded --log-height 200 --auto-close
--width=900 --no-buttons
+ --image=applications-internet
--title="Mirror ranking"
--text="Rating mirrors, please wait...\nNote: rating log will be saved in file <b>$ranklog</b>."
)
diff --git a/reflector-simple-tool.conf b/reflector-simple-tool.conf
new file mode 100644
index 000000000000..e47d613633ce
--- /dev/null
+++ b/reflector-simple-tool.conf
@@ -0,0 +1,42 @@
+# Settings for the the reflector-simple tool.
+# Note: these settings are not related to reflector.
+
+# Show country names using the number of columns defined below.
+# Increasing this value may be useful when disply resolution
+# is low, e.g. 1366x768,
+# it will automatically change the window size accordingly.
+# Value: an integer in the range of 5 to 8.
+# Default: 5
+#
+REFLECTOR_SIMPLE_COLUMNS=5
+
+# The size of reflector-simple window in pixels.
+# Adjusting the window size may help if changing
+# the number of columns above does not give optimal result.
+# The default values below should be OK for a display with
+# resolution 1366x768 and higher.
+# Defaults: width=1000, height=750
+#
+REFLECTOR_SIMPLE_WIDTH=1000
+REFLECTOR_SIMPLE_HEIGHT=750
+
+# Select the *preferred* method for finding your country code
+# in the reflector-simple app.
+# If the preferred method fails, other methods will be used.
+# For more details about the methods, see
+# - file /usr/bin/reflector-simple
+# - functions Method0 ... Method5
+# Tip: if the reflector-simple app starts very slowly,
+# test different numeric values for this variable.
+# Values: integer from 0 to 5 or "default"
+# ("default" means: try methods from 0 => 5 until success)
+# Default: default
+#
+REFLECTOR_SIMPLE_COUNTRY_METHOD=default
+
+# User *may* configure another location for the configuration file
+# that contains the reflector options.
+# Default: /etc/reflector-simple.conf
+#
+#REFLECTOR_X_CONF=/etc/reflector-simple.conf
+
diff --git a/reflector-simple.conf b/reflector-simple.conf
new file mode 100644
index 000000000000..de771bcb5534
--- /dev/null
+++ b/reflector-simple.conf
@@ -0,0 +1,37 @@
+### Default 'reflector options' for reflector-simple.
+#
+#
+# Below you'll find the *default* values
+# used by reflector-simple. The values below are shown as
+# commented out since they are the defaults.
+# These are simply options of the reflector app.
+# Use command 'reflector --help' for more info about the options.
+#
+# Note:
+# if your detected location (country) has Arch mirror(s),
+# then (by default) it will be selected in reflector-simple.
+#
+# If your country has no Arch mirrors, then you must give
+# one or more countries here or select in reflector-simple.
+#
+# Regardless of the above, you may give any selection
+# of countries here.
+
+############# Now the default values: ###############
+
+## Which protocols should be supported (https preferred):
+#--protocol https
+
+## Max number of most recently synchronized mirrors you want in the list:
+#--latest 10
+
+## How to sort the ranked mirrorlist
+## (e.g. 'rate' for speed, 'age' for newest packages):
+#--sort rate
+
+## Choose countries. By default your local country will likely be detected.
+## To see supported countries, use command 'reflector --list-countries'.
+## Examples (note the different syntaxes):
+## --country Brazil,Finland,Germany,Netherlands
+## -cBR,FI,DE,NL
+## --country CA,"United States"
diff --git a/reflector-simple.desktop b/reflector-simple.desktop
index a0cf7f810066..a33ae7f7eb7f 100644
--- a/reflector-simple.desktop
+++ b/reflector-simple.desktop
@@ -5,7 +5,7 @@ Name=Reflector Simple
Name[de]=Reflector Simple
Comment=A simple GUI for 'reflector'
Comment[de]=Eine simple GUI zum Mirror refreshen
-Comment[ru]= Простой графический интерфейс для reflector
+Comment[ru]=Простой графический интерфейс для reflector
Exec=/usr/bin/reflector-simple
Icon=reflector-simple
# StartupNotify=false