summaryrefslogtreecommitdiff
path: root/pkg/osx/build_tuntaposx
blob: 10bb7c9c75f482dac78804060f2af5bfeb3372ee (plain)
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
#!/bin/zsh
#
# Copyright (C) 2012 ... 
#

REPO="https://github.com/bbits/tuntaposx.git"

autoload colors; colors
# standard output message routines
# it's always useful to wrap them, in case we change behaviour later
notice() { if [[ $QUIET == 0 ]]; then print "$fg_bold[green][*]$fg_no_bold[default] $1" >&2; fi }
error()  { if [[ $QUIET == 0 ]]; then print "$fg[red][!]$fg[default] $1" >&2; fi }
func()   { if [[ $DEBUG == 1 ]]; then print "$fg[blue][D]$fg[default] $1" >&2; fi }
act()    {
    if [[ $QUIET == 0 ]]; then
	if [ "$1" = "-n" ]; then
	    print -n "$fg_bold[white] . $fg_no_bold[default] $2" >&2;
	else
	    print "$fg_bold[white] . $fg_no_bold[default] $1" >&2;
	fi
    fi
}

{ test "$1" = "clean" } && {
	notice "Cleaning up all tuntaposx build"
	rm -rf tuntaposx
	act "Done."
	return 0
}

build_tuntap() {
	test -d tuntaposx || git clone $REPO 
	notice "Cloning tuntaposx sources"
	cd tuntaposx/tuntap
	notice "Building tuntaposx"
	make
	mkdir -p ../../dist/tun.kext
	cp -r tun.kext/* ../../dist/tun.kext
	mkdir -p ../../dist/tuntaposx/StartupItems
	cp -r startup_item/tun ../../dist/tuntaposx/StartupItems
	cd ../..
}

act "Building tuntap"
build_tuntap