scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit a89860f7a606f8e70e8230ae9581002b7667d561
parent 6732dec0599a0473214e47e072d98c11a48cad25
Author: z3bra <willy@mailoo.org>
Date:   Tue Apr 29 08:18:15 +0200

Merge branch 'master' of z3bra.org:scripts

Diffstat:
mkbar | 5++++-
pkgcat | 50++++++++++++++++++++++++++++++++++++++++++++++++++
prtmk | 3+--
volume | 1-
4 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/mkbar b/mkbar @@ -163,7 +163,10 @@ else fi buf="${buf}$(makebar $(volume)) " -buf="${buf}%{F#ffef79ae} %{F-} $(makebar $(battery)) " +# Show battery status if there is a battery (U DONT SAY) +test -d /sys/class/power_supply/BAT${battery} && + buf="${buf}%{F#ffef79ae} %{F-} $(makebar $(battery)) " + buf="${buf}%{F#ffb3b3b3} %{F-} $(clock)  " echo $buf sleep ${refresh_rate} diff --git a/pkgcat b/pkgcat @@ -0,0 +1,50 @@ +#!/bin/sh +# Script by Ypnose - http://ypnose.org +# Query PKGBUILD online +# TODO: REWORK DAT UGLY CRAP! + +usage() { + printf "%s\n" "Usage: ${0##*/} [-a]" + printf "%s\n" " OPTARG:" + printf "%s\n" " -a Search package on AUR." + printf "%s\n\n" "If OPTARG is empty, pkgcat will query package on [core], [extra] and then [community] repos." +} + +if [ -z "$1" ] || [ "$1" = -h ]; then + usage + exit 1 +fi + +LET="$(echo $2 | awk '{print substr ($0, 0, 2)}')" +AUR="https://aur.archlinux.org/packages/$LET/$2/PKGBUILD" +URLP="https://projects.archlinux.org/svntogit/packages.git/plain/trunk/PKGBUILD?h=packages/$1" +URLC="https://projects.archlinux.org/svntogit/community.git/plain/trunk/PKGBUILD?h=packages/$1" + +if [ "$1" = "-a" ] && [ "$#" -eq 2 ]; then + printf "\033[1;32m%s\033[0m\n" "Searching on AUR..." + if [ -z "$(curl -s $AUR | awk '/404/')" ]; then + printf "\n%s\n" "$(curl -s $AUR)" + exit 0 + else + printf "\033[1;31m%s\033[0m\n" "Package not found!" + exit 1 + fi +fi + +printf "\033[1;32m%s\033[0m\n" "Trying core / extra repo..." +if [ "$(curl -s $URLP | awk 'NR == 1 {print $1}')" != "<!DOCTYPE" ]; then + printf "\n%s\n" "$(curl -s $URLP)" + exit 0 +else + printf "\033[1;31m%s\033[0m\n" "Package not found in core / extra" + printf "\033[1;32m%s\033[0m\n" "Trying community repo..." + if [ "$(curl -s $URLC | awk 'NR == 1 {print $1}')" != "<!DOCTYPE" ]; then + printf "\n%s\n" "$(curl -s $URLC)" + exit 0 + else + printf "\033[1;31m%s\033[0m\n" "Package not found!" + exit 1 + fi +fi + +exit 0 diff --git a/prtmk b/prtmk @@ -13,8 +13,7 @@ echo_color () { tput sgr0 } - -read -p 'Name : ' name +test -n "$1" && name=$1 || read -p 'Name : ' name read -p 'Description : ' description read -p 'Version : ' version read -p 'URL : ' url diff --git a/volume b/volume @@ -21,4 +21,3 @@ case $1 in !) amixer set Master toggle >/dev/null;; *) amixer set Master $1 >/dev/null;; esac -