Skip to content

Commit

Permalink
Create install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
dlakelan authored Mar 15, 2024
1 parent c3cc5c6 commit 91d9c6c
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

echo "Starting the installation process..."

# Checking and installing required packages
REQUIRED_PACKAGES="kmod-sched ip-full kmod-veth tc"
for pkg in $REQUIRED_PACKAGES; do
if ! opkg list-installed | grep -q "^$pkg "; then
echo "Installing $pkg..."
opkg update && opkg install "$pkg"
fi
done

echo "Downloading and setting up scripts..."

# Download and set execution permissions for the scripts
wget -O /etc/SimpleHFSCgamerscript.sh https://raw.githubusercontent.com/dlakelan/routerperf/nftables/SimpleHFSCgamerscript.sh && chmod a+x /etc/SimpleHFSCgamerscript.sh
wget -O /etc/hotplug.d/iface/13-SimpleHFSCGamerScriptHotplug https://raw.githubusercontent.com/dlakelan/routerperf/nftables/13-SimpleHFSCGamerScriptHotplug
mkdir -p /usr/share/nftables.d/ruleset-post/ && wget -O /usr/share/nftables.d/ruleset-post/dscptag.nft https://raw.githubusercontent.com/dlakelan/routerperf/nftables/dscptag.nft

echo "Configuring veth interface..."

# Configure the veth interface
uci set network.veth=interface
uci set network.veth.proto='none'
uci set network.veth.ifname='lanveth'
uci set network.veth.device='lanveth'
uci commit network

echo "Checking for LAN firewall zone and adding veth interface if it exists..."

LAN_ZONE_NAME=$(uci show firewall | grep -E "firewall.@zone\[.*\].name='lan'" | cut -d'.' -f2)
if [ ! -z "$LAN_ZONE_NAME" ]; then
uci add_list firewall.$LAN_ZONE_NAME.network='veth'
uci commit firewall
/etc/init.d/firewall reload
echo "veth interface added to LAN firewall zone."
else
echo "LAN firewall zone does not exist, skipping addition."
fi

echo "Reloading network service..."
/etc/init.d/network reload

echo "Installation completed successfully!"

0 comments on commit 91d9c6c

Please sign in to comment.