|
3 | 3 | mkdir -p /config/{templates,coredns} |
4 | 4 |
|
5 | 5 | # check for wireguard module |
6 | | -if grep -q wireguard /proc/modules; then |
7 | | - echo "**** It seems the wireguard module is already loaded, let's test to make sure it works. ****" |
8 | | - /app/wireguard-tools/contrib/ncat-client-server/client-quick.sh |
9 | | - wg-quick up demo |
10 | | - if wg show | grep -q demo; then |
11 | | - echo "**** The module is working properly, skipping kernel header install and module compilation. ****" |
12 | | - SKIP_COMPILE="true" |
13 | | - else |
14 | | - echo "**** The module is not functional, will attempt kernel header install and module compilation. ****" |
15 | | - fi |
16 | | - wg-quick down demo |
17 | | - rm -f /etc/wireguard/demo.conf |
| 6 | +ip link del dev test 2>/dev/null |
| 7 | +if ip link add dev test type wireguard; then |
| 8 | + echo "**** It seems the wireguard module is already active. Skipping kernel header install and module compilation. ****" |
| 9 | + SKIP_COMPILE="true" |
| 10 | + ip link del dev test |
18 | 11 | else |
19 | | - echo "**** The wireguard module is not loaded, will attempt kernel header install and module compilation. ****" |
| 12 | + echo "**** The wireguard module is not active, will attempt kernel header install and module compilation. ****" |
20 | 13 | fi |
21 | 14 |
|
22 | 15 | # install headers if necessary |
@@ -133,18 +126,14 @@ DUDE |
133 | 126 | make -C wireguard-linux-compat/src -j$(nproc) |
134 | 127 | make -C wireguard-linux-compat/src install |
135 | 128 | echo "**** Let's test our new module. ****" |
136 | | - /app/wireguard-tools/contrib/ncat-client-server/client-quick.sh |
137 | | - wg-quick up demo |
138 | | - if wg show | grep -q demo; then |
139 | | - echo "**** The module is working properly, moving forward with setup. ****" |
| 129 | + ip link del dev test 2>/dev/null |
| 130 | + if ip link add dev test type wireguard; then |
| 131 | + echo "**** The module is active, moving forward with setup. ****" |
| 132 | + ip link del dev test |
140 | 133 | else |
141 | | - wg-quick down demo |
142 | | - rm -f /etc/wireguard/demo.conf |
143 | | - echo "**** The module is not working, review the logs. Sleeping now. . . ****" |
| 134 | + echo "**** The module is not active, review the logs. Sleeping now. . . ****" |
144 | 135 | sleep infinity |
145 | 136 | fi |
146 | | - wg-quick down demo |
147 | | - rm -f /etc/wireguard/demo.conf |
148 | 137 | else |
149 | 138 | echo "**** Kernel headers don't seem to be available, can't compile the module. Sleeping now. . . ****" |
150 | 139 | sleep infinity |
|
0 commit comments