Debian merged ’em
[shellsnippets/shellsnippets.git] / bash-ksh / profile-funcs
1 # Debian Bug Tracking System
2 bts() {
3         if [[ $1 = +([0-9]) ]]; then
4                 ${BROWSER:-lynx} "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$1"
5         elif [[ $1 = lp:+([0-9]) ]]; then
6                 ${BROWSER:-lynx} "https://bugs.launchpad.net/bugs/${1#lp:}"
7         else
8                 ${BROWSER:-lynx} "http://bugs.debian.org/${1%%_*}"
9         fi
10 }
11 # Debian Package Tracking System, QA, buildd logs Debian, buildd logs D-Ports
12 pts() {
13         local p=${1%%_*} not_slash_bksls=$'[!/\t\n\f\r ]' r=''
14
15         if [[ $p = src:* ]]; then
16                 ${BROWSER:-lynx} "https://packages.debian.org/source/sid/${p#src:}"
17         elif [[ $p = qa:lib${not_slash_bksls}${not_slash_bksls}* ]]; then
18                 ${BROWSER:-lynx} "http://packages.qa.debian.org/${p:3:4}/${p#qa:}.html"
19         elif [[ $p = qa:* ]]; then
20                 ${BROWSER:-lynx} "http://packages.qa.debian.org/${p:3:1}/${p#qa:}.html"
21         elif [[ $p = b[dp]:* ]]; then
22                 ${BROWSER:-lynx} "https://buildd.debian.org/status/package.php?p=${p#bd:}"
23         elif [[ $p = f:* ]]; then
24                 ${BROWSER:-lynx} "https://packages.debian.org/search?searchon=contents&keywords=${1#f:}&mode=path&suite=unstable&arch=any"
25         elif [[ $p = p:* ]]; then
26                 ${BROWSER:-lynx} "https://packages.debian.org/${p#p:}"
27         elif [[ $p = ap:* ]]; then
28                 ${BROWSER:-lynx} "http://archive.debian.net/${p#ap:}"
29         elif [[ $p = up:* ]]; then
30                 ${BROWSER:-lynx} "http://packages.ubuntu.com/${p#up:}"
31         elif [[ $p = ab:* ]]; then
32                 ${BROWSER:-lynx} "http://snapshot.debian.org/binary/${p#ab:}/"
33         elif [[ $p = as:* ]]; then
34                 if [[ $1 = *_* ]]; then
35                         r=${1#*_}
36                         r=${r%%_*}/
37                 fi
38                 ${BROWSER:-lynx} "http://snapshot.debian.org/package/${p#as:}/$r"
39         else
40                 ${BROWSER:-lynx} "https://packages.debian.org/sid/$p"
41         fi
42 }
43
44 alias doch='sudo mksh -c "$(fc -ln -1)"'