Skip to content

Commit

Permalink
Use uuid2ip by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ailispaw committed Jun 23, 2015
1 parent 62c64c8 commit 3519d3f
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -5,5 +5,5 @@ vmlinuz64
boot2docker.iso
boot2docker-data.*

/contrib/uuid2ip/build/
/uuid2ip/build/
.mac_address
22 changes: 13 additions & 9 deletions Makefile
@@ -1,4 +1,4 @@
all: initrd.img vmlinuz64 boot2docker-data.img exports
all: initrd.img vmlinuz64 boot2docker-data.img exports uuid2ip

initrd.img vmlinuz64: boot2docker.iso
hdiutil mount boot2docker.iso
Expand Down Expand Up @@ -41,36 +41,40 @@ exports-clean:

.PHONY: exports exports-clean

run:
osascript xhyverun.scpt
run: xhyverun.scpt xhyverun.sh
@sudo echo "Booting up..." # to input password at the current window in advance
@osascript xhyverun.scpt

.PHONY: run

mac: .mac_address
@cat .mac_address

ip: .mac_address
@contrib/uuid2ip/mac2ip.sh $(shell cat .mac_address)
@uuid2ip/mac2ip.sh $(shell cat .mac_address)

ssh: .mac_address
@expect -c ' \
spawn ssh docker@'`contrib/uuid2ip/mac2ip.sh $(shell cat .mac_address)`'; \
spawn ssh docker@'`uuid2ip/mac2ip.sh $(shell cat .mac_address)`'; \
expect "(yes/no)?" { send "yes\r"; exp_continue; } "password:" { send "tcuser\r"; }; \
interact; \
'

halt: .mac_address
@expect -c ' \
spawn ssh docker@'`contrib/uuid2ip/mac2ip.sh $(shell cat .mac_address)`' sudo halt; \
spawn ssh docker@'`uuid2ip/mac2ip.sh $(shell cat .mac_address)`' sudo halt; \
expect "(yes/no)?" { send "yes\r"; exp_continue; } "password:" { send "tcuser\r"; }; \
interact; \
'
@echo "Shutting down..."

uuid2ip:
$(MAKE) -C contrib/uuid2ip
uuid2ip: uuid2ip/build/uuid2mac

uuid2ip/build/uuid2mac:
$(MAKE) -C uuid2ip

uuid2ip-clean:
$(MAKE) -C contrib/uuid2ip clean
$(MAKE) -C uuid2ip clean
$(RM) .mac_address

.PHONY: mac ip ssh halt uuid2ip uuid2ip-clean
83 changes: 21 additions & 62 deletions README.md
Expand Up @@ -23,7 +23,7 @@ $ make
$ cp build/xhyve /usr/local/bin/ # You may need sudo.
```

## Getting Boot2Docker Images
## Setting up Boot2Docker images and tools

```
$ git clone https://github.com/ailispaw/boot2docker-xhyve
Expand All @@ -34,57 +34,26 @@ $ make
## Booting Up

```
$ sudo ./xhyverun.sh
Password:
Core Linux
boot2docker login:
$ make run
Booting up...
```

## Logging In

### for Console
- On Termial.app: This will open a new window, then you will see in the window as below.
- On iTerm.app: This will split the current window, then you will see in the bottom pane as below.

```
Core Linux
boot2docker login: docker
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.7.0, build master : 7960f90 - Thu Jun 18 18:31:45 UTC 2015
Docker version 1.7.0, build 0baf609
docker@boot2docker:~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 16:C1:B5:29:CF:32
inet addr:192.168.64.3 Bcast:192.168.64.255 Mask:255.255.255.0
inet6 addr: fe80::14c1:b5ff:fe29:cf32/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7026 (6.8 KiB) TX bytes:7617 (7.4 KiB)
docker@boot2docker:~$
boot2docker login:
```

### for SSH

Use IP address (192.168.64.X) shown avobe.
## Logging In

- ID: docker
- Password: tcuser

```
$ ssh docker@192.168.64.3
$ make ssh
spawn ssh docker@192.168.64.3
docker@192.168.64.3's password:
## .
## ## ## ==
Expand All @@ -101,42 +70,32 @@ docker@192.168.64.3's password:
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.7.0, build master : 7960f90 - Thu Jun 18 18:31:45 UTC 2015
Docker version 1.7.0, build 0baf609
docker@boot2docker:~$
```

### Run at a split pane in [iTerm2](http://iterm2.com/)

```
$ make run
osascript xhyverun.scpt
$
```

This will split the current window, then you will see in the bottom pane as below.

```
$ sudo ./xhyverun.sh
Core Linux
boot2docker login:
docker@boot2docker:~$
```

## Shutting Down

Use `halt` command to shut down.
Use `halt` command to shut down in the VM.

```
docker@boot2docker:~$ sudo halt
docker@boot2docker:~$ reboot: System halted
$
```

## Using Docker
or

Use IP address (192.168.64.X) shown avobe as well.
```
$ make halt
spawn ssh docker@192.168.64.3 sudo halt
docker@192.168.64.3's password:
Shutting down...
```

## Using Docker

```
$ docker -H 192.168.64.3:2375 info
$ docker -H `make ip`:2375 info
Containers: 0
Images: 0
Storage Driver: aufs
Expand Down
56 changes: 0 additions & 56 deletions contrib/uuid2ip/README.md

This file was deleted.

File renamed without changes.
26 changes: 26 additions & 0 deletions uuid2ip/README.md
@@ -0,0 +1,26 @@
# Get Mac Address and IP Address from UUID

License: BSD as well as [xhybe](https://github.com/mist64/xhyve)

config.mk and uuid.h are from xhybe and most of main.c is from xhyve, too.

```
$ git clone https://github.com/ailispaw/boot2docker-xhyve
$ cd boot2docker-xhyve
$ make uuid2ip
/Library/Developer/CommandLineTools/usr/bin/make -C uuid2ip
cc main.c
ld uuid2mac.sym
dsym uuid2mac.dSYM
strip uuid2mac
```

```
$ uuid2ip/build/uuid2mac
Usage: uuid2ip/build/uuid2mac <UUID>
```

```
$ uuid2ip/mac2ip.sh
Usage: mac2ip.sh <mac_address>
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions xhyverun.sh
Expand Up @@ -15,8 +15,8 @@ LPC_DEV="-l com1,stdio"

UUID="bb60a7fd-2655-4927-88a6-fdd1e2223ddc"
if [ -n "${UUID}" ]; then
if [ -x "contrib/uuid2ip/build/uuid2mac" ]; then
MAC_ADDRESS=$(contrib/uuid2ip/build/uuid2mac ${UUID})
if [ -x "uuid2ip/build/uuid2mac" ]; then
MAC_ADDRESS=$(uuid2ip/build/uuid2mac ${UUID})
if [ -n "${MAC_ADDRESS}" ]; then
echo "${MAC_ADDRESS}" > .mac_address
else
Expand Down

0 comments on commit 3519d3f

Please sign in to comment.