From patchwork Wed Nov 9 12:46:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayoub Zaki X-Patchwork-Id: 1701735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::23d; helo=mail-lj1-x23d.google.com; envelope-from=swupdate+bncbdbktzhrzujrbrocv2nqmgqelnczzda@googlegroups.com; receiver=) 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=20210112 header.b=j+Cz1nkp; dkim-atps=neutral Received: from mail-lj1-x23d.google.com (mail-lj1-x23d.google.com [IPv6:2a00:1450:4864:20::23d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N6l994zKbz23ll for ; Wed, 9 Nov 2022 23:47:07 +1100 (AEDT) Received: by mail-lj1-x23d.google.com with SMTP id t9-20020a2e7809000000b00277524ccb02sf6115839ljc.1 for ; Wed, 09 Nov 2022 04:47:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1667998022; cv=pass; d=google.com; s=arc-20160816; b=i8PDanBC6/TLnQhn7rN9B00CPLQwbum6cwgdrTlvjQNhZiVDYznlB2qTZCeXj001Qu +8qwnax/X6T2kh3/Wfrq9Qn01IR5PpYiplMcGBCTKbUFODJDe9CSaoZRN9URI/To4gRC S+uX0MMG7ImHsWfQ5Z5q577ckKiLM0ylrC++gzRj2ze1XqU08IlYfI34ikQ6xSurAjUN sw23CzQyWtlCWof3NwyT+K9XZd6lDoqwckSjIirzezWPb8CyhIypjmHLMuP9WJ+rlDIO Bu2nJgeDuKS1QnHfJkJ8H6eekhcrR84PGMpAqg9XYcjKKYb9E3wn+sD6OiiarNq5eSfC 5brA== 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:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=0eKWdBFai0zGmuTP+l6P3oesI2divAAP7P3KOU3ZSXI=; b=posXtfLAwL8Nj1o308Hpkiz4pa8/5YkCnxcqoFQ+QkTto0iBUEftqcKBCbQSTBho4U XdYLAxBnmXl5AvqXr1UmsC2KqoVBW+gILMbVRVpJjbxoBmgmkk4h2J/SjNuO/8nDR98s 0hYa8IBg0rlyIQ6kI+L/o/SkIZzAS1Fmx4TRI2L6ijE+5pUWg0GtJJqKWb5Zh2yRT4nw pleXyjIfHcuo3OQQQDiBry1NZtsYglnJOYYbXDfknGy2Wh37EqeTViBBE5n0beXHneQ2 zCKq2B53FRyxs13ZMPwtv26I7SBt9FnfPFK2N8KhfqLOE7sNkIX5E+oZNgMeW3ueEW4G byhQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@embetrix.com header.s=rsa1 header.b="LC/pOP7J"; dkim=neutral (no key) header.i=@embetrix.com header.b=DSrcoWET; spf=neutral (google.com: 2a02:2350:5:503::1 is neither permitted nor denied by best guess record for domain of ayoub.zaki@embetrix.com) smtp.mailfrom=ayoub.zaki@embetrix.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=0eKWdBFai0zGmuTP+l6P3oesI2divAAP7P3KOU3ZSXI=; b=j+Cz1nkpWH2W3MD58xKXaquavASA+t3pAk2SAP9x13iEVa7h7Y9J1iKMd6QGlWvdxx bX5/jegIxa98NpfPd/BbA7m4CgLZl3fJYzO+YGcxW5zGj3BoCdQO60qOdPDtQuUC5ojF 48TTvmDwW0MYrx7TxJmm/W8yV54F9l6ThsY730jd49+t+ShtTlNPWWVnA+ReKQNitKML HmiIa76E0RtpGsFYn9M3itKgdFSYLSGX3lkU3xjJO01vMr7yuqubhOSdL40pIvxqSakg JxGXA8IQV/rOI0MdYwsN6abEaE0KTMAnHjw5PGCKvzKq+Rxr9omx2mRSD6N7GkNVLuFQ UQRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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:mime-version :message-id:date:subject:cc:to:from:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=0eKWdBFai0zGmuTP+l6P3oesI2divAAP7P3KOU3ZSXI=; b=pKugzaXRj+I9f/4A+C+T23lQJJ8NB/g4C2skqlfdcLQNS2VcupEIFBr9ZiR8E+OhTU Ehw2g1+fxl2aXreR+Ipb4wUkvevBETB7NyRUZ0Jqzi00UBArqMqGZZUwwsb86jFWmPsM seIXDxSk9HZadLvZlH+U3XpehXJXi1qHnX+P4c+hu8V14qnCEHcDmiMvekDPFpCTWiM9 6aWhIwLipYKm7zrugBf3YZf+S+YHgY5X6m6REz64KIiIsQiaX9AL51oLHpK+ZZFnRBUf 5lTHGeoA9Cc2F2bfRjsWgI8TdRQeCjDqcHQtuqYqZWk4yNz8fPxmtqL2N/5449I8sPQ2 XKKQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: ACrzQf2LJqxI8YpYoKoDAnrNRoe12DA1wroonJ63Kricv5+EQSdbdIAK Vj3x811xO3qXGdiNdJ9QlF8= X-Google-Smtp-Source: AMsMyM6vRr5DYoG7mqYqu6OOxiQOLjG+ukeAnDRMijP/I3EEGga1ZDNNTkr3yVxAFV6wi48oIpKXwg== X-Received: by 2002:a05:6512:4016:b0:4a4:6edb:8d6e with SMTP id br22-20020a056512401600b004a46edb8d6emr22496943lfb.393.1667998022272; Wed, 09 Nov 2022 04:47:02 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:ac2:58f3:0:b0:49a:b814:856d with SMTP id v19-20020ac258f3000000b0049ab814856dls4054013lfo.1.-pod-prod-gmail; Wed, 09 Nov 2022 04:47:00 -0800 (PST) X-Received: by 2002:ac2:4d88:0:b0:4b4:106d:f609 with SMTP id g8-20020ac24d88000000b004b4106df609mr2345820lfe.619.1667998020612; Wed, 09 Nov 2022 04:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667998020; cv=none; d=google.com; s=arc-20160816; b=mex+D8T4R85uo3D1YzWi6+fLL8VOPthGoYZuIj2pHU1wEiBmsGayDfijnK7XYP125p t3mRbSjrJQYyPx2S9wX0YiMKh1QoBiJ1IXNXKQ68mGhJfvNgWuUcfSx+7gtJ6wdWQQYO K665pC8WJ88XCMNqzJP+i8kt64AcqFpXLE789R6+3HYAAnSThU28jFvG16oLGbfDBU8G 6VDRPtBli6IAOuKLgiobVaGW9GzZJ9GNW18KCRFvCJvkDN7qzwu3GDgxFyRa7w1xctX6 vubnypfg56BAJU+jnnpII6pdle+ykL4RuMB8NV8c7lL4Xs+DdS/fFWZzPNzygQVEhOw8 aXSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:dkim-signature; bh=nmn3NyXokOZavvp0mZMjDQ2Ka1D0StK9mBHP+fOE6oI=; b=wOZ1axAyQMA4ecwTRtBlkbSqYrqKCz0Mo0yk7JTJ1k4wubxdCnzbjIgWmSCaYAa0Qm I8dEmF8xl/XJeopKnKQJcSVCUJNHIVATDvaZI6uywyv+54Pa/iR2EmmGntLmmV8JSFkq hZJ9P2erc+/sOx412fRlGC85eXrSXR32BgtZZ0nX8iD8LsBrPB51w+te4/66xDp1YbQ4 r7xS0jNExjRlfv25wUyKJtzcMU3oAXPQURWLcpr1MjFf9rwBRJpLf2D6stxK/NsEoLui riYFj3ugS2WpaLAP6HXXo7G0NykNVh8xL6yW/uuY+VNHPgtTMBSgB2eLuNrcnsTSZ/vs hBhw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@embetrix.com header.s=rsa1 header.b="LC/pOP7J"; dkim=neutral (no key) header.i=@embetrix.com header.b=DSrcoWET; spf=neutral (google.com: 2a02:2350:5:503::1 is neither permitted nor denied by best guess record for domain of ayoub.zaki@embetrix.com) smtp.mailfrom=ayoub.zaki@embetrix.com Received: from mailrelay4-3.pub.mailoutpod2-cph3.one.com (mailrelay4-3.pub.mailoutpod2-cph3.one.com. [2a02:2350:5:503::1]) by gmr-mx.google.com with ESMTPS id v18-20020ac258f2000000b00492ce810d43si371906lfo.10.2022.11.09.04.47.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 04:47:00 -0800 (PST) Received-SPF: neutral (google.com: 2a02:2350:5:503::1 is neither permitted nor denied by best guess record for domain of ayoub.zaki@embetrix.com) client-ip=2a02:2350:5:503::1; X-HalOne-ID: 990072d6-602c-11ed-81ba-45c065e8efb0 Received: from xps13.fritz.box (dynamic-2a02-3102-8c10-00a0-3460-cf69-f10a-c2ac.310.pool.telefonica.de [2a02:3102:8c10:a0:3460:cf69:f10a:c2ac]) by mailrelay4 (Halon) with ESMTPSA id 990072d6-602c-11ed-81ba-45c065e8efb0; Wed, 09 Nov 2022 12:47:00 +0000 (UTC) From: Ayoub Zaki To: swupdate@googlegroups.com, ayoub.zaki@embexus.com Cc: Ayoub Zaki Subject: [swupdate] [PATCH] Add umount flag for archive handler Date: Wed, 9 Nov 2022 13:46:58 +0100 Message-Id: <20221109124658.253373-1-ayoub.zaki@embetrix.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Original-Sender: ayoub.zaki@embetrix.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@embetrix.com header.s=rsa1 header.b="LC/pOP7J"; dkim=neutral (no key) header.i=@embetrix.com header.b=DSrcoWET; spf=neutral (google.com: 2a02:2350:5:503::1 is neither permitted nor denied by best guess record for domain of ayoub.zaki@embetrix.com) smtp.mailfrom=ayoub.zaki@embetrix.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , add new flag to control if path should be umounted this is only useful if the mount point specified by path is already mounted outside of swupdate. Signed-off-by: Ayoub Zaki --- doc/source/sw-description.rst | 6 ++++++ handlers/archive_handler.c | 8 ++++++++ include/swupdate.h | 1 + parser/parser.c | 1 + 4 files changed, 16 insertions(+) diff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst index a5182d6..13bba2e 100644 --- a/doc/source/sw-description.rst +++ b/doc/source/sw-description.rst @@ -1319,6 +1319,12 @@ There are 4 main sections inside sw-description: | | | | "filesystem" type. (path is always | | | | | relative to the mount point.) | +-------------+----------+------------+---------------------------------------+ + | umount | bool | files | flag to control whether the given | + | | | | mount point specified by path | + | | | | (absolute) where the files are | + | | | | are installed if already mounted | + | | | | outside SWUpdate should be umounted | + +-------------+----------+------------+---------------------------------------+ | preserve-\ | bool | files | flag to control whether the following | | attributes | | | attributes will be preserved when | | | | | files are unpacked from an archive | diff --git a/handlers/archive_handler.c b/handlers/archive_handler.c index e3a1463..553287f 100644 --- a/handlers/archive_handler.c +++ b/handlers/archive_handler.c @@ -228,6 +228,7 @@ static int install_archive_image(struct img_type *img, struct extract_data tf; pthread_attr_t attr; int use_mount = (strlen(img->device) && strlen(img->filesystem)) ? 1 : 0; + int use_umount = img->umount; int is_mounted = 0; int exitval = -EFAULT; char *DATADST_DIR = NULL; @@ -380,6 +381,13 @@ out: } } + if (use_umount && !use_mount) { + ret = swupdate_umount(img->path); + if (ret) { + TRACE("Failed to unmount directory %s", img->path); + } + } + free(DATADST_DIR); free(FIFO); diff --git a/include/swupdate.h b/include/swupdate.h index 4cce892..89f64ea 100644 --- a/include/swupdate.h +++ b/include/swupdate.h @@ -81,6 +81,7 @@ struct img_type { int provided; int compressed; int preserve_attributes; /* whether to preserve attributes in archives */ + bool umount; bool is_encrypted; char ivt_ascii[33]; int install_directly; diff --git a/parser/parser.c b/parser/parser.c index 5607031..81f69be 100644 --- a/parser/parser.c +++ b/parser/parser.c @@ -436,6 +436,7 @@ static int parse_common_attributes(parsertype p, void *elem, struct img_type *im } get_field(p, elem, "installed-directly", &image->install_directly); get_field(p, elem, "preserve-attributes", &image->preserve_attributes); + get_field(p, elem, "umount", &image->umount); get_field(p, elem, "install-if-different", &image->id.install_if_different); get_field(p, elem, "install-if-higher", &image->id.install_if_higher); get_field(p, elem, "encrypted", &image->is_encrypted);