From patchwork Sun Apr 2 16:56:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 6763 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PqKv96Wryz3wvh for ; Sun, 2 Apr 2023 16:57:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PqKv93tvcz4b; Sun, 2 Apr 2023 16:57:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PqKv93QJbz2x9j; Sun, 2 Apr 2023 16:57:09 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4PqKv81bghz2x9j for ; Sun, 2 Apr 2023 16:57:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (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 mail01.ipfire.org (Postfix) with ESMTPSA id 4PqKv74l7Yz4b; Sun, 2 Apr 2023 16:57:07 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1680454627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d0NjKbfTQzOWmWCnXo64PKfaDOIc9sPNtU+ec1W06L4=; b=CfARXgzWG8+CpqDaZiqg8fPR5xso1CzNjsA777i8aweZusXr3Bb/QpxSuNfxr5uksXVrg+ 5NI3yeikl2mPFrBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1680454627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d0NjKbfTQzOWmWCnXo64PKfaDOIc9sPNtU+ec1W06L4=; b=vPlV3xy0g15AYHRYbQi3JOg4IaaOhc/GOvh1rZhVMOpo1I6+SYVANYzGo10YMK2KvwQy0u xi5WKIU/9eS2sKQKmfDj4uiUZZcX5gTVYr9u/GLf/NyPlORTpvKKLr5Rniqhi8dsPSFkK7 PnlNDUI54WcB4I/s3XWx8FdzqCHyt88taVI8tiYTXAUTMZgWi7H/cZ3iuKJNv7GIetkNdU lJolKEvKaOOpa5DYHK6sE0qCgAFGFMrzj3YYuCLBws8SJQ/NPIV9xnq+H2lY/N5sfc5aw3 Jb80eM8LzGrlGCqX/SCy4mJCC8I8bzmomVSYwhI82UGt1zZIlDdUqqOc+2bSWQ== From: Stefan Schantl To: pakfire@lists.ipfire.org Subject: [PATCHv2] macros: Add macro to apply sysusers based users/groups inside the jail Date: Sun, 2 Apr 2023 18:56:59 +0200 Message-Id: <20230402165659.3998-1-stefan.schantl@ipfire.org> In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: pakfire@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Mailinglist for the Pakfire Build System." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pakfire-bounces@lists.ipfire.org Sender: "Pakfire" This macro can be called inside a build file and easily allows to apply any kind of users/groups specified in a sysusers file. Signed-off-by: Stefan Schantl --- macros/systemd.macro | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/macros/systemd.macro b/macros/systemd.macro index 7a40cff6..0da90468 100644 --- a/macros/systemd.macro +++ b/macros/systemd.macro @@ -1,3 +1,14 @@ +MACRO_APPLY_SYSTEMD_SYSUSERS + mkdir -pv %{sysusersdir} + + for file in %{DIR_SOURCE}/*.sysusers; do + [ -e "${file}" ] || continue + cat ${file} | \ + systemd-sysusers --replace=%{sysusersdir}/$(basename ${file%*.sysusers}).conf - + done + unset file +end + MACRO_INSTALL_SYSTEMD_FILES for file in %{DIR_SOURCE}/systemd/*; do [ -e "${file}" ] || continue