Good timing because I'm just about to try setting up pCP from scratch on
a pi 3B, having never done it before :cool:
I started working on a shell script to install ngrok and configure
autoupdate using systemd on 'heavier' machines. It's WIP but here's the
part where I handle the platform specifics:
Code:
--------------------
#!/bin/sh
# helper function
lowercase(){
echo "$1" | sed
"y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
# determine ngrok version needed for this machine
OS=`lowercase \`uname\``
MACH=`uname -m`
if [[ "${OS}" =~ ^windows ]]; then
OS=windows
fname="ngrok.exe"
elif [[ "${OS}" =~ ^darwin ]]; then
OS=darwin
fname="ngrok"
elif [[ "${OS}" =~ ^linux ]]; then
OS=linux
fname="ngrok"
fi
CDN="https://bin.equinox.io/c/4VmDzA7iaHb/"
declare -A endpoint
endpoint[darwin_x86_64]="${CDN}ngrok-stable-darwin-amd64.zip"
endpoint[darwin_i386]="${CDN}ngrok-stable-darwin-386.zip"
endpoint[windows_x86_64]="${CDN}ngrok-stable-windows-amd64.zip"
endpoint[windows_i386]="${CDN}ngrok-stable-windows-386.zip"
endpoint[linux_x86_64_arm]="${CDN}ngrok-stable-linux-arm64.zip"
endpoint[linux_i386_arm]="${CDN}ngrok-stable-linux-arm.zip"
endpoint[linux_armv6l]="${CDN}ngrok-stable-linux-arm.zip"
endpoint[linux_armv7l]="${CDN}ngrok-stable-linux-arm.zip"
endpoint[linux_i386]="${CDN}ngrok-stable-linux-386.zip"
endpoint[linux_x86_64]="${CDN}ngrok-stable-linux-amd64.zip"
endpoint[freebsd_x86_64]="${CDN}ngrok-stable-freebsd-amd64.zip"
endpoint[freebsd_i386]="${CDN}ngrok-stable-freebsd-386.zip"
endpoint[cygwin_x86_64]="${CDN}ngrok-stable-windows-amd64.zip"
machine="${OS}_${MACH}"
if [ ${endpoint[$machine]+_} ]; then
echo -e "Fetching ngrok for ${machine} from ${endpoint[$machine]}\n";
else
echo -e "Unsupported platform ${machine}. Please install and configure
ngrok manually\n"; exit 1;
fi
wget ${endpoint[$machine]} -O ngrok.zip
unzip -o -d ~/ $fname
--------------------
As you can see, I use unzip on all platforms rather than your mix of
tgz/zip depending on 32/64 bits. Is that actually necessary with pCP or
could unzip also handle both installs? If so, the script would be
simpler.
------------------------------------------------------------------------
philchillbill's Profile: http://forums.slimdevices.com/member.php?userid=68920
View this thread: http://forums.slimdevices.com/showthread.php?t=111016
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins