Message ID | 20231009153152.416365-3-stefano.babic@swupdate.org |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show
Return-Path: <swupdate+bncBAABB3FZSCUQMGQEBRYKBRI@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=lfkeoUGu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43a; helo=mail-wr1-x43a.google.com; envelope-from=swupdate+bncbaabb3fzscuqmgqebrykbri@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-wr1-x43a.google.com (mail-wr1-x43a.google.com [IPv6:2a00:1450:4864:20::43a]) (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 4S431F5mQcz20cr for <incoming@patchwork.ozlabs.org>; Tue, 10 Oct 2023 02:32:01 +1100 (AEDT) Received: by mail-wr1-x43a.google.com with SMTP id ffacd0b85a97d-3247f646affsf2147831f8f.1 for <incoming@patchwork.ozlabs.org>; Mon, 09 Oct 2023 08:32:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696865517; cv=pass; d=google.com; s=arc-20160816; b=Msdi++z2zyUB1PEL3uRE2e/5Ds9xSVBPTE0Jq2b/RSjCMYxeQvvF1ntQsiRFzmtQKI kSEwA38fqibaLIoKood7Evr6AXJmzmFVD0FFTG+0A40UwelC59BRJhULdnYXZsralMam KDqJWSWZbBstT1aI2bRcVn8YHGYE8WGQ4ecr5ms3o20PFW/M4Rh3yPDUczA+j3BBhieG R3raD5anqJn9iVXn1WJAuTWOfFsfxK+P8eLOy23LZWZGUVZoN6exhu9KBKuFyXJFD9bc Qw2khVELu2umr+9KhKZktu7FbGjXRGtKFGM9PWoPYSEOBQEDVz3+tXoqxLDIhPPOfkzO wlYA== 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=Y6C7zo9BG8HgKz9FowiLCCZXbL36PqMzapPk6rNp8gE=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=oEMPQ+btKzHG+2fOapdx6Nf3XMPaxRkKP2NTWYbuXXbZwg/YelMKL0BoIhZYVSFM4B YWmr/fEvd6Cyqp/AmCkg7ytkyCSj3IBb+AVhejypSAf08GEz1l8VrGMeCOGhrzKp1m5n QpcXS0iY7kAs5XAXu7Ryt7W9ACeq7Uxca0vLwHmZLgoj090EIl9TwTWB5Ir87OEmE0UF iguBZa6NZU3A2UHb4yUyCb2SKhmRE5dQvUPeQRsCL8t08MPhYvyRR5O4ndSHPeFPag0q mPRlHHLRvB+hQSMbLedn679OJER6aUJRZReVMQVACeaHwTczx4+4LGhplrzp6AWfcIFg RUwA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 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=1696865517; x=1697470317; 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=Y6C7zo9BG8HgKz9FowiLCCZXbL36PqMzapPk6rNp8gE=; b=lfkeoUGu5kugfTCNfmjkNzM2dVYzuNlsCoZwM3wp/tYiezfcyL0v/cc8cFL0CbZFV/ WdrDVwVZWIlJWDiINEVshIb9AKd2JRvie9E6Pf+rpm/H9nDa4uQyyou0uo1ASWzfpKoF bksxSkVEN93ycCmwNeDL8tP3884RCDB3BXe9N/p4+FZgooAn16BrnsEMXHL0C2oKxQwG ty9ntwgPIpV/acXm+U08XROclGQ7f2E9xz6oCh+7wW4lIwsk3+G/4NtME1XnQkBCy8x8 adbydHH/XJMEos1rG2D1yr/6iINY+xI2oku2Ttcvicu0ZOU8ThNg9eFmQ8jcrqUGj7q4 /hQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696865517; x=1697470317; 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=Y6C7zo9BG8HgKz9FowiLCCZXbL36PqMzapPk6rNp8gE=; b=PfNiVMcYME0vAUM3xnEFa7kQL0oTWXYTW731D6C3IJXLs/zOXhW8H3z29VNW7qivWF 1R54JAHG/H9mOkDTPxs3eRIvbRwbdi42rOGYfqWGdFRdhbQ4O02J+bTxXHKwdGDFJKVZ v0YY3SVUxKu8DKpKaB9yT2LJDtPCBxTZSoLGXAoJnqMsXZKahddPEI/7zhxsPZ6TH2Kx 2MDITw27s1v8Xa+gl2D3/vXBMQNr162vi948Vzy1LYV3fb/jRxEUhmP7sDgWQTeIF2pm SYcrm1lyH6+6bt7d+71YTjh6W9S5RiVR10/YTmApwiEAYfwCRE7ZgHUhQ6lopKMiXf67 rWtw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0Yy6+zuQ1F2zDbBMTRaUDQYnQ8i1gL0p9abRzg7dCSbmRNA5tiJY sW19J1uTNizw1+tKCoM80UQ= X-Google-Smtp-Source: AGHT+IG3mJW/b3yGtR5C7LqvfASymWK3lutncySXoQNofFgYT+0Q02uZFb86v60xZdW9964IR8dAsw== X-Received: by 2002:a5d:4d0a:0:b0:323:1738:1c35 with SMTP id z10-20020a5d4d0a000000b0032317381c35mr9740447wrt.26.1696865517174; Mon, 09 Oct 2023 08:31:57 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:ee8f:0:b0:312:831e:dc1b with SMTP id b15-20020adfee8f000000b00312831edc1bls426934wro.2.-pod-prod-00-eu; Mon, 09 Oct 2023 08:31:55 -0700 (PDT) X-Received: by 2002:a5d:658e:0:b0:329:6b53:2c82 with SMTP id q14-20020a5d658e000000b003296b532c82mr7590437wru.31.1696865515383; Mon, 09 Oct 2023 08:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696865515; cv=none; d=google.com; s=arc-20160816; b=RhjTWgCMiLGjPPx1OYrNkTWdjfjPq7PKc8kmG3A9Ji6bItiwt4xe0HyP4YUhkVgtAm 2oSTeM5kAcauqpStcGnFmHkN80ECBsg78wMlf4kwhFYUzvpEw/8p/gLULrZQqgh1NnXY QlXWXfA8jTn//UDo8c8JW4D8XiwYvN1c79ZwfzxgkUL+yIHwEbPTbfbH6P0T+WcrsoDB IGHBjZJLbIzbG+OEnIjIy1odsTyZqOlhKtP2cep28t+rou4k2XLkyrogrhRE0T8rfBSf CbqNB+kTwMVvvUy/fz1QFLrTRFK8WNN28Zd+bevY/KrJQoBfNyc9aYgc44zym1PDxRqL +Rew== 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; bh=eRCwqeeu2hgdV9vJdFG55hvglzbb5WhN4iHLB0i/pgQ=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=Xt5eEuXs4LzdJxD4OtFk45IkM/Ffqda29YPPrSqnAXbSi4at6QB+tYln2srOt6bc08 2Wz4zn+76KsXO18FKuVMZI2MDSp9c5IwGXLqMO5zbT6Sg3SRcqLeoPdsDm8732XfbNrF FoBOM822cElE/1ycACE89unEtYQ6NFfRUco+9FueWF/JwBb6UD74YFeFzGFUiYstVZB7 IF3swh6yDdwiOumRP9PP04dGsDb3adJnUhra0ajyu9shl8hQ74B3V6O+sqhuDpvfXqCL IFpX8ifYqKWyvo5HDf9aGQlcY4aXAF231r5KAPsdoOpnwd7B/45+IvTjHZwbu7ia0ep8 hQIA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.13]) by gmr-mx.google.com with ESMTPS id ay17-20020a5d6f11000000b00325960b967dsi362523wrb.3.2023.10.09.08.31.55 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 as permitted sender) client-ip=212.227.17.13; Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MD9Kp-1qhNuN3r5l-0098tU; Mon, 09 Oct 2023 17:31:54 +0200 From: Stefano Babic <stefano.babic@swupdate.org> To: swupdate@googlegroups.com Cc: Stefano Babic <stefano.babic@swupdate.org> Subject: [swupdate] [PATCH 2/7] installer: factorize function for preparing env script Date: Mon, 9 Oct 2023 17:31:47 +0200 Message-Id: <20231009153152.416365-3-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009153152.416365-1-stefano.babic@swupdate.org> References: <20231009153152.416365-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:p1UhTFdPFxSE7YfohP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if JoVDwBvBHZDkuHOJZYfu4p4sqbcV805XdGksL0V/5vfrn2gDUkPF+MKE/0sHZt4x9ILxSAV99 bGVVWu9w4TE+pbw== X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 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 |
Introduce SWUpdate environment
|
expand
|
diff --git a/core/installer.c b/core/installer.c index 768503fb..0088d1a3 100644 --- a/core/installer.c +++ b/core/installer.c @@ -155,10 +155,9 @@ static int extract_scripts(struct imglist *head) return 0; } -static int update_bootloader_env(struct swupdate_cfg *cfg, const char *script) +static int prepare_var_script(struct dict *dict, const char *script) { int fd; - int ret = 0; struct dict_entry *bootvar; char buf[MAX_BOOT_SCRIPT_LINE_LENGTH]; @@ -166,7 +165,7 @@ static int update_bootloader_env(struct swupdate_cfg *cfg, const char *script) if (fd < 0) return -1; - LIST_FOREACH(bootvar, &cfg->bootloader, next) { + LIST_FOREACH(bootvar, dict, next) { char *key = dict_entry_get_key(bootvar); char *value = dict_entry_get_value(bootvar); @@ -181,6 +180,17 @@ static int update_bootloader_env(struct swupdate_cfg *cfg, const char *script) } close(fd); + return 0; +} + +static int update_bootloader_env(struct swupdate_cfg *cfg, const char *script) +{ + int ret = 0; + + ret = prepare_var_script(&cfg->bootloader, script); + if (ret) + return ret; + if ((ret = bootloader_apply_list(script)) < 0) { ERROR("Bootloader-specific error %d updating its environment", ret); }
This can be reused for vars that do not belong to the bootloader. Extract the function as preparation for general purpose vars. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- core/installer.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)