pmlag

Poor man's link aggregation
git clone git://git.finwo.net/app/pmlag
Log | Files | Refs | README | LICENSE

commit 36a4fec65d2e6430ce3e3fbb07abc5a519677545
parent ca7ad1e15017a3f984094f8af691045379dcdd14
Author: Yersa Nordman <yersa@finwo.nl>
Date:   Thu, 16 Mar 2023 23:03:52 +0100

Added support for openwrt structure in install script

Diffstat:
M.github/workflows/tag-assets.yml | 1+
Minstall.sh | 51+++++++++++++++++++++++++++++++++++++--------------
2 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/tag-assets.yml b/.github/workflows/tag-assets.yml @@ -20,4 +20,5 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | + package/pmlag-openwrt-amd64.tar.gz package/pmlag-linux-amd64.tar.gz diff --git a/install.sh b/install.sh @@ -1,20 +1,43 @@ -#!/usr/bin/env +#!/usr/bin/env bash -TARGET=linux-amd64 +if [ "$EUID" -ne 0 ]; then + echo "This command must run as root" >&2 + exit 1 +fi -echo -n "Downloading tarball..." -curl -sSL https://github.com/finwo/pmlag/releases/download/edge/pmlag-${TARGET}.tar.gz -o - | \ - gzip -d | \ - tar x -echo "done" +if [ -z "$TARGET" ]; then + export TARGET=linux-amd64 +fi -echo "Installing binaries..." -cd pmlag -make install +case "${TARGET}" in -if [ -d /etc/init.d ]; then - echo "Installing openrc service..." - make svc_openrc -fi + openwrt-*) + curl -sSL https://github.com/finwo/pmlag/releases/download/edge/pmlag-${TARGET}.tar.gz -o - | \ + gzip -d | \ + tar xv --strip-components=1 --directory=/ + ;; + + linux-*) + echo -n "Downloading tarball..." + curl -sSL https://github.com/finwo/pmlag/releases/download/edge/pmlag-${TARGET}.tar.gz -o - | \ + gzip -d | \ + tar x + echo "done" + echo "Installing binaries..." + cd pmlag-${TARGET} + make install + if [ -d /etc/init.d ]; then + echo "Installing openrc service..." + make svc_openrc + fi + cd .. + rm -rf pmlag-${TARGET} + ;; + + *) + echo "Unknown target type '${TARGET}'" >&2 + exit 1 + ;; +esac echo "Finished"