Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. prog="portss"
  4. version="0.1"
  5.  
  6. psearch() {
  7. whiteC='\033[01;37m'
  8. lightCyanC='\033[01;36m'
  9. blueC='\033[0;34m'
  10. lightBlueC='\033[01;34m'
  11. resetC='\033[0m'
  12.  
  13. make search key="$1" | awk -v lb=$lightBlueC -v lc=$lightCyanC -v wh=$whiteC -v rst=$resetC -v bl=$blueC \
  14. '/Port:/{portA=$2; next} /Path:/{pathA=$2; next} /Info:/ { $1=""; print bl portA lb" ("rst lc pathA lb") \n " rst "::" wh $0 rst};'
  15. }
  16.  
  17. curdir="${PWD}"
  18. pdir="/usr/ports"
  19. opt=$1
  20. _opt="$2"
  21.  
  22. case $opt in
  23. -s)
  24. target="$_opt"
  25. cd "$pdir"
  26. psearch $target
  27. cd "$curdir"
  28. ;;
  29. -i)
  30. target="$_opt"
  31. cd "$pdir"/"$target"
  32. doas make install
  33. cd "$curdir"
  34. ;;
  35. -v)
  36. echo "version $version"
  37. ;;
  38. *)
  39. echo "$prog version $version"
  40. echo "usage: ${prog} [-s || -i || -v ]"
  41. echo " -s: Query the ports-repository for installable packages "
  42. echo " -i: Install a package from ports, by it's path name as trawled by search option"
  43. echo " ie. ${prog} -i x11/i3"
  44. echo " -v: Print program version"
  45. ;;
  46. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement