Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- prog="portss"
- version="0.1"
- psearch() {
- whiteC='\033[01;37m'
- lightCyanC='\033[01;36m'
- blueC='\033[0;34m'
- lightBlueC='\033[01;34m'
- resetC='\033[0m'
- make search key="$1" | awk -v lb=$lightBlueC -v lc=$lightCyanC -v wh=$whiteC -v rst=$resetC -v bl=$blueC \
- '/Port:/{portA=$2; next} /Path:/{pathA=$2; next} /Info:/ { $1=""; print bl portA lb" ("rst lc pathA lb") \n " rst "::" wh $0 rst};'
- }
- curdir="${PWD}"
- pdir="/usr/ports"
- opt=$1
- _opt="$2"
- case $opt in
- -s)
- target="$_opt"
- cd "$pdir"
- psearch $target
- cd "$curdir"
- ;;
- -i)
- target="$_opt"
- cd "$pdir"/"$target"
- doas make install
- cd "$curdir"
- ;;
- -v)
- echo "version $version"
- ;;
- *)
- echo "$prog version $version"
- echo "usage: ${prog} [-s || -i || -v ]"
- echo " -s: Query the ports-repository for installable packages "
- echo " -i: Install a package from ports, by it's path name as trawled by search option"
- echo " ie. ${prog} -i x11/i3"
- echo " -v: Print program version"
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement