Skip to content

Commit ed1afde

Browse files
committed
show config under qr
1 parent 37c85c7 commit ed1afde

File tree

8 files changed

+9
-17
lines changed

8 files changed

+9
-17
lines changed

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Homepage: https://github.com/ipitio/closure
44
Standards-Version: 3.9.2
55

66
Package: closure
7-
Version: 1.7.3
7+
Version: 1.7.4
88
Maintainer: ipitio <21136719+ipitio@users.noreply.github.com>
99
Depends: curl, flatpak, gpg, hostapd, isc-dhcp-server, iw, macchanger, netplan.io, network-manager, net-tools, qrencode, rfkill, wireguard, wireless-tools, wget
1010
Recommends: containerd.io, docker-ce, docker-ce-cli, docker-buildx-plugin, docker-compose-plugin

lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
set -a
66

77
# Closure settings from env.sh
8-
this_dir=$(dirname "$(readlink -f "$0")")
8+
this_dir=$PWD
99
source "$this_dir/env.sh"
1010

1111
if [ -z "$CLS_TYPE_NODE" ]; then

start.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ source "lib.sh"
1313
pids=$(ps -o ppid=$$)
1414
ps -aux | grep -P "^[^-]+$this_dir/start.sh" | awk '{print $2}' | while read -r pid; do grep -q "$pid" <<<"$pids" || sudo kill -9 "$pid" &>/dev/null; done
1515

16-
if ! ${CLS_WG_ONLY:-false}; then
16+
if [ "${CLS_WG_ONLY:-false}" = "false" ]; then
1717
[ -d config ] || sudo mkdir config
1818
[[ -f config/wifis.json && -s config/wifis.json ]] || echo "{}" | sudo tee config/wifis.json
1919

@@ -137,10 +137,9 @@ eval "cast pre-up ${*@Q}"
137137
) &
138138

139139
if [ "$CLS_DOCKER" = "true" ]; then
140-
sudo systemctl stop isc-dhcp-server
141-
142140
# prod starts wg
143-
if ! ip a show "$CLS_INTERN_IFACE" | grep -q UP; then
141+
if [ "${CLS_WG_ONLY:-false}" = "false" ] || ! sudo docker ps | grep -qE "pihole.*Up"; then
142+
sudo docker compose down
144143
sudo systemctl restart docker
145144
sudo docker network prune -f
146145
until [ -n "$CLS_LOCAL_IP" ]; do
@@ -150,7 +149,6 @@ if [ "$CLS_DOCKER" = "true" ]; then
150149
sed -i "s/#\?- FTLCONF_LOCAL_IPV4=.*$/- FTLCONF_LOCAL_IPV4=$CLS_LOCAL_IP/" compose.yml
151150
sudo docker compose --profile prod up -d --force-recreate --remove-orphans
152151
elif ! sudo docker ps | grep -qE "wireguard.*Up"; then
153-
sudo docker compose --profile prod up -d --force-recreate --remove-orphans
154152
sudo docker compose up -d wireguard
155153
fi
156154
else

wireguard/add.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if ! grep -q "$1" <<<"$PEERS"; then
2020

2121
if [ "$CLS_DOCKER" = "true" ]; then
2222
export CLS_WG_ONLY=true
23-
sudo bash restart.sh ${@@Q}
23+
sudo bash restart.sh ${@@Q} 2>/dev/null
2424
else
2525
bash wireguard/etc/run
2626
fi
@@ -62,5 +62,5 @@ esac
6262

6363
echo "$conf" | sudo tee "$path.conf" >/dev/null || exit 1
6464
CLS_WG_ONLY=true
65-
sudo bash restart.sh ${@@Q}
65+
sudo bash restart.sh ${@@Q} 2>/dev/null
6666
popd &>/dev/null || exit 1

wireguard/app/show-peer

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ for i in "$@"; do
1818
if grep -q "# ${PEER_ID}" wireguard/config/wg_confs/wg0.conf; then
1919
echo "PEER ${i} QR code:"
2020
qrencode -t ansiutf8 < wireguard/config/"${PEER_ID}"/"${PEER_ID}".conf
21+
echo "PEER ${i} config:"
22+
cat wireguard/config/"${PEER_ID}"/"${PEER_ID}".conf
2123
else
2224
echo "PEER ${i} is not active"
2325
fi

wireguard/etc/run

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,7 @@
55
# This file has been modified from the above source: paths were changed to be relative to the project root
66

77
mkdir -p wireguard/config/wg_confs
8-
mkdir -p wireguard/config/templates
98

10-
# prepare templates
11-
if [[ ! -f wireguard/config/templates/server.conf ]]; then
12-
cp wireguard/defaults/server.conf wireguard/config/templates/server.conf
13-
fi
14-
if [[ ! -f wireguard/config/templates/peer.conf ]]; then
15-
cp wireguard/defaults/peer.conf wireguard/config/templates/peer.conf
16-
fi
179
# add preshared key to user templates (backwards compatibility)
1810
if ! grep -q 'PresharedKey' wireguard/config/templates/peer.conf; then
1911
sed -i 's|^Endpoint|PresharedKey = \$\(cat wireguard/config/\${PEER_ID}/presharedkey-\${PEER_ID}\)\nEndpoint|' wireguard/config/templates/peer.conf

0 commit comments

Comments
 (0)