git: 8461b8f7efa2 - stable/12 - periodic: by default, skip 221.backup-gpart in jails

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Thu, 07 Oct 2021 19:45:40 UTC
The branch stable/12 has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=8461b8f7efa2ea118e19e6702dd3a3f1de9b1a69

commit 8461b8f7efa2ea118e19e6702dd3a3f1de9b1a69
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2021-06-18 14:33:08 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2021-10-07 19:45:32 +0000

    periodic: by default, skip 221.backup-gpart in jails
    
    It can still be enabled as usual in /etc/periodic.conf
    
    PR:             256253
    Reported by:    delphij
    Submitted by:   Miroslav Lachman <000.fbsd@quip.cz>
    
    (cherry picked from commit fcf2227a557552e45646bbcf2422a98baab5c8a8)
---
 usr.sbin/periodic/periodic.conf | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/periodic/periodic.conf b/usr.sbin/periodic/periodic.conf
index d2d59fb783b0..4429c8d48eea 100644
--- a/usr.sbin/periodic/periodic.conf
+++ b/usr.sbin/periodic/periodic.conf
@@ -78,7 +78,12 @@ daily_backup_passwd_enable="YES"			# Backup passwd & group
 daily_backup_aliases_enable="YES"			# Backup mail aliases
 
 # 221.backup-gpart
-daily_backup_gpart_enable="YES"             		# Backup partition table/boot partition/MBR
+if [ $(sysctl -n security.jail.jailed) = 0 ]; then
+        # Backup partition table/boot partition/MBR
+        daily_backup_gpart_enable="YES"
+else
+        daily_backup_gpart_enable="NO"
+fi
 daily_backup_gpart_verbose="NO"             		# Be verbose if new backup differs from the old one
 daily_backup_efi_enable="NO"                		# Backup EFI system partition (ESP)