Skip to content

Commit

Permalink
Add installScript for Integration test.
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed Nov 29, 2021
1 parent 3c0ac76 commit 89e04e1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
FROM golang as builder
ENV ROOT=/go/src/app
ENV ROOT=/go/app
WORKDIR ${ROOT}

# Install mimixbox
RUN go install github.com/nao1215/mimixbox/cmd/mimixbox@latest
# Create mimixbox symbolic link in container.
RUN mimixbox --full-install /usr/local/bin/

# Set root password
# 1) Install package for setup
# 2) Install mimixbox
# 3) Create mimixbox symbolic link in container.
# 4) Setting root user password
# 5) Add mimixbox user
# 6) Setting mimixbox user password
RUN apt-get update && apt-get install -y expect && \
go install github.com/nao1215/mimixbox/cmd/mimixbox@latest && \
mimixbox --full-install /usr/local/bin/
RUN echo 'root:password' | chpasswd
RUN useradd mimixbox -m -s /bin/bash &&\
echo 'mimixbox:password' |chpasswd

# Create new user
RUN useradd mimixbox -m -s /bin/bash
RUN echo 'mimixbox:password' |chpasswd
# Copy ShellSpec installer
COPY ./scripts/installShellSpec.sh /home/mimixbox
RUN /home/mimixbox/installShellSpec.sh && rm /home/mimixbox/install*.sh

# If you want to administrator privileges, you become the root user.
# RUN echo "mimixbox ALL=(ALL) ALL" >> /etc/sudoers
Expand Down
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,36 @@ $ tar xf mimixbox-0.0.1-linux-arm64.tar.gz
$ cd mimixbox-0.0.1-linux-arm64
$ sudo ./installer.sh
```
# Development (How to build)
If you want to contribute to the mimixbox project, get the source code with the following command.
```
$ git clone https://github.com/nao1215/mimixbox.git
$ cd mimixbox
$ make build
```

# Development
### Tools
The table below shows the tools used when developing the commands in the mimixbox project.
| Tool | description |
|:-----|:------|
| go-licenses | Used for license management of dependent libraries|
| pandoc | Convert markdown files to manpages |
| make | Used for build, run, test, etc |
| gzip | Used for compress man pages |
| expect | Used for install ShellSpec in Docker|
| install | Used for install serial binary and document in the system |
| docker| Used for testing Mimixbox inside Docker|
| debootstrap| Used for testing Mimixbox inside jail envrioment|
| shellspec | Used for integration test|

If you use Debian-based distribution (e.g. Debian/Ubuntu/Kali Linux/Raspberry Pi OS), You can install tools with the following command.

```
$ sudo apt install build-essential wget expect git pandoc gzip expect docker.io debootstrap
$ go install github.com/google/go-licenses@latest
$ curl -fsSL https://git.io/shellspec | sh
```

### How to build
If you want to contribute to the mimixbox project, get the source code with the following command.
```
$ git clone https://github.com/nao1215/mimixbox.git
$ cd mimixbox
$ make build
```

# Debugging
### How to create docker(testing) environment
Expand Down
12 changes: 12 additions & 0 deletions scripts/installShellSpec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -eu

curl -fsSL https://git.io/shellspec > install.sh
chmod a+x install.sh

expect -c "
set timeout 3
spawn ./install.sh
expect \"\[y\/N\]\"
send \"y\n\"
interact
"

0 comments on commit 89e04e1

Please sign in to comment.