refactor(force_start_update): finish porting force update start script

Signed-off-by: zontreck <tarapiccari@gmail.com>
This commit is contained in:
zontreck 2024-10-05 01:42:13 -07:00
parent d7bd3cf805
commit 2c25a43ba2
4 changed files with 52 additions and 18 deletions

View file

@ -13,4 +13,8 @@ Callback(string sTarget, string sTimerID) {
CancelCallback(string sTimerID) {
LM(LINK_SIGNAL_CALLBACKS, OP_CALLBACK_CANCEL, llList2Json(JSON_OBJECT, ["id", sTimerID]));
}
string BuildPacket(string sOperation, list lParams) {
return llList2Json(JSON_OBJECT, lParams + ["op", sOperation]);
}

View file

@ -19,4 +19,21 @@ string OP_CALLBACK = "5";
string EMPTY_JSON = "{}";
string EMPTY_JSON = "{}";
string VERSION = "0.3.0-dev";
integer UPDATER_CHANNEL = 0xABCDE0;
integer g_iUpdaterListener;
integer g_iUpdaterSecureChannel;
integer g_iUpdaterSecureListener;
integer g_iClientPin;
integer g_iUpdateRunning;
integer g_iCurrentBundle;
integer g_iServerListener;
integer g_iUpdateHasStarted;

View file

@ -0,0 +1,12 @@
/*
This file is a part of NuSystem (https://git.zontreck.com/AriasCreations/NuSystem)
NuSystem is licensed under the GPL.
Please see the Git Source Tree for structured information on changes to indivudual files
Initial Author: Aria (aria@zontreck.com)
*/
#include "../raw/updater/force_update.lsl"

View file

@ -1,10 +1,8 @@
/*
This file is a temporary placeholder for development purposes to help bootstrap the update system. It is a drop in script to immediately start the update
*/
#include "includes/common.lsl"
#include "Variables.lsl"
#include "Functions.lsl"
#include "Version.lsl"
#include "../external/AriasCreations/Common.lsl"
#include "../external/AriasCreations/Helpers.lsl"
default
{
@ -13,7 +11,7 @@ default
// Send the update scan signal
VERSION = "0.0.0.0";
g_iUpdaterListener = llListen(UPDATER_CHANNEL, "", "", "");
llWhisper(UPDATER_CHANNEL, Build("checkupdate", ["myversion", compileVersion()]));
llWhisper(UPDATER_CHANNEL, BuildPacket("checkupdate", ["version", llLinksetDataRead("version")]));
llSetTimerEvent(1);
}
@ -30,14 +28,17 @@ default
{
//llSay(0, "DEBUG ["+llDumpList2String([iChan, sName, kID, sMsg], " ~ ")+"]");
integer iStart=0;
if(llJsonGetValue(sMsg,["operation"]) == "available")
{
// Begin stage 2
iStart=1;
}else if(llJsonGetValue(sMsg,["operation"]) == "same")
{
// Impossible as this is the force start. Tell it to start anyway!
iStart=1;
string sOp = llJsonGetValue(sMsg, ["op"]);
switch(sOp) {
case "available": {
iStart=1;
break;
}
case "same": {
iStart=1;
break;
}
}
if(!iStart)return;
@ -46,7 +47,7 @@ default
llSetRemoteScriptAccessPin(g_iClientPin);
llSleep(1);
llRegionSayTo(kID, UPDATER_CHANNEL, Build("stage2", ["pin", g_iClientPin]));
llRegionSayTo(kID, UPDATER_CHANNEL, BuildPacket("stage2", ["pin", g_iClientPin]));
llSay(0, "Updater found, sent pairing code, good bye!");
llRemoveInventory(llGetScriptName());
}