From patchwork Tue Mar 30 15:28:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 4002 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 4F8tfr25qSz3ws3 for ; Tue, 30 Mar 2021 15:29:56 +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 4F8tfq69qJz1V2; Tue, 30 Mar 2021 15:29:55 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4F8tfq5mvHz2xVT; Tue, 30 Mar 2021 15:29:55 +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 4F8tfp60hDz2xBf for ; Tue, 30 Mar 2021 15:29:54 +0000 (UTC) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4F8tfp1GX5zhP for ; Tue, 30 Mar 2021 15:29:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id D79E250D0D for ; Tue, 30 Mar 2021 17:29:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y1Q0Os5y_J7P for ; Tue, 30 Mar 2021 17:29:52 +0200 (CEST) Received: from amaterasu.sicho.home ([192.168.0.1] helo=chojin.sicho.home) by filekeeper.sicho.home with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1lRGIz-00046g-15; Tue, 30 Mar 2021 17:29:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1617118192; bh=hHJENc70C0ZHWBG0SKn9sZlG2o96aD+gBzE16qZT55M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=g7hFBKXCE38hS6sVITeeCSx07YiFxYMyWkpLHORvVpSd12d3m3ackEgH4tuHI2QCz avbfsGoEqhKXhFKDIIgOV+tWWNnxM5TQc2ZhYh4m7IVK81askGlACQ3nAzFcMJlwjR 5mXIEARNOKdH7aaXko3I7e2QaHynyBvWPOZuLiZD++19bMgcfQsYD8nDQt88MuuXus zTr7ibO2Cz18v1/2huvckvffgEV0H0j4oE/knAK0xIIlOYvMpSGZvWBuflCyEUmOad eu5bJfINPKVy00vkME4pqPPVE490UgdJYfEZehfqFAfPVNQBRgg3o3UuStVVceabK6 h1/ZCgxdR6NBA== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 2/4] zabbix_agentd: Fix agent modules directory Date: Tue, 30 Mar 2021 17:28:28 +0200 Message-Id: <20210330152830.2859-3-robin.roevens@disroot.org> In-Reply-To: <20210330152830.2859-1-robin.roevens@disroot.org> References: <20210330152830.2859-1-robin.roevens@disroot.org> Mime-Version: 1.0 X-filekeeper-MailScanner-ID: 1lRGIz-00046g-15 X-filekeeper-MailScanner: Found to be clean X-filekeeper-MailScanner-From: robin.roevens@disroot.org X-filekeeper-MailScanner-Watermark: 1617722969.17565@72WuRDTWab+387HKhO63Xg ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=g7hFBKXC; dmarc=pass (policy=quarantine) header.from=disroot.org; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1617118194; a=rsa-sha256; cv=none; b=EEs1mB1p2ilFdR7gEkGJnolHGLW2uuUgDxx5AaJMGGsOXWfP4TcrqeAWdxUdch0pKh5m3S CDDtPN7JRwnuEXwjN4eFgWTqt951zPWKb9hVvIj0HMAPrNRhyZ6lAHa+bLwOf0sCW9DPEf F3z2Oh1+hIKTa3wOIiR80k6NVJ28tgwm5SJgkt2cpUKgz9fWRhxpBjKyd1ZQPomGF24tKG g5D16YrA14MGhH3ZeFY4IxPJ2Q5o/+ZTEDQUDylzKu/ZxEd3cmgbU4GsgYqaek6AiyLQNj ftmCHojBf+GGJ1Cehs/84uXoyRfYk3N0Ig6QMIQNlFUpOOS3VNmF6GjrsA/HKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1617118194; 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:dkim-signature; bh=Zy9o5gMM8JlvyWPmhn+E2m7z/s/UqDK1k3idvRTsP3k=; b=mhCXtEgafpw/lPtOUIDTrKdspx/8lGLoWvcNw+CI7mEb8bmxFPQFOkNYnb15icfdEQns9a XdyLJCPtnJnzvJMqTtFM35AXz0e5YubKKWDh9wmujQOKWvCa/WMzxhZzI3BndWn4HF8tLe JR4wAmH90OG+xwTsJ2NpOZmpo/LsYkeCj1uXAtA3EOaJcR46DKGTY/WK6AX7VPj/XkmzTP e0vZ1w3I654UAtGRI2EAmRe74WWwcCv3FCnb7WF7ErDfvVySPh3rPT7rPqnHq/kv1rW6oz AjcV7Usumx5TPL9TW3WUH0mtYP56L50vdeKLb4P3g1r5UPN+GQowd+RhoKe7HQ== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=g7hFBKXC; dmarc=pass (policy=quarantine) header.from=disroot.org; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-2.51 / 11.00]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:c]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; R_MISSING_CHARSET(2.50)[]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_REPUTATION_HAM(-0.01)[asn: 50673(0.00), country: NL(-0.01), ip: 178.21.23.139(0.00)]; DKIM_TRACE(0.00)[disroot.org:+]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,quarantine]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; BAYES_HAM(-3.00)[99.99%] X-Rspamd-Queue-Id: 4F8tfp1GX5zhP X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" - Add agent modules-dir to backup - Remove original, not used agent modules dir from rootfile - Delete agent modules dir only when empty on uninstall thus keeping possible user deployed custom module files but removing it if unused. Signed-off-by: Robin Roevens --- config/backup/includes/zabbix_agentd | 3 ++- config/rootfiles/packages/zabbix_agentd | 4 ++-- src/paks/zabbix_agentd/install.sh | 2 ++ src/paks/zabbix_agentd/uninstall.sh | 5 +++++ src/paks/zabbix_agentd/update.sh | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/config/backup/includes/zabbix_agentd b/config/backup/includes/zabbix_agentd index cba18d772..d3305cb96 100644 --- a/config/backup/includes/zabbix_agentd +++ b/config/backup/includes/zabbix_agentd @@ -1,2 +1,3 @@ /etc/sudoers.d/zabbix -/etc/zabbix_agentd/* +/etc/zabbix_agentd/ +/usr/lib/zabbix/ diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packages/zabbix_agentd index 4420bda05..a938f2605 100644 --- a/config/rootfiles/packages/zabbix_agentd +++ b/config/rootfiles/packages/zabbix_agentd @@ -8,8 +8,8 @@ etc/zabbix_agentd/zabbix_agentd.d etc/zabbix_agentd/zabbix_agentd.d/userparameter_pakfire.conf usr/bin/zabbix_get usr/bin/zabbix_sender -usr/lib/modules -usr/lib/zabbix +#usr/lib/modules +#usr/lib/zabbix usr/sbin/zabbix_agentd #usr/share/man/man1/zabbix_get.1 #usr/share/man/man1/zabbix_sender.1 diff --git a/src/paks/zabbix_agentd/install.sh b/src/paks/zabbix_agentd/install.sh index e1450a1d8..b98230ea1 100644 --- a/src/paks/zabbix_agentd/install.sh +++ b/src/paks/zabbix_agentd/install.sh @@ -41,6 +41,8 @@ ln -sf ../init.d/zabbix_agentd /etc/rc.d/rc6.d/K02zabbix_agentd # Create additonal directories and set permissions mkdir -pv /var/log/zabbix chown zabbix.zabbix /var/log/zabbix +mkdir -pv /usr/lib/zabbix +chown zabbix.zabbix /usr/lib/zabbix restore_backup ${NAME} start_service --background ${NAME} diff --git a/src/paks/zabbix_agentd/uninstall.sh b/src/paks/zabbix_agentd/uninstall.sh index edff3b818..b771d1f63 100644 --- a/src/paks/zabbix_agentd/uninstall.sh +++ b/src/paks/zabbix_agentd/uninstall.sh @@ -26,5 +26,10 @@ stop_service ${NAME} make_backup ${NAME} remove_files +# Remove agent modules dir if empty +if [ -z "$(ls -A /usr/lib/zabbix/)" ]; then + rmdir /usr/lib/zabbix +fi + # Remove init-scripts and symlinks rm -rfv /etc/rc.d/rc*.d/*zabbix_agentd diff --git a/src/paks/zabbix_agentd/update.sh b/src/paks/zabbix_agentd/update.sh index 7fc1c96fb..68bba4f80 100644 --- a/src/paks/zabbix_agentd/update.sh +++ b/src/paks/zabbix_agentd/update.sh @@ -22,6 +22,7 @@ ############################################################################ # . /opt/pakfire/lib/functions.sh +extract_backup_includes ./uninstall.sh ./install.sh