mirror of
https://github.com/endeavouros-team/eos-bash-shared.git
synced 2026-06-13 01:34:36 +00:00
[eos-bash-shared] cleanup of PKGBUILD, removed unused scripts
This commit is contained in:
Executable → Regular
@@ -1,59 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIE() {
|
||||
echo "$progname: error: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
SetBrowser() { # should use eos_select_browser() instead...
|
||||
local browser
|
||||
|
||||
for browser in $_WELCOME_BROWSER xdg-open exo-open firefox chromium vivaldi-stable opera ; do
|
||||
if [ -x /usr/bin/$browser ] ; then
|
||||
Browser=/usr/bin/$browser
|
||||
return
|
||||
fi
|
||||
done
|
||||
DIE "$FUNCNAME: cannot find a web browser"
|
||||
}
|
||||
|
||||
EosPackages() {
|
||||
wget -q -O- https://github.com/endeavouros-team/PKGBUILDS | grep ' href="/endeavouros-team/PKGBUILDS/tree/master/' | sed 's|.*/tree/master/\([^"]*\).*|\1|' | \
|
||||
grep -P -v 'z_archived|ckbcomp'
|
||||
}
|
||||
|
||||
HasPkgbuild() {
|
||||
local pkgs="$(EosPackages)"
|
||||
local pkg
|
||||
for pkg in $pkgs ; do
|
||||
if [ "$pkgname" = "$pkg" ] ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
case "$pkgname" in
|
||||
mkinitcpio-openswap)
|
||||
pkgname=openswap ; return 0 ;;
|
||||
grub-theme2-endeavouros)
|
||||
pkgname=grub-theme-endeavouros ; return 0 ;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
Main()
|
||||
{
|
||||
local pkgname="$1"
|
||||
local progname="$(basename "$0")"
|
||||
local urlbase=https://github.com/endeavouros-team/PKGBUILDS/commits/master
|
||||
local Browser=""
|
||||
|
||||
SetBrowser
|
||||
urlbase=$(eos-github2gitlab "$urlbase")
|
||||
|
||||
if (HasPkgbuild) ; then
|
||||
[ -n "$Browser" ] && $Browser "$urlbase/$pkgname" >& /dev/null
|
||||
#else
|
||||
# eos-pkginfo "$pkgname"
|
||||
fi
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
-171
@@ -1,171 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIE() {
|
||||
echo "$PROGNAME: error: $1" >&2
|
||||
Usage
|
||||
exit 1
|
||||
}
|
||||
|
||||
Helper() {
|
||||
for HELPER in paru yay ; do
|
||||
if [ -x /usr/bin/$HELPER ] ; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
DIE "AUR helper not found!"
|
||||
}
|
||||
|
||||
FindUrl() {
|
||||
# If $PKGNAME is not a package, then assume it is a file of an installed package and find the package name.
|
||||
|
||||
if (! /usr/bin/$HELPER -Q "$PKGNAME" >& /dev/null) ; then
|
||||
if (! /usr/bin/$HELPER -Si "$PKGNAME" >& /dev/null) ; then
|
||||
local item fail=no
|
||||
case "${PKGNAME::1}" in
|
||||
"/") item="$PKGNAME" ;; # file name
|
||||
*) item="/usr/bin/$PKGNAME" ;; # program name
|
||||
esac
|
||||
if [ -r "$item" ] ; then
|
||||
PKGNAME="$(LANG=C /usr/bin/$HELPER -Qo "$item" 2>/dev/null | awk '{print $(NF-1)}')"
|
||||
[ -z "$PKGNAME" ] && DIE "given name '$PKGNAME' does not refer to a package or an installed file."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
PKGINFO="$(LANG=C $HELPER -Qi "$PKGNAME" 2>/dev/null)"
|
||||
if [ -z "$PKGINFO" ] ; then
|
||||
PKGINFO="$(LANG=C $HELPER -Si "$PKGNAME" 2>/dev/null)"
|
||||
fi
|
||||
[ -n "$PKGINFO" ] || DIE "package '$PKGNAME' not found"
|
||||
}
|
||||
|
||||
IsEndeavourOSpkg() {
|
||||
local pkg="$1"
|
||||
local eos_pkg
|
||||
local eos_pkgs
|
||||
|
||||
readarray -t eos_pkgs <<< $(/usr/bin/pacman -Slq endeavouros)
|
||||
|
||||
for eos_pkg in "${eos_pkgs[@]}" ; do
|
||||
if [ "$pkg" = "$eos_pkg" ] ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
Github2Gitlab_local() {
|
||||
echo "$url"
|
||||
return
|
||||
|
||||
eos-github2gitlab "$@"
|
||||
return
|
||||
|
||||
local url="$1"
|
||||
|
||||
case "$EOS_FILESERVER_SITE" in
|
||||
gitlab)
|
||||
echo "$url" | sed -e 's|/github\.com/|/gitlab.com/|' \
|
||||
-e 's|/endeavouros-team/|/endeavouros-filemirror/|' \
|
||||
-e 's|/tree/master/|/-/blob/master/|' \
|
||||
-e 's|/eos-bash-shared$|/eos-apps-info|'
|
||||
;;
|
||||
github | *)
|
||||
echo "$url" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
FixUrl() {
|
||||
# PKGNAME and PKGNAME_ARG may be different. Then PKGNAME_ARG is a program name,
|
||||
# and it may have a special man page.
|
||||
|
||||
# if pkg has several apps, or pkgname is also a special app:
|
||||
# Here we handle EndeavourOS packages only.
|
||||
|
||||
local man=""
|
||||
local man_add
|
||||
|
||||
case "$PKGNAME_ARG" in
|
||||
eos-welcome | $PKGNAME)
|
||||
man_add="/man/$PKGNAME/$PKGNAME.md"
|
||||
;;
|
||||
*) man_add="/man/$PKGNAME_ARG/$PKGNAME_ARG.md"
|
||||
;;
|
||||
esac
|
||||
man="$(Github2Gitlab_local "$url")"
|
||||
man+="$man_add"
|
||||
if (wget -q --timeout=5 -O /dev/null "$man") ; then
|
||||
url+="$man_add"
|
||||
#url="$man"
|
||||
fi
|
||||
}
|
||||
|
||||
OpenUrl() {
|
||||
local url="$(echo "$PKGINFO" | /usr/bin/grep ^URL | /usr/bin/head -n1 | /usr/bin/awk '{print $NF}')"
|
||||
case "$url" in
|
||||
https://*) ;;
|
||||
http://*)
|
||||
read -p "Change $url to https based (Y/n)? " >&2
|
||||
case "$REPLY" in
|
||||
""|[yY]*) url="${url/http:/https:}" ;;
|
||||
esac
|
||||
;;
|
||||
"") DIE "URL for package '$PKGNAME' not found" ;;
|
||||
*) DIE "unsupported URL '$url'" ;;
|
||||
esac
|
||||
|
||||
if (IsEndeavourOSpkg "$PKGNAME_ARG") ; then
|
||||
eos-apps-info-helper "$PKGNAME"
|
||||
else
|
||||
FixUrl
|
||||
#echo "$BROWSER" "$url" >&2
|
||||
$BROWSER "$url" >& /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
Options() {
|
||||
PKGNAME=""
|
||||
PKGNAME_ARG=""
|
||||
|
||||
local arg
|
||||
|
||||
for arg in "$@" ; do
|
||||
case "$arg" in
|
||||
--browser=*) BROWSER="${arg#*=}" ;;
|
||||
-*) DIE "option $arg is not supported." ;;
|
||||
*) PKGNAME="$arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ -n "$PKGNAME" ] || DIE "give package-name"
|
||||
|
||||
PKGNAME_ARG="$PKGNAME"
|
||||
}
|
||||
|
||||
Usage() {
|
||||
cat <<EOF >&2
|
||||
Usage: $PROGNAME <name>
|
||||
<name> A package name, program name, or a file path included in a package.
|
||||
Given program name or file path must exist in the current system.
|
||||
The package can be from EndeavourOS, Arch, or AUR.
|
||||
EOF
|
||||
}
|
||||
|
||||
Main()
|
||||
{
|
||||
source /etc/eos-script-lib-yad.conf || return 1
|
||||
|
||||
local PROGNAME="$(/usr/bin/basename "$0")"
|
||||
local PKGNAME
|
||||
local PKGNAME_ARG
|
||||
local HELPER
|
||||
local PKGINFO
|
||||
local BROWSER=/usr/bin/xdg-open
|
||||
|
||||
Helper
|
||||
Options "$@"
|
||||
FindUrl
|
||||
OpenUrl
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
@@ -1,102 +0,0 @@
|
||||
# bash completion for eos-pkginfo -*- shell-script -*-
|
||||
|
||||
_eos-pkginfo_complete() {
|
||||
COMPREPLY=( $(compgen -W "$1" -- "$cur") )
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
}
|
||||
|
||||
_eos-pkginfo_aur()
|
||||
{
|
||||
local cur prev #words cword split
|
||||
_init_completion -s || return
|
||||
|
||||
local weekofyear=$(/usr/bin/date +%V)
|
||||
local datafilebase="$HOME/.config/eos-pkginfo-aur.txt"
|
||||
local datafile="$datafilebase.$weekofyear"
|
||||
|
||||
if [ ! -r "$datafile" ] ; then
|
||||
# Update database file.
|
||||
# Note that a systemd service (--user) can update too.
|
||||
|
||||
# AUR helpers are very slow for this!
|
||||
local helper=/usr/bin/paru
|
||||
[ -x $helper ] || helper=/usr/bin/yay
|
||||
|
||||
rm -f "$datafilebase".*
|
||||
$helper -Slq aur > "$datafile"
|
||||
fi
|
||||
_eos-pkginfo_complete "$(cat "$datafile")"
|
||||
}
|
||||
|
||||
_eos-pkginfo_()
|
||||
{
|
||||
local cur prev #words cword split
|
||||
_init_completion -s || return
|
||||
|
||||
local pkgs=( # pacman -Slq endeavouros # excluding some
|
||||
akm
|
||||
arc-gtk-theme-eos
|
||||
endeavouros-keyring
|
||||
endeavouros-mirrorlist
|
||||
endeavouros-theming
|
||||
endeavouros-xfce4-terminal-colors
|
||||
eos-bash-shared
|
||||
eos-hooks
|
||||
eos-log-tool
|
||||
eos-translations
|
||||
eos-update-notifier
|
||||
grub-tools
|
||||
grub2-theme-endeavouros
|
||||
nvidia-installer-db
|
||||
nvidia-installer-dkms
|
||||
pahis
|
||||
reflector-bash-completion
|
||||
reflector-simple
|
||||
welcome
|
||||
)
|
||||
local apps=( # pacman -Flq "${pkgs[@]}" | grep ^usr/bin/. | sed 's|^usr/bin/||')"
|
||||
akm
|
||||
ChangeDisplayResolution
|
||||
RunInTerminal
|
||||
RunInTerminalEx
|
||||
UpdateInTerminal
|
||||
device-info
|
||||
eos-FindAppIcon
|
||||
eos-connection-checker
|
||||
eos-download-wallpapers
|
||||
eos-kbd-set
|
||||
eos-pkg-changelog
|
||||
eos-pkginfo
|
||||
eos-pkginfo-aur
|
||||
eos-sendlog
|
||||
eos-waiting-indicator
|
||||
eos-wallpaper-set
|
||||
paccache-service-manager
|
||||
su-c_wrapper
|
||||
eos-hooks-runner
|
||||
eos-reboot-required
|
||||
eos-reboot-required2
|
||||
eos-log-tool
|
||||
arch-news-for-you
|
||||
checkupdatesext
|
||||
eos-arch-news
|
||||
eos-update-notifier
|
||||
eos-update-notifier-configure
|
||||
eos-grub-fix-initrd-generation
|
||||
nvidia-installer-check
|
||||
nvidia-installer-update-db
|
||||
nvidia-installer-dkms
|
||||
pahis
|
||||
mirrorlist-rank-info
|
||||
reflector-simple
|
||||
#calamares-update
|
||||
eos-kill-yad-zombies
|
||||
eos-welcome
|
||||
welcome-dnd
|
||||
)
|
||||
local all="$(printf "%s\n" "${pkgs[@]}" "${apps[@]}" | /usr/bin/sort | /usr/bin/uniq)"
|
||||
|
||||
_eos-pkginfo_complete "$all"
|
||||
}
|
||||
complete -F _eos-pkginfo_ eos-pkginfo
|
||||
complete -F _eos-pkginfo_aur eos-pkginfo-aur
|
||||
@@ -1,104 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Show information about GPUs and drivers
|
||||
# and send it to pastebin.
|
||||
#
|
||||
# Use option
|
||||
# -n for not to send to pastebin
|
||||
# -h for more information about the options
|
||||
#
|
||||
|
||||
DIE() {
|
||||
echo "$progname: error: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
Header() {
|
||||
local header="$1"
|
||||
printf "\n[%s]\n" "$header"
|
||||
}
|
||||
|
||||
Date() {
|
||||
Header "Date"
|
||||
/usr/bin/date "+%Y-%m-%d"
|
||||
}
|
||||
GPUs() {
|
||||
Header "Existing GPUs"
|
||||
/usr/bin/lspci -vnn | /usr/bin/grep -P 'VGA|3D|Display'
|
||||
}
|
||||
GPUKernelModules() {
|
||||
Header "GPU related kernel modules in use"
|
||||
/usr/bin/lsmod | /usr/bin/grep -P 'nvidia|nouveau|radeon|amdgpu|i915'
|
||||
}
|
||||
DriverFilter() {
|
||||
/usr/bin/grep -Pw "$pkgs_for_grep"
|
||||
}
|
||||
VideoDrivers() {
|
||||
Header "Installed video drivers and related packages"
|
||||
local pkg result
|
||||
local pkg_specs=( xf86-video
|
||||
nvidia
|
||||
prime
|
||||
optimus
|
||||
bbswitch
|
||||
bumblebee )
|
||||
local pkgs_for_grep="$(echo "${pkg_specs[*]}" | tr ' ' '|')"
|
||||
|
||||
for pkg in "${pkg_specs[@]}" ; do
|
||||
if [ "$testing" = "yes" ] ; then
|
||||
result=$(yay -Ss "$pkg" | grep ^[a-z]*/$pkg | DriverFilter)
|
||||
else
|
||||
result=$(/usr/bin/pacman -Qs "$pkg" | /usr/bin/grep ^local/ | /usr/bin/sed 's|^local/||' | DriverFilter)
|
||||
fi
|
||||
if [ -n "$result" ] ; then
|
||||
echo "$result"
|
||||
fi
|
||||
done | /usr/bin/sort | /usr/bin/uniq
|
||||
}
|
||||
All() {
|
||||
Date
|
||||
GPUs
|
||||
GPUKernelModules
|
||||
VideoDrivers
|
||||
}
|
||||
|
||||
Main()
|
||||
{
|
||||
local progname="$(basename "$0")"
|
||||
local testing="no" # "no" for release, "yes" for dev testing
|
||||
local send=yes
|
||||
|
||||
case "$1" in
|
||||
-h | --help)
|
||||
cat <<EOF
|
||||
Usage: $progname [options]
|
||||
Options:
|
||||
--help This help.
|
||||
-h
|
||||
|
||||
--no-send Don't send to pastebin
|
||||
--dryrun
|
||||
-n
|
||||
|
||||
Without options the GPU info will be sent to pastebin which
|
||||
returns a URL where the information is saved.
|
||||
EOF
|
||||
return
|
||||
;;
|
||||
-n | --dryrun | --no-send)
|
||||
send=no
|
||||
;;
|
||||
"")
|
||||
;;
|
||||
*)
|
||||
DIE "unsupported parameter '$1'"
|
||||
;;
|
||||
esac
|
||||
|
||||
local info=$(All) # get GPU infos
|
||||
|
||||
echo "$info" # show info locally
|
||||
[ "$send" = "yes" ] && echo "$info" | eos-sendlog # send info to pastebin
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
Reference in New Issue
Block a user