install.sh (878B)
1 #!/usr/bin/env bash 2 3 if [ "$EUID" -ne 0 ]; then 4 echo "This command must run as root" >&2 5 exit 1 6 fi 7 8 if [ -z "$TARGET" ]; then 9 export TARGET=linux-amd64 10 fi 11 12 case "${TARGET}" in 13 14 openwrt-*) 15 curl -sSL https://github.com/finwo/pmlag/releases/download/edge/pmlag-${TARGET}.tar.gz -o - | \ 16 gzip -d | \ 17 tar xv --strip-components=1 --directory=/ 18 ;; 19 20 linux-*) 21 echo -n "Downloading tarball..." 22 curl -sSL https://github.com/finwo/pmlag/releases/download/edge/pmlag-${TARGET}.tar.gz -o - | \ 23 gzip -d | \ 24 tar x 25 echo "done" 26 echo "Installing binaries..." 27 cd pmlag-${TARGET} 28 make install 29 if [ -d /etc/init.d ]; then 30 echo "Installing openrc service..." 31 make svc_openrc 32 fi 33 cd .. 34 rm -rf pmlag-${TARGET} 35 ;; 36 37 *) 38 echo "Unknown target type '${TARGET}'" >&2 39 exit 1 40 ;; 41 esac 42 43 echo "Finished"