Message ID | 20240221082221.11997-6-stefano.babic@swupdate.org |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show
Return-Path: <swupdate+bncBAABBQXF22XAMGQEWPNY2JY@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=hO6NBkMZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::537; helo=mail-ed1-x537.google.com; envelope-from=swupdate+bncbaabbqxf22xamgqewpny2jy@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-ed1-x537.google.com (mail-ed1-x537.google.com [IPv6:2a00:1450:4864:20::537]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tfq5M13ckz23f7 for <incoming@patchwork.ozlabs.org>; Wed, 21 Feb 2024 19:22:30 +1100 (AEDT) Received: by mail-ed1-x537.google.com with SMTP id 4fb4d7f45d1cf-564a038057esf1452752a12.3 for <incoming@patchwork.ozlabs.org>; Wed, 21 Feb 2024 00:22:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708503747; cv=pass; d=google.com; s=arc-20160816; b=KRkajm9c1xFe4mr/uORz7On0YwNSwGiJhEwJOuQ9z3dGgp8KyD6dcJzwnmAnVmMDL6 FnLglQrjCHmbIEaPTgXNxpusp3q1NhwV3WIz+bJKcrzVyO+iBR15IkzU57gq/paHfHZS 3jpKyd7E5FMwjf8071ylmfNqNX4Z/WUBuB+B7+PbIT7wGJqgllIoAyB3UvCfHA4Q8A4b L2y64vrcP4ZGaD8dzqPVBGIfMoKVto4y7mNnqnl9z7Dyn0lR75XC35a1rJqUdHf+qNP6 1wXxbTPf9zEVa63Oevr/OE64ql5WfEvBfndp0Qypaw46jUiOQFz0XzhVqFp3t7x7EgyZ oHag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:ui-outboundreport:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=3yqSzdFwEDtgJigw4g1OESe0i9MdMzMhhczoKM1z55s=; fh=CoanefZyb5Tgm+XwoDneXi31t3k/R9Mdx5vEiRUkxSg=; b=hKKPCvFWaokkXbWztL1XjXxXtZO9I0nmtQRJXG9gN/0rdulBChilUVE8wkcHqYZ0Hq 7oYMRaYp062NHFjbTQijH0QnMWOK26XSsgPJ8dvy0JBkJm9QE8WrYc8Is4CnWQ9C7P1L UpKZDSOSe8z/FGs4pti6gD63KJ7SEOWTup6TuUL85J0XjUqfhjvAV5SJnEzXIhV2oolH 1gOQv0yoLcvxSZAzZ/BEbMlM1XFFpuk4mWaknajvKhC2D/zmNcmX43bWaxwVAhMO8NKI FE/gnggugFT2kpthnKKEoaJLx74KnOpZBRsO+mazTZqapNwJjVvaGI4A9jn7MuusKmHI 6Fkw==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=tIH5jX6u; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.130 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1708503747; x=1709108547; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:ui-outboundreport:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=3yqSzdFwEDtgJigw4g1OESe0i9MdMzMhhczoKM1z55s=; b=hO6NBkMZdI4zK1Li3J2e1OisTA/T/saYBHBNy5rNlSuz56KOWykHAbeEhAw4nOmRyd o33ivBGN540zP6hFyuzJkKGbVE1Y7kOPg6gqBBcks0EsqzBz9vf3UZAU7kb7BRA3e31P LO6APU3JK7qUzGP8aV5mFvLoNPaUwq0/Y9AMSwNbI1uSIDyFsjKSxTaVlP+9rr/blVx0 /jLsGZTwoboaFH6vEM7b6Z+Tx38lv6ZIQu5yv1a61d/Bph2bagkZ4OaRdwGDJ80Mra3r 5EseOJ4kn9mZg0LtCsc9ZTxr6ZkokiGK87PkXTOk/8UHWkKfdPxLWP3Bx/GNWCzN33Ds 5AgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708503747; x=1709108547; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :ui-outboundreport:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=3yqSzdFwEDtgJigw4g1OESe0i9MdMzMhhczoKM1z55s=; b=fWtIE96KAyGHxYBce03AbztKzYyuKbfz6qEf4aFqiMGiEAOLnqkho2bx1xLk03q3RI xrhmHvidLotjtEhYyI5rmbkfAJ2FthVfjFrkmV5R0wgjoHNm05VEthvL7GKVBWFgmpTd Mb8rE652z7WBqBap5+XE6IniSdBHYlJ0mpmIMJIaAL5E2sE0nDdfm/gxt+x4yX/YqoTl NSVv2Pi4HYwBA5ltv3QjlmzsIhiciiLgyZa6oXW2PrRCJ04gXvz7TV2YKR+HyRNMxjLy WX6W/2FhQuBqJqIKWEMP5GILBPmBv5TJJpxMcBdXIgH+uFMvHRF++nNM7GovsHh+UJjS +XQA== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCUhD3mUf3kQtCuHdpk85a4iywSFvD5MpiNdKRQG7AJkfdew25kkGXYg+GTvJ9BiL9j8+0VGRfrUuXbNwnpRdfgQKZMnVMVdtpdKAPj9YQ== X-Gm-Message-State: AOJu0YzO9DsFJ/u25WG6UO/Zh1j7NMUJ3tLhkGcarEJy3rENjh4LLURH vwkaj7GO4Hwz0Thz0OjkjezVCT4rvNcHHCMwIn6FBGXf7w06GbZu X-Google-Smtp-Source: AGHT+IHA3fhjpNmrGt4DetdjXDXLLWA/RG+onTGj3CA4VwzXKcAsFyuI/9cUnzGoYyC2xNVJgNxvKg== X-Received: by 2002:aa7:d899:0:b0:564:4028:e2cf with SMTP id u25-20020aa7d899000000b005644028e2cfmr5481146edq.24.1708503746638; Wed, 21 Feb 2024 00:22:26 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6402:3705:b0:561:f0f1:15bb with SMTP id ek5-20020a056402370500b00561f0f115bbls762039edb.2.-pod-prod-02-eu; Wed, 21 Feb 2024 00:22:25 -0800 (PST) X-Received: by 2002:a17:907:76d4:b0:a3e:791d:afe6 with SMTP id kf20-20020a17090776d400b00a3e791dafe6mr5446280ejc.44.1708503744905; Wed, 21 Feb 2024 00:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708503744; cv=none; d=google.com; s=arc-20160816; b=0uz1Y4Syzo8Tf4eN7zxXcG2hQnohmJj6/dkW/KqxnyWEBptfLL8InMCGYXCM1BKqPD zp2oHzglYJ/qNKmigW9QZtzdxGUVhWLb5Pw70vdsi+pIkFmjFe7xfsEmKQ7bCgbFs9PX JWMUFdRGRUrQDVhBODSKdl3o94UwESltZwGHz2W2Brhsz4XsjIwklkJaOwVngEwiQuQT SL0h6vnZCj51zMi6Nn+qM3FkFV+9jAwREAuH3fPQBHJEqoL3hed7z4ZT3oegpkDEqRFB hik2dV75rAtoUHwuhlnh7FazT+dqIRiFX1TsePFLCMmGwo0Px0kkSMcuoCnu0cr0c5XQ dMhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=pNM9e1o5Y66ZZm6BNUKi7ShJ7JKJqADMU0rCnOJne5o=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=zCmzQUY4u01DhevGVF/K0n0F2BzFtaxXMNWQ/LlyWPkGTLshY1bIyCnqUHW4ujamxL 8xncH/LIY2Au1/fy1n6+W6tFQSqC6UrSlDlxt/XUb/64UPoH1sdhPnw4e5+DSrxDRCYu Vog0BmwD7RnEXQmbCEJWpzJRndVHbEsSyzzTZxokmeUw4WLM9Ly9CK9vm+v2XDNaHG2e SrsNZxW++ej5gzGsDysoO23XQhIprD3mQvEMWv7HdkE/CCVoPHk9zrC8ORrlKKMkmxdp L4A3NG0ISqAsYkLzLJwRJvoGyeZ38thSok99Ua2dqwcg6mjuRMTO161tkjjlhbndUDO5 rGTw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=tIH5jX6u; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.130 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.130]) by gmr-mx.google.com with ESMTPS id fx6-20020a170906b74600b00a3e643fea3fsi427840ejb.0.2024.02.21.00.22.24 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 00:22:24 -0800 (PST) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.130 as permitted sender) client-ip=212.227.126.130; X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mt7Ll-1qnm6z1sb3-00tQIl; Wed, 21 Feb 2024 09:22:24 +0100 From: Stefano Babic <stefano.babic@swupdate.org> To: swupdate@googlegroups.com Cc: Stefano Babic <stefano.babic@swupdate.org> Subject: [swupdate] [PATCH 05/13] Lua Script: runs with global Lua state Date: Wed, 21 Feb 2024 09:22:13 +0100 Message-Id: <20240221082221.11997-6-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240221082221.11997-1-stefano.babic@swupdate.org> References: <20240221082221.11997-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:WHYJO+tJjCIpKLiyDEkHZkUsVgTUHVmhBMA4kPh9/aUskdOrhaG 7+y1Bmv5dl6rfaV1MJNnIGj5ltlWRuEMbMRGUlpgqRYx0lEl/GLESUGQ2p8LJU3rnqIqF0C Q+eLPEnuBxjBnkx2ZDNp/IVKZieHBsPUJwRFrioBaXp5MqkpkPnGatt5z4MkGdRgdoFaaHK /kwfWxVn5BRzQgHWUgFMQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:ZyZUgeRvCK4=;LG8dKSDq6tc+34m7CxHYYIElnlY v0Ho3NyxWGQqMWYHVno9nQUl4xVJrKpVtIegDu5lIoAYI/qNe77S8Qk+rivuWIH66r1GrVSmL a9FPz9zcBItGXdAXnPG1Z5CP76q3/H/lSPTMmKagHsH9b4FiURbmvSA3duQoI+r7uJkN9JeMi 0ERzkVD4bf6GMfpoKmbRmgDwBMG8bwS/nxyeW3ksn9uf7hEDYPT7UObsVgJ16R+Zypftqf4+2 3rVkxeiSjpK4zONfFru9/WylBcM0us/zKZ104fofdSwYH0tuarJZuDXB2lviZktuX08wKGQDm 1qwl1TlEyyzZwbHrvLOpd9QP61LZ5A2AaXUTyIUatELLjfm6dCoMhfoaTJ+2QU8vTGQyCMZTU cg3IIWjyxn9sD6fkExINMWwW153SRLCV+RLGRgPCbL4DrklfNlmxQlzInCCfUZPa51fDjklZW Iws96OvYF2Rs29CMDw+1owTNcNV4URoVCKpkn+aIdBORt4gn6zxkWFhrAlZ+SWanDR/oyIVQ6 0rXXWPypNyViKiQQoQpibvgbt0XYj/dW59QGXyUMkvSchgRM6rFcKgWrPPDplfwfZBl+bV8bD CITpt3iySuyAdDhPWYdrSSUnahYNulr8ly1OYUaQofsrWuJEFLjoWhhQkjgdDTVoZ3QAiKV6K soL5+5pMlF6e0+UYXcZhzV3lGCcbAvoTeW4ZutOekI1dj3z2Htl8jEn5J3oSy05xVMtvkkoP5 64qKXEbklgpL/qOuqqk6MMyaKdYrk208nqTBaxgJGFvtvmCQjH5EQ8= X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=tIH5jX6u; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.130 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
Extend Lua Environemnt and post-failure scripts
|
expand
|
diff --git a/handlers/lua_scripthandler.c b/handlers/lua_scripthandler.c index d4ac421e..213099de 100644 --- a/handlers/lua_scripthandler.c +++ b/handlers/lua_scripthandler.c @@ -36,7 +36,14 @@ static int start_lua_script(struct img_type *img, void *data) if (!data) return -1; - L = lua_init(img->bootloader); + bool global = strtobool(dict_get_value(&img->properties, "global-state")); + + if (global) { + TRACE("Executing with global state"); + L = img->L; + } else { + L = lua_init(img->bootloader); + } if (!L) { ERROR("Lua state cannot be instantiated"); @@ -63,7 +70,8 @@ static int start_lua_script(struct img_type *img, void *data) ret = run_lua_script(L, filename, fnname, img->type_data); - lua_close(L); + if (!global) + lua_close(L); return ret; }
Add a property "global-state" to run the script with a per installation Lua state or creating a new local as in the past. If global-state = "true" (as property, value is always a string), Lua state is reused and the script can call any Lua function that was loaded before during the installation. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- handlers/lua_scripthandler.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.34.1