diff options
author | Mikhail Velichko | 2022-07-19 12:07:07 +0300 |
---|---|---|
committer | Mikhail Velichko | 2022-07-19 12:07:07 +0300 |
commit | 2bf84a6e871a1315be2ca20f94448a84fefd655f (patch) | |
tree | c2dc39f4dd2fe010c30b36997f7c39381963a738 | |
parent | 755cb96eff8f967eae53e33407bdb52ac5622455 (diff) | |
download | aur-2bf84a6e871a1315be2ca20f94448a84fefd655f.tar.gz |
Version 3.2: add show-location-info script from EOS Bash shared
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 8 | ||||
-rwxr-xr-x | show-location-info | 80 |
3 files changed, 89 insertions, 3 deletions
@@ -1,6 +1,6 @@ pkgbase = reflector-simple pkgdesc = Simple GUI wrapper for 'reflector'. - pkgver = 3.1 + pkgver = 3.2 pkgrel = 1 url = https://github.com/endeavouros-team/PKGBUILDS/tree/master/reflector-simple arch = any @@ -21,6 +21,7 @@ pkgbase = reflector-simple source = mirrorlist-rank-info source = latest-arch-mirrorlist source = reflector-simple.svg + source = show-location-info sha512sums = f8b969e39a78edf16ffdf87086892e3b0256ca71ec0fce25695974528a8ac32d6ec126e21a9c72bb9512f30de2bee2bae8c4304593e6993b71bbdf93d8fd2d3f sha512sums = ac9d9313d85e3f90b7a5b1e9daa4bb16bfac4329336bc4a1e3924633a3c249c63c28603f35ede7f030a09cf52591d23fb2b0bdde7f2dbb4292855897220e54c2 sha512sums = aa149c8fc273e6a9fb5ddc38bde8a37b8fb095ec8877a324b957be57e156ef583adbed5988f0184ef06d5d09ec13e01e4a58b81fffef5d6d316405a3881895c3 @@ -28,5 +29,6 @@ pkgbase = reflector-simple sha512sums = c56090338b01f6eb251e3250d69d32c2b96c8393ebe921896de3ad1bd5c622c01ae637a09c6d0d0aa40e71d55be608a8d77066be05929d586723e79e0f24002c sha512sums = 84fbd6a973dadaa8c11ddfb8ed505a332a8788f0d5e43cfcf234bba0441c0e4dde2534acb7ddbdf8d1422a2f57491ee79485ab4f7ebf4e6cf9d00aa12edb894b sha512sums = 1d904cf0b7ae64052f70a77ff3a102e8741b54cd4bf81fce25eef2c3d475291aa79a3c8c39d63b13e28753d33ed4b0106bd896cd50952c26a7c79cbf5795157f + sha512sums = be1a4eae09bde1666ad1cef7acfa310edf9dd2a4659fc7bde6da115b8f89ab0020993ea315025fae7b3ce34284d40eaae6378242ef46dda9aec4997ec2339334 pkgname = reflector-simple @@ -4,7 +4,7 @@ pkgname=reflector-simple pkgdesc="Simple GUI wrapper for 'reflector'." -pkgver=3.1 +pkgver=3.2 pkgrel=1 arch=('any') license=('GPL') @@ -31,6 +31,7 @@ source=( mirrorlist-rank-info latest-arch-mirrorlist $pkgname.svg + show-location-info ) sha512sums=('f8b969e39a78edf16ffdf87086892e3b0256ca71ec0fce25695974528a8ac32d6ec126e21a9c72bb9512f30de2bee2bae8c4304593e6993b71bbdf93d8fd2d3f' 'ac9d9313d85e3f90b7a5b1e9daa4bb16bfac4329336bc4a1e3924633a3c249c63c28603f35ede7f030a09cf52591d23fb2b0bdde7f2dbb4292855897220e54c2' @@ -38,7 +39,9 @@ sha512sums=('f8b969e39a78edf16ffdf87086892e3b0256ca71ec0fce25695974528a8ac32d6ec '8b101caac9f38238d30f293176a09f1bb483ec1cdc474ef126ec087a8b548b50eee5c35617f0616dd1618e4dce72e14b70270f47658577e20e04a133405510aa' 'c56090338b01f6eb251e3250d69d32c2b96c8393ebe921896de3ad1bd5c622c01ae637a09c6d0d0aa40e71d55be608a8d77066be05929d586723e79e0f24002c' '84fbd6a973dadaa8c11ddfb8ed505a332a8788f0d5e43cfcf234bba0441c0e4dde2534acb7ddbdf8d1422a2f57491ee79485ab4f7ebf4e6cf9d00aa12edb894b' - '1d904cf0b7ae64052f70a77ff3a102e8741b54cd4bf81fce25eef2c3d475291aa79a3c8c39d63b13e28753d33ed4b0106bd896cd50952c26a7c79cbf5795157f') + '1d904cf0b7ae64052f70a77ff3a102e8741b54cd4bf81fce25eef2c3d475291aa79a3c8c39d63b13e28753d33ed4b0106bd896cd50952c26a7c79cbf5795157f' + 'be1a4eae09bde1666ad1cef7acfa310edf9dd2a4659fc7bde6da115b8f89ab0020993ea315025fae7b3ce34284d40eaae6378242ef46dda9aec4997ec2339334' + ) package() { cd $srcdir @@ -53,6 +56,7 @@ package() { 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 -Dm755 show-location-info $pkgdir/usr/bin/show-location-info install -Dm644 $pkgname.svg $pkgdir/usr/share/pixmaps/$pkgname.svg install -Dm644 $pkgname.conf $pkgdir/etc/$pkgname.conf diff --git a/show-location-info b/show-location-info new file mode 100755 index 000000000000..3f6f1bb2a831 --- /dev/null +++ b/show-location-info @@ -0,0 +1,80 @@ +#!/bin/bash + +# Show (a short piece of) information related to current location. +# Use a keyword to specify what info to show. + +DIE() { + echo "==> $progname: error: $1" + exit 0 +} + +Options() { + local opts + local lopts="help,timeout:" + local sopts="ht:" + + opts="$(/usr/bin/getopt -o=$sopts --longoptions $lopts --name "$progname" -- "$@")" || { + Options -h + return 1 + } + + eval set -- "$opts" + + while true ; do + case "$1" in + -t | --timeout) timeout="$2" ; shift ;; + -h | --help) + cat <<EOF >&2 +$progname - show info about your current location + +Usage: $progname [options] [location-item] + +Location-item: one of + ${items[*]} +Location-item defaults to showing all available info. + +Options: + -h, --help This help. + -t, --timeout Max number of seconds to wait for a response from + $infourl (default: $timeout_default). +EOF + exit 0 + ;; + + --) shift ; break ;; + esac + shift + done + + item="$1" + + local it + for it in "${items[@]}" ; do + [ "$item" = "$it" ] && break + done + + [ "$item" = "$it" ] || DIE "item name must be one of: ${items[*]}" + [ -n "$timeout" ] || DIE "given timeout value cannot be empty" +} + +Main() { + local progname="$(basename "$0")" + + # default values + local timeout_default=30 + local timeout=$timeout_default + local item="" + + # supported values + local items=(city country hostname ip loc org postal region timezone "") # "" means: all + + # info source + local infourl=https://ipinfo.io + + Options "$@" + + # show the wanted location info + echo "$(LANG=C curl -Lsm $timeout $infourl/$item)" +} + +Main "$@" |