add openwrt
This commit is contained in:
parent
eaa5a1bec2
commit
7c9a2ca6af
3 changed files with 35 additions and 4 deletions
8
Makefile
8
Makefile
|
@ -1,6 +1,7 @@
|
||||||
.PHONY: install
|
.PHONY: install alpine openwrt
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
mkdir -p /usr/local/bin
|
||||||
mkdir -p /var/lib/inet2
|
mkdir -p /var/lib/inet2
|
||||||
cp ./bin/* /usr/local/bin
|
cp ./bin/* /usr/local/bin
|
||||||
cp ./lib/* /var/lib/inet2
|
cp ./lib/* /var/lib/inet2
|
||||||
|
@ -9,3 +10,8 @@ alpine:
|
||||||
apk add --no-cache wireguard-tools bind-tools bird
|
apk add --no-cache wireguard-tools bind-tools bird
|
||||||
cp ./deployments/openrc/inet2.initd /etc/init.d/inet2
|
cp ./deployments/openrc/inet2.initd /etc/init.d/inet2
|
||||||
rc-update add inet2
|
rc-update add inet2
|
||||||
|
|
||||||
|
openwrt:
|
||||||
|
opkg install wireguard-tools bind-tools bird2
|
||||||
|
cp ./deployments/initd/inet2.initd /etc/init.d/inet2
|
||||||
|
service inet2 enable
|
||||||
|
|
|
@ -26,7 +26,7 @@ start() {
|
||||||
rm -fr /run/inet2/wg 2> /dev/null
|
rm -fr /run/inet2/wg 2> /dev/null
|
||||||
mkdir -p /run/inet2/wg
|
mkdir -p /run/inet2/wg
|
||||||
|
|
||||||
mkbirdconfig.sh
|
/usr/local/bin/mkbirdconfig.sh
|
||||||
|
|
||||||
step "Setting loopback addresses"
|
step "Setting loopback addresses"
|
||||||
getval Loopback | while read -r addr; do
|
getval Loopback | while read -r addr; do
|
||||||
|
@ -35,7 +35,7 @@ start() {
|
||||||
|
|
||||||
getval interface | while read -r inter; do
|
getval interface | while read -r inter; do
|
||||||
step "Generating config for $inter"
|
step "Generating config for $inter"
|
||||||
run mkwgconfig.sh "$inter" /run/inet2/wg/"$inter"
|
run /usr/local/bin/mkwgconfig.sh "$inter" /run/inet2/wg/"$inter"
|
||||||
|
|
||||||
# create the wireguard interface *in the default namespace*
|
# create the wireguard interface *in the default namespace*
|
||||||
step "Adding Wireguard interface $inter"
|
step "Adding Wireguard interface $inter"
|
||||||
|
@ -90,7 +90,7 @@ stop() {
|
||||||
reload() {
|
reload() {
|
||||||
getval interface | while read -r inter; do
|
getval interface | while read -r inter; do
|
||||||
step "Generating config for $inter"
|
step "Generating config for $inter"
|
||||||
run mkwgconfig.sh "$inter" /run/inet2/wg/"$inter" /config/inet2.conf
|
run /usr/local/bin/mkwgconfig.sh "$inter" /run/inet2/wg/"$inter" /etc/inet2.conf
|
||||||
|
|
||||||
step "Setting Wireguard config for $inter"
|
step "Setting Wireguard config for $inter"
|
||||||
run wg setconf "$inter" /run/inet2/wg/"$inter"
|
run wg setconf "$inter" /run/inet2/wg/"$inter"
|
||||||
|
|
25
deployments/initd/inet2.initd
Executable file
25
deployments/initd/inet2.initd
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=70
|
||||||
|
STOP=10
|
||||||
|
|
||||||
|
start() {
|
||||||
|
/usr/local/bin/inet2.sh start
|
||||||
|
/sbin/service bird start
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
/usr/local/bin/inet2.sh stop
|
||||||
|
/sbin/service bird stop
|
||||||
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
/usr/local/bin/inet2.sh reload
|
||||||
|
/sbin/service bird restart
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue