Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve makefile, -version shows git hash, fix README #216

Merged
merged 1 commit into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.PHONY: \
glide \
deps \
update \
build \
install \
all \
vendor \
lint \
Expand All @@ -12,12 +17,27 @@

SRCS = $(shell git ls-files '*.go')
PKGS = ./. ./config ./models ./report ./cveapi ./scan ./util ./commands ./cache
VERSION := $(shell git describe --tags --abbrev=0)
REVISION := $(shell git rev-parse --short HEAD)
LDFLAGS := -X 'main.version=$(VERSION)' \
-X 'main.revision=$(REVISION)'

all: test
glide:
go get github.com/Masterminds/glide

deps: glide
glide install

update: glide
glide update

# vendor:
# @ go get -v github.com/mjibson/party
# party -d external -c -u
build: main.go deps
go build -ldflags "$(LDFLAGS)" -o vuls $<

install: main.go deps
go install -ldflags "$(LDFLAGS)"

all: test

lint:
@ go get -v github.com/golang/lint/golint
Expand Down
57 changes: 14 additions & 43 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,26 +148,19 @@ $ source /etc/profile.d/goenv.sh

## Step4. Deploy [go-cve-dictionary](https://github.com/kotakanbe/go-cve-dictionary)

go get

```bash
$ sudo mkdir /var/log/vuls
$ sudo chown ec2-user /var/log/vuls
$ sudo chmod 700 /var/log/vuls
$ go get github.com/kotakanbe/go-cve-dictionary
```

go-cve-dictionaryを既にインストール済みでupdateしたい場合は

```bash
$ go get -u github.com/kotakanbe/go-cve-dictionary
$
$ mkdir -p $GOPATH/src/github.com/kotakanbe
$ cd $GOPATH/src/github.com/kotakanbe
$ git https://github.com/kotakanbe/go-cve-dictionary.git
$ cd go-cve-dictionary
$ make install
```
バイナリは、`$GOPATH/bin`いかに生成される

で可能である。

go getでエラーが発生した場合は、以下の点を確認する。
- Gitのバージョンがv2以降か?
- Go依存パッケージの問題でgo getに失敗する場合は [deploying with glide](https://github.com/future-architect/vuls/blob/master/README.md#deploy-with-glide) を試す。

NVDから脆弱性データベースを取得する。
環境によって異なるが、AWS上では10分程度かかる。
Expand All @@ -182,10 +175,12 @@ $ ls -alh cve.sqlite3
## Step5. Deploy Vuls

新規にターミナルを起動し、先ほど作成したEC2にSSH接続する。

go get
```
$ go get github.com/future-architect/vuls
$ mkdir -p $GOPATH/src/github.com/future-architect
$ cd $GOPATH/src/github.com/future-architect
$ git clone https://github.com/future-architect/vuls.git
$ cd vuls
$ make install
```

vulsを既にインストール済みでupdateしたい場合は
Expand Down Expand Up @@ -1074,45 +1069,21 @@ slack, emailは日本語対応済み TUIは日本語表示未対応

----

# Deploy With Glide

If an error occurred while go get, try deploying with glide.
- Install [Glide](https://github.com/Masterminds/glide)
- Deploy go-cve-dictionary
```
$ go get -d github.com/kotakanbe/go-cve-dictionary
$ cd $GOPATH/src/github.com/kotakanbe/go-cve-dictionary
$ glide install
$ go install
```
- Deploy vuls
```
$ go get -d github.com/future-architect/vuls
$ cd $GOPATH/src/github.com/future-architect/vuls
$ glide install
$ go install
```
- The binaries are created under $GOPARH/bin

----

# Update Vuls With Glide

- Update go-cve-dictionary
If the DB schema was changed, please specify new SQLite3 DB file.
```
$ cd $GOPATH/src/github.com/kotakanbe/go-cve-dictionary
$ git pull
$ glide install
$ go install
$ make install
```

- Update vuls
```
$ cd $GOPATH/src/github.com/future-architect/vuls
$ git pull
$ glide install
$ go install
$ make install
```
- バイナリファイルは`$GOPARH/bin`以下に作成される

Expand Down
57 changes: 16 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,18 @@ $ source /etc/profile.d/goenv.sh

## Step4. Deploy [go-cve-dictionary](https://github.com/kotakanbe/go-cve-dictionary)

go get

```bash
$ sudo mkdir /var/log/vuls
$ sudo chown ec2-user /var/log/vuls
$ sudo chmod 700 /var/log/vuls
$ go get github.com/kotakanbe/go-cve-dictionary
$
$ mkdir -p $GOPATH/src/github.com/kotakanbe
$ cd $GOPATH/src/github.com/kotakanbe
$ git clone https://github.com/kotakanbe/go-cve-dictionary.git
$ cd go-cve-dictionary
$ make install
```

If an error occurred while go get, check the following points.
- Update Git
- try [deploying with glide](https://github.com/future-architect/vuls/blob/master/README.md#deploy-with-glide).
The binary was built under `$GOPARH/bin`

Fetch vulnerability data from NVD.
It takes about 10 minutes (on AWS).
Expand All @@ -183,14 +183,14 @@ $ ls -alh cve.sqlite3

Launch a new terminal and SSH to the ec2 instance.

go get
```
$ go get github.com/future-architect/vuls
$ mkdir -p $GOPATH/src/github.com/future-architect
$ cd $GOPATH/src/github.com/future-architect
$ git clone https://github.com/future-architect/vuls.git
$ cd vuls
$ make install
```

If an error occurred while go get, check the following points.
- Update Git
- try [deploying with glide](https://github.com/future-architect/vuls/blob/master/README.md#deploy-with-glide).
The binary was built under `$GOPARH/bin`

## Step6. Config

Expand Down Expand Up @@ -987,48 +987,23 @@ $ go-cve-dictionary fetchnvd -last2y

----

# Deploy With Glide

If an error occurred while go get, try deploying with glide.
- Install [Glide](https://github.com/Masterminds/glide)
- Deploy go-cve-dictionary
```
$ go get -d github.com/kotakanbe/go-cve-dictionary
$ cd $GOPATH/src/github.com/kotakanbe/go-cve-dictionary
$ glide install
$ go install
```
- Deploy vuls
```
$ go get -d github.com/future-architect/vuls
$ cd $GOPATH/src/github.com/future-architect/vuls
$ glide install
$ go install
```
- The binaries are created under $GOPARH/bin

----

# Update Vuls With Glide

- Update go-cve-dictionary
If the DB schema was changed, please specify new SQLite3 DB file.
```
$ cd $GOPATH/src/github.com/kotakanbe/go-cve-dictionary
$ git pull
$ glide install
$ go install
$ make install
```

- Update vuls
```
$ cd $GOPATH/src/github.com/future-architect/vuls
$ git pull
$ glide install
$ go install
$ make install
```

Binary Files are created under $GOPARH/bin
Binary file was built under $GOPARH/bin

---

Expand Down
38 changes: 18 additions & 20 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ import (
"golang.org/x/net/context"

"github.com/future-architect/vuls/commands"
"github.com/future-architect/vuls/version"
"github.com/google/subcommands"

_ "github.com/mattn/go-sqlite3"
)

// Version of Vuls
var version = "0.1.6"

// Revision of Git
var revision string

func main() {
subcommands.Register(subcommands.HelpCommand(), "")
subcommands.Register(subcommands.FlagsCommand(), "")
Expand All @@ -47,7 +52,7 @@ func main() {
flag.Parse()

if *v {
fmt.Printf("%s %s\n", version.Name, version.Version)
fmt.Printf("vuls %s %s\n", version, revision)
os.Exit(int(subcommands.ExitSuccess))
}

Expand Down
24 changes: 0 additions & 24 deletions version/version.go

This file was deleted.