forked from dustinkirkland/bikeshed
-
Notifications
You must be signed in to change notification settings - Fork 2
/
name-search
50 lines (44 loc) · 1.79 KB
/
name-search
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
#
# name-search - check for namespaces, helpful when naming
# an open source project
#
# Copyright (C) 2014 Dustin Kirkland <[email protected]>
#
# Authors:
# Dustin Kirkland <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
FAIL=0
name="$1"
fail() {
tput setaf 1
tput bold
echo "FAIL: $@" 1>&2
tput sgr 0
FAIL=1
}
info() {
tput setaf 2
tput bold
echo "INFO: $@"
tput sgr 0
}
apt-cache show $name >/dev/null 2>&1 && fail "Package not available" || info "Package available"
wget -O /dev/null http://github.com/$name >/dev/null 2>&1 && fail "Github not available" || info "Github available"
wget -O /dev/null https://launchpad.net/~$name >/dev/null 2>&1 && fail "Launchpad team not available" || info "Launchpad team available"
wget -O /dev/null https://launchpad.net/$name >/dev/null 2>&1 && fail "Launchpad project not available" || info "Launchpad project available"
nslookup ${name}.org >/dev/null 2>&1 && fail ".org not available" || info ".org may be available"
nsloopup ${name}.net >/dev/null 2>&1 && fail ".net not available" || info ".net may be available"
nslookup ${name}.io >/dev/null 2>&1 && fail ".io not available" || info ".io may be available"
[ "$FAIL" = "0" ]