From f573cb9b0ba120ce7ec14867b322f6a763724ab5 Mon Sep 17 00:00:00 2001 From: TheDragonkeeper Date: Mon, 8 Apr 2019 18:43:01 +0100 Subject: [PATCH 1/4] Create payload.sh --- payloads/extensions/payload.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 payloads/extensions/payload.sh diff --git a/payloads/extensions/payload.sh b/payloads/extensions/payload.sh new file mode 100644 index 00000000..73f652a8 --- /dev/null +++ b/payloads/extensions/payload.sh @@ -0,0 +1,25 @@ +function RUN_PAYLOAD() { + payloadcount=$# + payloadarray=("$@") + PAYLOAD=1 + LED R + sleep 3 + while [ $payloadcount -ge $PAYLOAD ]; do + LED R + GET SWITCH_POSITION + TEST=$SWITCH_POSITION + LED B + sleep 2 + GET SWITCH_POSITION + if [ $SWITCH_POSITION == $TEST ]; then + LED G + "${payloadarray[0]}""${payloadarray["$PAYLOAD"]}" + return + fi + LED G FAST + PAYLOAD=$((PAYLOAD+1)) + sleep 1 + done +} + +export -f RUN_PAYLOAD From bed7de2cd4eb54ac289b2715b771c49c792b0cae Mon Sep 17 00:00:00 2001 From: TheDragonkeeper Date: Mon, 8 Apr 2019 19:16:09 +0100 Subject: [PATCH 2/4] Update payload.sh --- payloads/extensions/payload.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/payloads/extensions/payload.sh b/payloads/extensions/payload.sh index 73f652a8..28cc357d 100644 --- a/payloads/extensions/payload.sh +++ b/payloads/extensions/payload.sh @@ -1,3 +1,20 @@ +#!/bin/bash + +#Payload selector by Dragonkeeper +# Allows selecting payloads by amount of switch changes +# +# Execution RUN_PAYLOAD "/Payload/folder/" "payload1.txt" "anotherpayload.txt" "awesomepayload.txt" +# +# LED will go red, to let you know its ready. It is currently about to execute the 1st given payload +# the LED will blue, to let you decide if you want to run that payload. if yes do nothing, if no flick the switch. +# +# if you flicked the switch, the LED will flash green to indicate this, it will then flick to red and go blue, it is now on the 2nd given payload and awaiting decision. +# +# if you leave the switch alone while its blue, the LED will go solid green to indicate that the selection is locked in. +# and the payload of the given number will run. +# +# This will let you add as many payloads as you desire. + function RUN_PAYLOAD() { payloadcount=$# payloadarray=("$@") From 066b7846daa13b09fd480410883b9bc49e6feb86 Mon Sep 17 00:00:00 2001 From: TheDragonkeeper Date: Fri, 28 Jun 2019 22:03:48 +0100 Subject: [PATCH 3/4] Rename payload.sh to runpayload.sh --- payloads/extensions/{payload.sh => runpayload.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename payloads/extensions/{payload.sh => runpayload.sh} (100%) diff --git a/payloads/extensions/payload.sh b/payloads/extensions/runpayload.sh similarity index 100% rename from payloads/extensions/payload.sh rename to payloads/extensions/runpayload.sh From 81317d83b15f45d038f9b4e99881340cb1a87f9d Mon Sep 17 00:00:00 2001 From: TheDragonkeeper Date: Fri, 28 Jun 2019 22:08:44 +0100 Subject: [PATCH 4/4] Update runpayload.sh --- payloads/extensions/runpayload.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/payloads/extensions/runpayload.sh b/payloads/extensions/runpayload.sh index 28cc357d..700c1f7f 100644 --- a/payloads/extensions/runpayload.sh +++ b/payloads/extensions/runpayload.sh @@ -3,7 +3,15 @@ #Payload selector by Dragonkeeper # Allows selecting payloads by amount of switch changes # -# Execution RUN_PAYLOAD "/Payload/folder/" "payload1.txt" "anotherpayload.txt" "awesomepayload.txt" +#Step1. put all your payloads into a folder +# +#Step2. in the switch folder make a payload.txt and define the payloads and the dir to use as variables. like so: +#scriptfolder=" /root/udisk/payloads/payloads/ " +#script1="payload1.txt" +#script2="payload2.txt" +# +#Step3. now call the extension as with the payloads you would like to use +#RUN_PAYLOAD $scriptfolder $script1 $script2 $script3 $script4 # # LED will go red, to let you know its ready. It is currently about to execute the 1st given payload # the LED will blue, to let you decide if you want to run that payload. if yes do nothing, if no flick the switch.