Skip to content

Commit fd88602

Browse files
committed
bs.sh
1 parent e283682 commit fd88602

File tree

5 files changed

+38
-35
lines changed

5 files changed

+38
-35
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,16 @@ Keep in mind that:
6363
6464
### Deployment
6565

66-
Create a node in two or three steps (or update in one). The initial reboot, as well as those after upgrading, may take a while as everything is set up, but the subsequent ones will be much faster. For example, the SaaH peer will be created on a HaaS if it doesn't exist. This means that you should set a Hub or HaaS up first, so SaaH and Spoke peer configurations can be generated. Drop those in their `wireguard/config/wg_confs` directories before rebooting. This [AllowedIPs Calculator](https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator) is pretty nifty, if you need it.
66+
Create a node in no more than four steps (probably three or two) (or update in one). The initial reboot, as well as those after upgrading, may take a while as everything is set up, but the subsequent ones will be much faster. For example, the SaaH peer will be created on a HaaS if it doesn't exist. This means that you should set a Hub or HaaS up first, so SaaH and Spoke peer configurations can be generated. Drop those in their `wireguard/config/wg_confs` directories before rebooting. This [AllowedIPs Calculator](https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator) is pretty nifty, if you need it.
6767

68+
0. If you have an existing configuration, you can copy it to `/opt/closure` now.
6869
1. Install or update the package by either:
6970
- pasting the one-liner or block below;
7071
- downloading it from [Releases](https://github.com/ipitio/closure/releases); or
7172
- copying this repo to `/opt/closure`.
7273

73-
If you're installing on top of an existing configuration with one of the first two options, or updating by running `sudo apt upgrade -y closure`, `rc.local` will be copied for you; skip step 2 and reboot after this step.
74-
7574
```{bash}
76-
curl -sSLNZ https://ipitio.github.io/closure/i | sudo bash
75+
wget -qO- https://ipitio.github.io/closure/i | sudo bash
7776
```
7877

7978
```{bash}
@@ -88,7 +87,7 @@ sudo apt-get update
8887
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -qq closure
8988
```
9089

91-
2. Edit the files above, copy `rc.local` to `/etc`, and reboot.
90+
2. Edit the files above if you skipped step 0, copy `rc.local` to `/etc` if you copied the repo in the previous step, and reboot.
9291
3. On a Hub or HaaS, add Spokes you didn't define yet by running `add.sh` as described below.
9392

9493
> [!NOTE]

bs.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
if grep -q Raspberry /proc/device-tree/model; then
4+
5+
# wifi 2.4GHz performance
6+
grep -q dtoverlay=disable-bt /boot/firmware/config.txt || echo "dtoverlay=disable-bt" | sudo tee -a /boot/firmware/config.txt >/dev/null
7+
8+
if [ ! -f /etc/modprobe.d/brcmfmac.conf ]; then
9+
# wifi chip bug: https://github.com/raspberrypi/linux/issues/6049#issuecomment-2642566713
10+
echo "options brcmfmac roamoff=1 feature_disable=0x202000" | sudo tee /etc/modprobe.d/brcmfmac.conf >/dev/null
11+
sudo systemctl restart systemd-modules-load
12+
fi
13+
fi
14+
15+
# Verbose boot
16+
if [ -f /etc/default/grub ] && grep -q "quiet splash" /etc/default/grub; then
17+
sudo sed -i 's/quiet splash//g' /etc/default/grub
18+
sudo update-grub
19+
fi

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.6.26
7+
Version: 1.6.27
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

debian/postinst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/bash
2-
# shellcheck disable=SC1003
2+
# shellcheck disable=SC1003,SC1091
33

44
pushd /opt/closure || exit 1
5-
[ ! -f env.sh ] || cp rc.local /etc/rc.local
6-
[ ! -f /opt/closure/installed ] || rm -rf /opt/closure/installed
5+
[[ ! -f /etc/rc.local || -f /etc/rc.local.bak ]] || sudo mv -f /etc/rc.local /etc/rc.local.bak
6+
cp rc.local /etc/rc.local
7+
[ ! -f installed ] || rm -rf installed
8+
source "bs.sh"
79
popd || exit 1

init.sh

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,6 @@ yq -V | grep -q mikefarah &>/dev/null || {
7171
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
7272
flatpak install --noninteractive flathub tv.kodi.Kodi
7373
[ ! -f /.dockerenv ] || exit 0
74-
source "lib.sh"
75-
76-
# general performance
77-
# https://cromwell-intl.com/open-source/performance-tuning/tcp.html
78-
while IFS= read -r line; do
79-
grep -qP "^#?\s*?$(echo "$line" | cut -d= -f1)\s*?=.*$" /etc/sysctl.conf && sudo sed -r -i "s/^#?\s*?$(echo "$line" | cut -d= -f1)\s*?=.*$/$line/g" /etc/sysctl.conf || echo "$line" | sudo tee -a /etc/sysctl.conf >/dev/null
80-
done <sysctl.conf
81-
grep -E '(#|.+=)' /etc/sysctl.conf | awk '!seen[$0]++' | sudo tee /etc/sysctl.conf >/dev/null
82-
sudo sysctl -p
8374

8475
# wifi performance
8576
echo "[connection]
@@ -88,24 +79,16 @@ wifi.powersave = 2
8879
" | sudo tee /etc/NetworkManager/conf.d/wifi-powersave.conf >/dev/null
8980
sudo cp -f /etc/NetworkManager/conf.d/wifi-powersave.conf /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
9081
[ ! -f /lib/NetworkManager/conf.d/20-connectivity-ubuntu.conf ] || sudo sed -i "s/uri=.*$/uri=/" /lib/NetworkManager/conf.d/20-connectivity-ubuntu.conf
82+
source "bs.sh"
83+
source "lib.sh"
9184

92-
if grep -q Raspberry /proc/device-tree/model; then
93-
94-
# wifi 2.4GHz performance
95-
grep -q dtoverlay=disable-bt /boot/firmware/config.txt || echo "dtoverlay=disable-bt" | sudo tee -a /boot/firmware/config.txt >/dev/null
96-
97-
if [ ! -f /etc/modprobe.d/brcmfmac.conf ]; then
98-
# wifi chip bug: https://github.com/raspberrypi/linux/issues/6049#issuecomment-2642566713
99-
echo "options brcmfmac roamoff=1 feature_disable=0x202000" | sudo tee /etc/modprobe.d/brcmfmac.conf >/dev/null
100-
sudo systemctl restart systemd-modules-load
101-
fi
102-
fi
103-
104-
# Verbose boot
105-
if [ -f /etc/default/grub ] && grep -q "quiet splash" /etc/default/grub; then
106-
sudo sed -i 's/quiet splash//g' /etc/default/grub
107-
sudo update-grub
108-
fi
85+
# general performance
86+
# https://cromwell-intl.com/open-source/performance-tuning/tcp.html
87+
while IFS= read -r line; do
88+
grep -qP "^#?\s*?$(echo "$line" | cut -d= -f1)\s*?=.*$" /etc/sysctl.conf && sudo sed -r -i "s/^#?\s*?$(echo "$line" | cut -d= -f1)\s*?=.*$/$line/g" /etc/sysctl.conf || echo "$line" | sudo tee -a /etc/sysctl.conf >/dev/null
89+
done <sysctl.conf
90+
grep -E '(#|.+=)' /etc/sysctl.conf | awk '!seen[$0]++' | sudo tee /etc/sysctl.conf >/dev/null
91+
sudo sysctl -p
10992

11093
# Ensure users exist
11194
for user in $CLS_ACTIVE_USER $CLS_SCRIPT_USER; do

0 commit comments

Comments
 (0)