From patchwork Fri Mar 15 19:14:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7625 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTb46yhz3wnw for ; Fri, 15 Mar 2024 19:14:59 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTX2bKnzFL2; Fri, 15 Mar 2024 19:14:56 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTX24tlz32pl; Fri, 15 Mar 2024 19:14:56 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTT5NqHz32P8 for ; Fri, 15 Mar 2024 19:14:53 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTT1yx0znj; Fri, 15 Mar 2024 19:14:53 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530093; 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=127ufQ69cf9U++C637loDQ3k9S8r7Pnk2iPqU0Vo86Y=; b=755Ch95EUUexA5Mv8ki35m922ueVGLLke3a8spXSnJYbES+7ko/9oDaOchm708VnIIk/ek L7ZsONNdqtBh3PCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530093; 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=127ufQ69cf9U++C637loDQ3k9S8r7Pnk2iPqU0Vo86Y=; b=h5t4g1A9yi/n4nM7dSz4/XfQlefangHHGiJMlKjF2oReBtfzD8ZJdu85W++fVwvpZU8CRd g4qnmumCArOs9ScUiavo+nlt0IgqmqhsduLpMzWo3Sw3M3o5qk92wzaqxDWQb/DKp56dHd N3TQo0XZDk+zmqOM8GxLCjv0GnlOE5dPn4WOBs3sdpe8++N3i1M7j22aaGycp5oiNvrSGG EJqnd8wpIjTOiC0Ua/Fqs/SzZARTcBP2Dds7Opgx7GrLuxzgT53K4lkwPeD7+c/wkLCPuT aMMf9Dtg/fF0ckF8p918+9VQcanNBp67XXco5vcXePnbJ5jw0ceGlk/dIdFSFQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 01/17] btrfs-progs: New package Date: Fri, 15 Mar 2024 20:14:26 +0100 Message-Id: <20240315191442.3951-2-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: NJUHQDWBMFLRDGZC6IUCDFV5GEGJCBUW X-Message-ID-Hash: NJUHQDWBMFLRDGZC6IUCDFV5GEGJCBUW X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- config/rootfiles/common/btrfs-progs | 33 +++++++++++ lfs/btrfs-progs | 85 +++++++++++++++++++++++++++++ make.sh | 1 + 3 files changed, 119 insertions(+) create mode 100644 config/rootfiles/common/btrfs-progs create mode 100644 lfs/btrfs-progs diff --git a/config/rootfiles/common/btrfs-progs b/config/rootfiles/common/btrfs-progs new file mode 100644 index 000000000..04af32d3f --- /dev/null +++ b/config/rootfiles/common/btrfs-progs @@ -0,0 +1,33 @@ +lib/udev/rules.d/64-btrfs-dm.rules +lib/udev/rules.d/64-btrfs-zoned.rules +usr/bin/btrfs +usr/bin/btrfs-convert +usr/bin/btrfs-find-root +usr/bin/btrfs-image +usr/bin/btrfs-map-logical +usr/bin/btrfs-select-super +usr/bin/btrfsck +usr/bin/btrfstune +usr/bin/fsck.btrfs +usr/bin/mkfs.btrfs +#usr/include/btrfs +#usr/include/btrfs/ctree.h +#usr/include/btrfs/ioctl.h +#usr/include/btrfs/kerncompat.h +#usr/include/btrfs/list.h +#usr/include/btrfs/rbtree.h +#usr/include/btrfs/rbtree_types.h +#usr/include/btrfs/send-stream.h +#usr/include/btrfs/send-utils.h +#usr/include/btrfs/send.h +#usr/include/btrfs/version.h +#usr/include/btrfsutil.h +#usr/lib/libbtrfs.a +#usr/lib/libbtrfs.so +usr/lib/libbtrfs.so.0 +usr/lib/libbtrfs.so.0.1 +#usr/lib/libbtrfsutil.a +#usr/lib/libbtrfsutil.so +usr/lib/libbtrfsutil.so.1 +usr/lib/libbtrfsutil.so.1.2.0 +#usr/lib/pkgconfig/libbtrfsutil.pc diff --git a/lfs/btrfs-progs b/lfs/btrfs-progs new file mode 100644 index 000000000..caf8f0b96 --- /dev/null +++ b/lfs/btrfs-progs @@ -0,0 +1,85 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2023 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 6.7.1 + +THISAPP = btrfs-progs-v$(VER) +DL_FILE = $(THISAPP).tar.xz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_BLAKE2 = 4e05e9dd80e5531425490970318389aef280f61cc636a80aa2bbc630399afd4f1f3ce649d194822ff93ff4b1774d65a504e3bed6f1426ff60830e4c0d0ac87b0 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +b2 : $(subst %,%_BLAKE2,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, b2sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_BLAKE2,$(objects)) : + @$(B2SUM) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) + $(UPDATE_AUTOMAKE) + cd $(DIR_APP) && ./autogen.sh + cd $(DIR_APP) && ./configure \ + --prefix=/usr \ + --disable-documentation \ + --disable-python + cd $(DIR_APP) && make $(MAKETUNING) + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/make.sh b/make.sh index 7b56b7fc8..7e3ea09d1 100755 --- a/make.sh +++ b/make.sh @@ -1711,6 +1711,7 @@ buildipfire() { lfsmake2 perl-URI-Encode lfsmake2 rsnapshot lfsmake2 mympd + lfsmake2 btrfs-progs # Kernelbuild ... current we have no platform that need # multi kernel builds so KCFG is empty From patchwork Fri Mar 15 19:14:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7626 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTc6jWBz3wnw for ; Fri, 15 Mar 2024 19:15:00 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTY5SnwzFLC; Fri, 15 Mar 2024 19:14:57 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTY4vYTz32pB; Fri, 15 Mar 2024 19:14:57 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTV1V6Hz32P8 for ; Fri, 15 Mar 2024 19:14:54 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTT6JWVzvx; Fri, 15 Mar 2024 19:14:53 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530094; 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=twnIWUSAAXHUVdw/Q30FXcS7hpFijSNrPcBrEvLXofw=; b=I9+MXV3J0gwXems9D+RG7SZp3KJIHxs/5zBkk7ijA5D9xMTNhPyCYTv+npDRsd496Uvh2Y 65XTrHI2y5BDbuAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530094; 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=twnIWUSAAXHUVdw/Q30FXcS7hpFijSNrPcBrEvLXofw=; b=JRa7G9icXBhQwMULhcp95z1JaTDv8g6hubqBLBUQizQcBUI1d1BWo4SEkIqU1vwgSk3IN1 2cMHf+TlLI+fcVA4bE18FXpNgA77wxahX/9ClcWWuZk6ThpFOP2TZ3qkEE81s4mwT2hUbB HoRcN4D4bvhRnT+I0XP9znc8KeGksR0F/rnbcV7skUd1DDaAkKqG+rROhM4P68MKzCfA4Q tJHKuNhw1aG0DOWOLqqz7T7t8tB1VXKiaXLt5DTdlIMCyX1J0pN6VKBBd8u41xTYl2w/1A 5zaSTZsYF/SlxteL0IODb0AJDLLUUBzFD6ujcLI9wzP3d1wMfoHJWLrtxWhn0w== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 02/17] installer: Allow to install IPFire on BTRFS Date: Fri, 15 Mar 2024 20:14:27 +0100 Message-Id: <20240315191442.3951-3-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: CCQRTEIPZR7YCWUMQYOOTHDVYGXWWPCB X-Message-ID-Hash: CCQRTEIPZR7YCWUMQYOOTHDVYGXWWPCB X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/dracut-module/module-setup.sh | 4 ++-- src/installer/hw.c | 8 ++++++++ src/installer/hw.h | 1 + src/installer/main.c | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/installer/dracut-module/module-setup.sh b/src/installer/dracut-module/module-setup.sh index 26a257cf8..09564f885 100755 --- a/src/installer/dracut-module/module-setup.sh +++ b/src/installer/dracut-module/module-setup.sh @@ -30,8 +30,8 @@ install() { instmods virtio_net hv_netvsc vmxnet3 # Filesystem support - inst_multiple parted mkswap mke2fs mkfs.xfs mkfs.vfat - instmods ext4 iso9660 vfat xfs ntfs3 + inst_multiple parted mkswap mke2fs mkfs.xfs mkfs.vfat mkfs.btrfs + instmods ext4 iso9660 vfat xfs ntfs3 btrfs # Extraction inst_multiple tar gzip zstd diff --git a/src/installer/hw.c b/src/installer/hw.c index 894b887d9..a196bf8be 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -822,6 +822,10 @@ static int hw_format_filesystem(const char* path, int fs, const char* output) { } else if (fs == HW_FS_XFS) { snprintf(cmd, sizeof(cmd), "/sbin/mkfs.xfs -f %s", path); + // BTRFS + } else if (fs == HW_FS_BTRFS) { + snprintf(cmd, sizeof(cmd), "/usr/bin/mkfs.btrfs -L rootfs -f %s", path); + // FAT32 } else if (fs == HW_FS_FAT32) { snprintf(cmd, sizeof(cmd), "/sbin/mkfs.vfat %s", path); @@ -882,6 +886,10 @@ int hw_mount_filesystems(struct hw_destination* dest, const char* prefix) { filesystem = "xfs"; break; + case HW_FS_BTRFS: + filesystem = "btrfs"; + break; + case HW_FS_FAT32: filesystem = "vfat"; break; diff --git a/src/installer/hw.h b/src/installer/hw.h index 6a7f23aa7..e5ee65a6d 100644 --- a/src/installer/hw.h +++ b/src/installer/hw.h @@ -46,6 +46,7 @@ #define HW_FS_EXT4_WO_JOURNAL 2 #define HW_FS_XFS 3 #define HW_FS_FAT32 4 +#define HW_FS_BTRFS 5 #define HW_FS_DEFAULT HW_FS_EXT4 diff --git a/src/installer/main.c b/src/installer/main.c index cddb0d91a..b3c9d27ee 100644 --- a/src/installer/main.c +++ b/src/installer/main.c @@ -720,6 +720,7 @@ int main(int argc, char *argv[]) { { HW_FS_EXT4, _("ext4 Filesystem") }, { HW_FS_EXT4_WO_JOURNAL, _("ext4 Filesystem without journal") }, { HW_FS_XFS, _("XFS Filesystem") }, + { HW_FS_BTRFS, _("BTRFS Filesystem") }, { 0, NULL }, }; unsigned int num_filesystems = sizeof(filesystems) / sizeof(*filesystems); From patchwork Fri Mar 15 19:14:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7627 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTd1Nt3z3wv4 for ; Fri, 15 Mar 2024 19:15:01 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTY6xgszFLj; Fri, 15 Mar 2024 19:14:57 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTY65lFz32pp; Fri, 15 Mar 2024 19:14:57 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTV4DJZz2xk2 for ; Fri, 15 Mar 2024 19:14:54 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTV1xHPznf; Fri, 15 Mar 2024 19:14:54 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530094; 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=LlVIcNeyc3AvB7hEi1B1yNJ8G7tWmRphAVdwKofExMo=; b=pOzWDVon8nSUHF+Ijw9MgCGXQyixn6oP0YTboN2Qe8vZWmcjJpdOceSOO/UaebJsTdr7O3 nZbGA8VV5iJShtAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530094; 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=LlVIcNeyc3AvB7hEi1B1yNJ8G7tWmRphAVdwKofExMo=; b=R1QjDX6QDRBcuqvj8uqqOGHGk3T8ZVoneoUbI8KfyIstusc86YuSQtIdOYbFent4i3MVtF uWTM9FcXbahxESeNxkJanXKPf0YylOjqAr3cIHaFZ5aER7ZbNPlS0+S9Y5vepqBGVrZaxi PP/T5Vq4i34OJ2zmCAExoaExpriHhvfx3xZ5WiII/P2pCBfaFQZe0CEhLrKDjrLEYQEYJW aYW3bUzUc6cMT2QsIf+i9683KCNMfp7xkJjsghlhSFkbt1FWAgrsbiNjXT7ux3/6+CrU3Y FZs72fN9/0tr5kwIcn97VBtF2qGGCTBkzI8qE4zep3nypL5gX1PC5GNgAyZfDA== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 03/17] installer: Ensure to always create the /boot directory. Date: Fri, 15 Mar 2024 20:14:28 +0100 Message-Id: <20240315191442.3951-4-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 3GSDRJNBYIFBII7235NUU7ANVG5FDNUB X-Message-ID-Hash: 3GSDRJNBYIFBII7235NUU7ANVG5FDNUB X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Ensure to always create the /boot directory during the mounting of the various created file systems. If the /boot directory does not exist some following mount operations could not be performed correctly and the installation/mounting will fail. Signed-off-by: Stefan Schantl --- src/installer/hw.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index a196bf8be..b9ed92459 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -904,10 +904,16 @@ int hw_mount_filesystems(struct hw_destination* dest, const char* prefix) { return r; // boot - if (*dest->part_boot) { - snprintf(target, sizeof(target), "%s%s", prefix, HW_PATH_BOOT); - mkdir(target, S_IRWXU|S_IRWXG|S_IRWXO); + snprintf(target, sizeof(target), "%s%s", prefix, HW_PATH_BOOT); + r = mkdir(target, S_IRWXU|S_IRWXG|S_IRWXO); + + if (r) { + hw_umount_filesystems(dest, prefix); + return r; + } + + if (*dest->part_boot) { r = hw_mount(dest->part_boot, target, filesystem, 0); if (r) { hw_umount_filesystems(dest, prefix); From patchwork Fri Mar 15 19:14:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7628 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTf3Lw5z3wnw for ; Fri, 15 Mar 2024 19:15:02 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTb6xVWzFLV; Fri, 15 Mar 2024 19:14:59 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTb6S11z32pl; Fri, 15 Mar 2024 19:14:59 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTW0d0Cz32p3 for ; Fri, 15 Mar 2024 19:14:55 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTV54mmznj; Fri, 15 Mar 2024 19:14:54 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530094; 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=k655GFZNOMr7iC02f8rz2U1t2ReEzsVZh+8DzpbuBR0=; b=0B9XEfpH3H2spFKEDVB09TWaHN+WwNjDVgYbQQKEgZFLHC1CD7tAZgv3QCGdfc1y0kPTay TIRfX8X8YQDJN1Bw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530094; 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=k655GFZNOMr7iC02f8rz2U1t2ReEzsVZh+8DzpbuBR0=; b=DZMPjbjZSr7cwhxg6liEIlqSqTbDkdNBVOYIeGqWVPfpEzETYYw800reJxZhLdUSYY82TW DhKrfaSCQhm4IMOMeTD0sqS/yZAgUOmDzANZ9v7cVaVgTdcbM5HvQyFWnnxhR51H9uuYhT jk2asWBPGHnp9FsPTlYIahEQkU0KFIapqDLZ1SgMV04O02QIoZW6qf+b6wy9md0GWQg80E r2GRd8UVm0HU2EwQ+8J/8NO7AxsdH7BZRixpdPiIl92VuYrhudMuxYwOQjNuX/VTjmLgUB aeOB+0vmbwDErnd5QA/NRqwCjcepofY1Klihskx6ia6e00xekbOpaGX9jnPzxw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 04/17] installer: Disable seperate boot partition Date: Fri, 15 Mar 2024 20:14:29 +0100 Message-Id: <20240315191442.3951-5-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 5GPQNDDWNNXX3PYHFCWGS4ZO463YBK3X X-Message-ID-Hash: 5GPQNDDWNNXX3PYHFCWGS4ZO463YBK3X X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This will merge /boot and / to be on the same partition. Signed-off-by: Stefan Schantl --- src/installer/hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index b9ed92459..81be87471 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -490,7 +490,7 @@ static unsigned long long hw_swap_size(struct hw_destination* dest) { } static unsigned long long hw_boot_size(struct hw_destination* dest) { - return MB2BYTES(512); + return 0; } static int hw_device_has_p_suffix(const struct hw_destination* dest) { From patchwork Fri Mar 15 19:14:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7629 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTh0mNpz3wnw for ; Fri, 15 Mar 2024 19:15:04 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTd2Kt9zFKx; Fri, 15 Mar 2024 19:15:01 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTd1q0Hz32q4; Fri, 15 Mar 2024 19:15:01 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTW3JV9z32nQ for ; Fri, 15 Mar 2024 19:14:55 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTW0wzhznf; Fri, 15 Mar 2024 19:14:55 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530095; 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=D2bxLu+BHHDNoy7QDFq9QFz4KHU2k0Smc9TDg6W0vPY=; b=z3+g4KYnb81DFoJd7Z/eVt89GsRuKf+5FqGMIDx7wspi5ye3Rygv0BI2eXi3xjuo6iddQA 7cg1/D/s4U/8IaCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530095; 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=D2bxLu+BHHDNoy7QDFq9QFz4KHU2k0Smc9TDg6W0vPY=; b=aC3u7zAwlPgdfX+S/DCbPwwkVMkiU96VHLdo7lU3sxaxaH+pvTKR39zzBvo/bHdI+3Fs0o Qt9h3+X1nKOS1dCF+HxM/x7bhBjIIeI1J1tZ6eiYwioLF7yPV3gsOveSlntKWa2PjRZelC dRZ/gp8Slq+McagEbJK99qLQG8cEjpDj4eCfiYMaWvXzKIM0auqEZeRPLWRmb/448Dc3QF Wj9D/2n3MjlQaDHbpcrWW2TIESGlTZ9bhHCOliRQlULolngpEYulo24w8tDfoA8J8eXKE4 /Jy5SP+v3dxWZcDvM7xN9I56vZh3/XX2EnwtqJgM0X9NPsorjk/dNxzjaFOzGA== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 05/17] installer: Add code to create a BTRFS subvolume layout. Date: Fri, 15 Mar 2024 20:14:30 +0100 Message-Id: <20240315191442.3951-6-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: Y6OZZCTQ2OUJNE7SQVAAM7M6H27FQL4Y X-Message-ID-Hash: Y6OZZCTQ2OUJNE7SQVAAM7M6H27FQL4Y X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/hw.c | 70 ++++++++++++++++++++++++++++++++++++++++++++-- src/installer/hw.h | 5 ++++ 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index 81be87471..420feaca7 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -44,6 +44,20 @@ #include "hw.h" +// Array which contains the subvolumes which will be created when installing +// IPFire on a BTRFS. +const char* btrfs_subvolumes[7][2] = { + {"@root" ,"/"}, + {"@snapshots", "/.snapshots"}, + {"@home", "/home"}, + {"@cache", "/var/cache"}, + {"@lib", "/var/lib"}, + {"@logs", "/var/log"}, + {"@mails", "/var/mail"} +}; + +#define LEN(arr) ((int) (sizeof (arr) / sizeof (arr)[0])) + static int system_chroot(const char* output, const char* path, const char* cmd) { char chroot_cmd[STRING_SIZE]; @@ -805,6 +819,7 @@ int hw_create_partitions(struct hw_destination* dest, const char* output) { static int hw_format_filesystem(const char* path, int fs, const char* output) { char cmd[STRING_SIZE] = "\0"; + int r; // Swap if (fs == HW_FS_SWAP) { @@ -824,7 +839,9 @@ static int hw_format_filesystem(const char* path, int fs, const char* output) { // BTRFS } else if (fs == HW_FS_BTRFS) { - snprintf(cmd, sizeof(cmd), "/usr/bin/mkfs.btrfs -L rootfs -f %s", path); + r = hw_create_btrfs_layout(path, output); + + return r; // FAT32 } else if (fs == HW_FS_FAT32) { @@ -833,7 +850,7 @@ static int hw_format_filesystem(const char* path, int fs, const char* output) { assert(*cmd); - int r = mysystem(output, cmd); + r = mysystem(output, cmd); return r; } @@ -870,6 +887,43 @@ int hw_create_filesystems(struct hw_destination* dest, const char* output) { return 0; } +int hw_create_btrfs_layout(const char* path, const char* output) { + char cmd[STRING_SIZE]; + char subvolume[STRING_SIZE]; + + // Create the main BTRFS. + snprintf(cmd, sizeof(cmd), "/usr/bin/mkfs.btrfs -L IPFire -f %s", path); + int r = mysystem(output, cmd); + + if (r) + return r; + + // We need to mount the FS in order to create any subvolumes. + r = hw_mount(path, DESTINATION_MOUNT_PATH, "btrfs", 0); + + if (r) + return r; + + // Loop through the array of subvolumes to create. + for ( int i = 0; i < LEN(btrfs_subvolumes); i++ ) { + snprintf(subvolume, sizeof(subvolume), "%s", btrfs_subvolumes[i][0]); + + // Call function to create the subvolume + r = hw_create_btrfs_subvolume(output, subvolume); + + if (r) + return r; + } + + // Umount the main BTRFS after subvolume creation. + r = hw_umount(path, 0); + + if (r) + return r; + + return 0; +} + int hw_mount_filesystems(struct hw_destination* dest, const char* prefix) { char target[STRING_SIZE]; @@ -1219,3 +1273,15 @@ int hw_restore_backup(const char* output, const char* backup_path, const char* d return 0; } + +int hw_create_btrfs_subvolume(const char* output, const char* subvolume) { + char command [STRING_SIZE]; + snprintf(command, sizeof(command), "/usr/bin/btrfs subvolume create %s/%s", DESTINATION_MOUNT_PATH, subvolume); + + int r = mysystem(output, command); + + if (r) + return -1; + + return 0; +} diff --git a/src/installer/hw.h b/src/installer/hw.h index e5ee65a6d..2de73a3be 100644 --- a/src/installer/hw.h +++ b/src/installer/hw.h @@ -104,6 +104,8 @@ struct hw_destination { unsigned long long size_root; }; +extern const char* btrfs_subvolumes[][2]; + struct hw* hw_init(); void hw_free(struct hw* hw); @@ -143,4 +145,7 @@ int hw_start_networking(const char* output); void hw_sync(); +int hw_create_btrfs_layout(const char* output, const char* subvolume); +int hw_create_btrfs_subvolume(const char* output, const char* subvolume); + #endif /* HEADER_HW_H */ From patchwork Fri Mar 15 19:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7630 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTj0xFwz3wnw for ; Fri, 15 Mar 2024 19:15:05 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTf3X8GzFLn; Fri, 15 Mar 2024 19:15:02 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTf34sXz32pt; Fri, 15 Mar 2024 19:15:02 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTX3kJDz32P8 for ; Fri, 15 Mar 2024 19:14:56 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTW3cPsz4Rt; Fri, 15 Mar 2024 19:14:55 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530095; 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=t/JNs2HqQPIhw0266TAuJjuDXhy3D2ZjPQqQ8OuB5g8=; b=Y7HMF8OuSVTDj74GGixDotuJ3qyX0wAt/eImnYW0U3SNl2j9zFSRgMgDH8mdk0nWXMPyY6 TVsL+N+0d4mndhBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530095; 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=t/JNs2HqQPIhw0266TAuJjuDXhy3D2ZjPQqQ8OuB5g8=; b=uhN1ExNfuMp+IvgTvGjqEqcOOuNts6ItQurjrBaMNNsuOetFgW7SzmfPGlZSVwr0jAnPJN VvsWLeDUGSpwKib0vtBjbsR4Pr7GmInKuED45o/l7+cyO/XrHih3lMMMq+p7g9V9w8t4uF naCGrZMTT8E5DyCmwPTjatDtGdtM/VuiGP+uoDkKex3ltYjcTy3HcQBc0xjdpL0xy+PzZP lbOf0db7fqQowQZJaFB+UOsCSS6qrWv5q+5I7ly07NckGtqcy+BmQwkpnDLwcAJZfqZuQ/ MHroWciYdhR6S3auJGT78D7P+UfJBykj2wgJRJerlg6bx6g9nb+g78AVeUCuCw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 06/17] installer: Correctly umount main BTRFS partition. Date: Fri, 15 Mar 2024 20:14:31 +0100 Message-Id: <20240315191442.3951-7-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 6Z6QBT43IEH65BGWJDXK3R46YYDSG4Y3 X-Message-ID-Hash: 6Z6QBT43IEH65BGWJDXK3R46YYDSG4Y3 X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index 420feaca7..205d40d21 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -916,7 +916,7 @@ int hw_create_btrfs_layout(const char* path, const char* output) { } // Umount the main BTRFS after subvolume creation. - r = hw_umount(path, 0); + r = hw_umount(DESTINATION_MOUNT_PATH, 0); if (r) return r; From patchwork Fri Mar 15 19:14:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7631 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTj74W5z3wv4 for ; Fri, 15 Mar 2024 19:15:05 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTf5yy9zFMK; Fri, 15 Mar 2024 19:15:02 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTf4qN2z32md; Fri, 15 Mar 2024 19:15:02 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTY2PSRz32md for ; Fri, 15 Mar 2024 19:14:57 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTW6dVxzF95; Fri, 15 Mar 2024 19:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530096; 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=QN9FF0L+oY66I0Zm2AMlccWuNr95Uszag4eiL+ZPUf0=; b=hMpiOvHznXsvE7GmkQ59k2nfJxyYmMb2WpKR5OK33M7Ux6zKW+PVgsxMpKg6a2DNg9b8/U 36Sfgwuwn7/JwHZyUM05rdKm5XNdVcuilNoznF25xXjls9SybmeaAPHZcZbqLAVtlvh6Yx VDG7Nf08SE+5wVm0NVCD4HIWmA+ZMNwG9d1TU1Ci0XF9m9md6f62sExmBmKVJwYwoet2nJ hWyr+nQ3B8iHuCGdO7Z9FQCOwdPz+pojezReUk05AeX4EwfFNgjVnD+DiFyZptUXAY6xfJ b2q8CwtcFJ6rZtMYG0jphkSmtbbnEzOpazb96X+X0rX3SWnRjrjrPRIjmgPbAA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530096; 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=QN9FF0L+oY66I0Zm2AMlccWuNr95Uszag4eiL+ZPUf0=; b=KqXYiMeR9flAqF6CtY53i9srIIb87gNLka5yEqxzEDNVjgkpCKubwQyU1RLB9tUwv3wZGm 6v82Z8ZBFIeMmSBA== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 07/17] installer: Add recurisve mkdir function Date: Fri, 15 Mar 2024 20:14:32 +0100 Message-Id: <20240315191442.3951-8-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: MTRTM5MXF57DQJN5STW5YW4GC2CFVYDQ X-Message-ID-Hash: MTRTM5MXF57DQJN5STW5YW4GC2CFVYDQ X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/hw.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/installer/hw.c b/src/installer/hw.c index 205d40d21..cb6a8ab81 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -1274,6 +1274,49 @@ int hw_restore_backup(const char* output, const char* backup_path, const char* d return 0; } +int hw_mkdir(const char *dir) { + char tmp[STRING_SIZE]; + char *p = NULL; + size_t len; + int r; + + snprintf(tmp, sizeof(tmp),"%s",dir); + len = strlen(tmp); + + if (tmp[len - 1] == '/') { + tmp[len - 1] = 0; + } + + for (p = tmp + 1; *p; p++) { + if (*p == '/') { + *p = 0; + + // Create target if it does not exist + if (access(tmp, X_OK) != 0) { + r = mkdir(tmp, S_IRWXU|S_IRWXG|S_IRWXO); + + if (r) { + return r; + } + } + + *p = '/'; + } + } + + // Create target if it does not exist + if (access(tmp, X_OK) != 0) { + r = mkdir(tmp, S_IRWXU|S_IRWXG|S_IRWXO); + + if (r) { + return r; + } + } + + return 0; +} + + int hw_create_btrfs_subvolume(const char* output, const char* subvolume) { char command [STRING_SIZE]; snprintf(command, sizeof(command), "/usr/bin/btrfs subvolume create %s/%s", DESTINATION_MOUNT_PATH, subvolume); From patchwork Fri Mar 15 19:14:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7632 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTk75l7z3wnw for ; Fri, 15 Mar 2024 19:15:06 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTh6ZhVzFLy; Fri, 15 Mar 2024 19:15:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTh66Zgz32p3; Fri, 15 Mar 2024 19:15:04 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTZ0CLHz32md for ; Fri, 15 Mar 2024 19:14:58 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTX2FT4zpZ; Fri, 15 Mar 2024 19:14:56 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530096; 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=CEsDFdMYJWSHH5cRpTAmQT+dul+BsPq6oOw98KNFQPU=; b=wORcL3cUVMlByu3zDoJDyw/LeVNVkbsbx3PhVAgVZTW2D9pabPzmFZ13KRtzQYql/xSPko PcSBa5YnxjfTM6Aw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530096; 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=CEsDFdMYJWSHH5cRpTAmQT+dul+BsPq6oOw98KNFQPU=; b=J/Bna+CtdY+q04Edb5ClHS5wuqVfqnmOst9jIyd1StXaiU5qhz8A6tCfl6q6PLcZU3aWw4 50tJXzPBhmVVI42VN86BvCd4BxcpFy/AbsSkPcMm5j7eb29LeR07B/ScG4IeK2WM5/k9mH wLiFrsaR+1pFjBNUqS64tRqktk5Zy8mBIU0j1UNCY+CWycVPWSxig56B++pA+ljsytFsHL vrNZTx4w5IY8UdUevQSF1b12hgg9dSVxWq7kYhTRdHgyz4PAMDLf/2NE9WWX3TheymfjNS iSQ9yYwnva67DlkRX9Fb4xfbnY7KN5GD79Ri3DyKZkNZrBvA5TXCTVKSX61vzw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 08/17] installer: Mount BTRFS layout before installing the system Date: Fri, 15 Mar 2024 20:14:33 +0100 Message-Id: <20240315191442.3951-9-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: CKEAZKPOR42QP2ZZXNM5WXBL76BRA2N7 X-Message-ID-Hash: CKEAZKPOR42QP2ZZXNM5WXBL76BRA2N7 X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/hw.c | 48 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index cb6a8ab81..e520fb687 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -926,6 +926,7 @@ int hw_create_btrfs_layout(const char* path, const char* output) { int hw_mount_filesystems(struct hw_destination* dest, const char* prefix) { char target[STRING_SIZE]; + int r; assert(*prefix == '/'); @@ -953,9 +954,17 @@ int hw_mount_filesystems(struct hw_destination* dest, const char* prefix) { } // root - int r = hw_mount(dest->part_root, prefix, filesystem, 0); - if (r) - return r; + if (dest->filesystem == HW_FS_BTRFS) { + r = hw_mount_btrfs_subvolumes(dest->part_root); + + if (r) + return r; + } else { + r = hw_mount(dest->part_root, prefix, filesystem, 0); + + if (r) + return r; + } // boot snprintf(target, sizeof(target), "%s%s", prefix, HW_PATH_BOOT); @@ -1019,6 +1028,39 @@ int hw_mount_filesystems(struct hw_destination* dest, const char* prefix) { return 0; } +int hw_mount_btrfs_subvolumes(const char* source) { + int r; + char path[STRING_SIZE]; + char options[STRING_SIZE]; + + // Mount the root subvolume + snprintf(options, sizeof(options), "subvol=%s,%s", btrfs_subvolumes[0][0], BTRFS_MOUNT_OPTIONS); + r = mount(source, DESTINATION_MOUNT_PATH, "btrfs", NULL, options); + + if (r) + return r; + + // Loop through the remain array of known subvolumes. + for ( int i = 1; i < LEN(btrfs_subvolumes); i++ ) { + snprintf(path, sizeof(path), "%s%s", DESTINATION_MOUNT_PATH, btrfs_subvolumes[i][1]); + snprintf(options, sizeof(options), "subvol=%s,", btrfs_subvolumes[i][0], BTRFS_MOUNT_OPTIONS); + + // Create the directory. + r = hw_mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO); + + if(r != 0 && errno != EEXIST) + return r; + + // Try to mount the subvolume. + r = mount(source, path, "btrfs", NULL, options); + + if (r) + return r; + } + + return 0; +} + int hw_umount_filesystems(struct hw_destination* dest, const char* prefix) { int r; char target[STRING_SIZE]; From patchwork Fri Mar 15 19:14:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7633 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTl5dnfz3wv4 for ; Fri, 15 Mar 2024 19:15:07 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTk1RGvzFLF; Fri, 15 Mar 2024 19:15:06 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTk0vTyz32p6; Fri, 15 Mar 2024 19:15:06 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTZ3Gn5z32P8 for ; Fri, 15 Mar 2024 19:14:58 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTX5C7lzFLY; Fri, 15 Mar 2024 19:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530096; 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=fUX6Oz2VsKa9nx4i2y2MNIqdVSTqzYjpt2cDmy1O2Cs=; b=rm1uQtx3PcAiB5dEU2UIbyGW/6XkcHpbbVM6J8dktNPAheVTmCOstRVsCrp8Cp+cX3fjgo 5uFLoi9j46dNIo9/Y+dz/oFIvHqzuGYLJXjfFjlAvceUzkgdVkUqaX6j7aenQtTKQVbwsl E2C6f6Sg/ka+GpbXVoyFhjgEFKomik85iFJZh6y5rmkIeJGkVb7N4OLELq3aprr8xeOG3Q WXvrCTSpzXxnK6ua4mGYfQfeARaneNGLhsUMOdKVc3TZosXyZ4itO2Ol4ExDqgJnuNHWJm 5pF/f8R8vSPICd2X6BEcF5nmn8lpMAMD8pSE78GcpaASDpQ6LUs3JZFYQEG6ag== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530096; 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=fUX6Oz2VsKa9nx4i2y2MNIqdVSTqzYjpt2cDmy1O2Cs=; b=t5cBpbg3aGVmNdR+o2lVHyG4NIT0Zacp2ol2tRJm0vDFKh+M/Jb50Pk2zx0F0dT+SuJ007 z+KsTU6jL/qUoEBQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 09/17] installer: Add /var/tmp to the BTRFS layout Date: Fri, 15 Mar 2024 20:14:34 +0100 Message-Id: <20240315191442.3951-10-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 646JX4QDHVCOODLPB2TGWADMFQ3GWKLM X-Message-ID-Hash: 646JX4QDHVCOODLPB2TGWADMFQ3GWKLM X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/hw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index e520fb687..7868cbb23 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -46,14 +46,15 @@ // Array which contains the subvolumes which will be created when installing // IPFire on a BTRFS. -const char* btrfs_subvolumes[7][2] = { +const char* btrfs_subvolumes[8][2] = { {"@root" ,"/"}, {"@snapshots", "/.snapshots"}, {"@home", "/home"}, {"@cache", "/var/cache"}, {"@lib", "/var/lib"}, {"@logs", "/var/log"}, - {"@mails", "/var/mail"} + {"@mails", "/var/mail"}, + {"@tmp", "/var/tmp"} }; #define LEN(arr) ((int) (sizeof (arr) / sizeof (arr)[0])) From patchwork Fri Mar 15 19:14:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7634 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTm6H32z3wnw for ; Fri, 15 Mar 2024 19:15:08 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTl3cSJzFLl; Fri, 15 Mar 2024 19:15:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTl36Bqz32pg; Fri, 15 Mar 2024 19:15:07 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTb29Qqz32nQ for ; Fri, 15 Mar 2024 19:14:59 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTY0gQCz4Rt; Fri, 15 Mar 2024 19:14:57 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530097; 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=or/cr9aqisGtGO6jzjy4U5N+96//1/pujtfWR9WwnDI=; b=t6cIaXFA9xT9NlDIO8H+gwe9NuYG93GZK4gTTcWAGY3X7lZw0BhScvPCTUwZEKIqSnj+zC APLLHR/k5h0sukCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530097; 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=or/cr9aqisGtGO6jzjy4U5N+96//1/pujtfWR9WwnDI=; b=O4gC4D5YbWqVOUYD9FWyD9KisSN9kY6iqWE3SRPCyW8Vz37gwuOux7umcvKDm9KO/jGoYq xVrHlkxM3HBzLi3hJzfoispzd4UOKmGYO5nxsGOk38iCbZyoMi2HyAEvM7teyEsJu/Afra 95ws/5K/LfY4R6BTHE76Op93kB0dRvr07mpYNAMOraFeoHJoxOmDrJ2X0BTPB0KFPGI6ua QpF1UxRuEKWan5aD95/QGyxK7vk+8qvjKzCIRmMOYqUKU/e+aQR9OIuDOyWJWKRIdbnv9p yByx36Q8OeHSCGGqRFdJoUQ3dS7Dgyra/BmiGDS5XWaZ4Xa2akcuOnqzfDZfrQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 10/17] installer: Fix using BTRFS mount options when mounting the layout Date: Fri, 15 Mar 2024 20:14:35 +0100 Message-Id: <20240315191442.3951-11-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: ZHJ6VFQC2GYJXZGBCVCTD2YVRGGD3X54 X-Message-ID-Hash: ZHJ6VFQC2GYJXZGBCVCTD2YVRGGD3X54 X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index 7868cbb23..1c4adc24b 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -1044,7 +1044,7 @@ int hw_mount_btrfs_subvolumes(const char* source) { // Loop through the remain array of known subvolumes. for ( int i = 1; i < LEN(btrfs_subvolumes); i++ ) { snprintf(path, sizeof(path), "%s%s", DESTINATION_MOUNT_PATH, btrfs_subvolumes[i][1]); - snprintf(options, sizeof(options), "subvol=%s,", btrfs_subvolumes[i][0], BTRFS_MOUNT_OPTIONS); + snprintf(options, sizeof(options), "subvol=%s,%s", btrfs_subvolumes[i][0], BTRFS_MOUNT_OPTIONS); // Create the directory. r = hw_mkdir(path, S_IRWXU|S_IRWXG|S_IRWXO); From patchwork Fri Mar 15 19:14:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7635 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTn4h13z3wv4 for ; Fri, 15 Mar 2024 19:15: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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTl5SXHzFMB; Fri, 15 Mar 2024 19:15:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTl518Tz32nQ; Fri, 15 Mar 2024 19:15:07 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTb4FGcz32nQ for ; Fri, 15 Mar 2024 19:14:59 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTY3lHyzFKw; Fri, 15 Mar 2024 19:14:57 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530097; 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=l0LDWikR5/60kBQ0JK4ZWqrzLZI9v1y+2TsEYOv1AYU=; b=ifjckVrl9rb6cs93zl2DjqjBmfMC3APH0Ax6umIC4z7wOZUH7JqQZoiyr0nxkPR0U554sH +A42QbAppThOA2Cg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530097; 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=l0LDWikR5/60kBQ0JK4ZWqrzLZI9v1y+2TsEYOv1AYU=; b=jRZHvHXOW069zi0sPgYKkFCQaDyV8sxB/NzoUojwH3qX/xoE0P/dr4RvHjNmpakqeNTMsw KtbCPAIE8hsr5YuPf1R30xKFaGqDJ+/fHZNX8iS65swAHBwxfdvyZddf9tJJzY1nw2Sj34 fvXC2hyDB4+97yhLcawIq5bDDTibzN9Y4416rjH/eW4TJ86Y4Lx4RGuH305rSZLiazVcdY GXZ9o0c5mLGs6Bs6ph36R+BOOFjzp1v+AEEQ34NGxZv7Qsy+hr7KamSX/Xk7eUHDw8RloY iI5JlvrxqPSxrWxFM3wqkJ+9Rs71vKdOuye6J/cZJn3AHgooZTvHvmyEvswx1g== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 11/17] installer: Add code to proper unmount the BTRFS layout Date: Fri, 15 Mar 2024 20:14:36 +0100 Message-Id: <20240315191442.3951-12-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 3IB7EEWWENKCRRZJZEQCNDTEVS3GMB3P X-Message-ID-Hash: 3IB7EEWWENKCRRZJZEQCNDTEVS3GMB3P X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/hw.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index 1c4adc24b..b5b853e92 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -1106,13 +1106,36 @@ int hw_umount_filesystems(struct hw_destination* dest, const char* prefix) { return -1; // root - r = hw_umount(prefix, NULL); + if(dest->filesystem == HW_FS_BTRFS) { + r = hw_umount_btrfs_layout(); + } else { + r = hw_umount(prefix, NULL); + } + if (r) return -1; return 0; } +int hw_umount_btrfs_layout() { + char path[STRING_SIZE]; + int r; + + // Reverse loop through the array of known subvolumes. + for ( int i = LEN(btrfs_subvolumes); i >= 0; i-- ) { + snprintf(path, sizeof(path), "%s%s", DESTINATION_MOUNT_PATH, btrfs_subvolumes[i][1]); + + // umount the subvolume. + r = hw_umount(path, NULL); + + if (r) + return r; + } + + return 0; +} + int hw_destroy_raid_superblocks(const struct hw_destination* dest, const char* output) { char cmd[STRING_SIZE]; From patchwork Fri Mar 15 19:14:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7636 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTs5gpYz3wnw for ; Fri, 15 Mar 2024 19:15:13 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTl6n1yzFMD; Fri, 15 Mar 2024 19:15:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTl6F0Jz32pt; Fri, 15 Mar 2024 19:15:07 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTb6g58z32pt for ; Fri, 15 Mar 2024 19:14:59 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTY6TPMzFLZ; Fri, 15 Mar 2024 19:14:57 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530098; 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=9AgTXShAyT8JL2at323MnwAX+i/KLkrTjcFillUcphc=; b=/tdOkvIEUCEQ7aGDowYYSxa+7Pgv/U2+DLLGw/RlBH/2sgxJZVWNwwmk8YhTzt2axFKZZL 5KVZiwgGsj/HBUAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530098; 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=9AgTXShAyT8JL2at323MnwAX+i/KLkrTjcFillUcphc=; b=Du9giqWuxVeCUf6MRqjyFTHC2ySe1viIWi/a64PKZ2k4DRf2bCogwyrbVmlBUTkJtI+D+S vkCj35fQCiEcpp0KXkmS0eiBKGd5ZT23RmoxQKioZqpe/OVZRsIItT5PgIRUznQah5xwh6 HCeXaPBkyMl+1oJiQ31gOA76BANXSD6CH3o2mj5TUiWmg1MGoQS5Nf8SlldNKXJxGHa79j J3nhD9mBMMy0KHV7I+7GeUIhjvTGMPE+cjpmo3QAQsDOi3J4yHr7cX1LYhIW5WFfnd0rdP rce5L8aALlTWZgaTmtMjmBcnWfgL9A6vjL/RpK1egbMgkzdIcO2B2YIgY4nIkg== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 12/17] installer: Add code to correctly write the fstab when installing on BTRFS Date: Fri, 15 Mar 2024 20:14:37 +0100 Message-Id: <20240315191442.3951-13-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: LOGQVZVAQKXRUBNPWDHX26DUDVB7E5KG X-Message-ID-Hash: LOGQVZVAQKXRUBNPWDHX26DUDVB7E5KG X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/hw.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index b5b853e92..26c473e9c 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -1260,6 +1260,7 @@ int hw_write_fstab(struct hw_destination* dest) { return -1; char* uuid = NULL; + char mount_options[STRING_SIZE]; // boot if (*dest->part_boot) { @@ -1295,7 +1296,16 @@ int hw_write_fstab(struct hw_destination* dest) { // root uuid = hw_get_uuid(dest->part_root); if (uuid) { - fprintf(f, FSTAB_FMT, uuid, "/", "auto", "defaults", 1, 1); + if(dest->filesystem == HW_FS_BTRFS) { + // Loop through the array of known BTRFS subvolumes + for ( int i = 0; i < LEN(btrfs_subvolumes); i++ ) { + snprintf(mount_options, sizeof(mount_options), "defaults,%s,subvol=%s", BTRFS_MOUNT_OPTIONS, btrfs_subvolumes[i][0]); + fprintf(f, FSTAB_FMT, uuid, btrfs_subvolumes[i][1], "btrfs", mount_options, 1, 1); + } + } else { + fprintf(f, FSTAB_FMT, uuid, "/", "auto", "defaults", 1, 1); + } + free(uuid); } From patchwork Fri Mar 15 19:14:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7637 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTz0TtNz3wnw for ; Fri, 15 Mar 2024 19:15:19 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTn1KwdzFMP; Fri, 15 Mar 2024 19:15:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTn0KBSz32p6; Fri, 15 Mar 2024 19:15: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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTc3239z32pp for ; Fri, 15 Mar 2024 19:15:00 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTZ2NGXzFLp; Fri, 15 Mar 2024 19:14:58 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530098; 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=fBbQ9rjJhvrogXnjSGxMVbG9/AEggiobtqr9eRVC9QA=; b=paeoGRtz687WBqetFNr4Og/0GYy+iBZMI83BdJC6JzsGDgkovIxTJmYHwgblGPV3tvwipU /9tT8gkvyfmwdCDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530098; 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=fBbQ9rjJhvrogXnjSGxMVbG9/AEggiobtqr9eRVC9QA=; b=q+EIMMh6qfmnnwozAJ62vVOmfEKgDq+17yckQk44oRGI/GLwNpAQ9idiLKgaNdv/CM+wFf cQGXLNPKsJxY9UGlGrFfXV253qPKthjLB0AJe9yu24B6jfimEF78AEV5DQPq4+1OqDclED hUtg/wf93lT2SEtqVwhOcE5qEpgDil6l4MSXqgY83BGiWw/SP4/plMj+le6tDE6dgmcSTX S5pWg4r1yxTlCrIANq1BXTuMdTuU9lq2KT8TxvNnfRkCAUS8wh25T5dmpPTFAIrRhiubQr FjZQZ1GU+d8Vk32LQ94MlRpe4XfVExEtE3gWT+tatErD8XGKNvUIgebRns/yHw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 13/17] installer: Define common mount options for BTRFS volumes Date: Fri, 15 Mar 2024 20:14:38 +0100 Message-Id: <20240315191442.3951-14-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: B6NGYJDUS6EEHF3WUGV73VBSD2PCQZ7H X-Message-ID-Hash: B6NGYJDUS6EEHF3WUGV73VBSD2PCQZ7H X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: As default we are using zstd for compression with level 1 Signed-off-by: Stefan Schantl --- src/installer/hw.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/installer/hw.h b/src/installer/hw.h index 2de73a3be..402e5cd0d 100644 --- a/src/installer/hw.h +++ b/src/installer/hw.h @@ -54,6 +54,8 @@ #define SERIAL_BAUDRATE 115200 +#define BTRFS_MOUNT_OPTIONS "compress=zstd:1" + #define BYTES2MB(x) ((x) / 1024 / 1024) #define MB2BYTES(x) ((unsigned long long)(x) * 1024 * 1024) From patchwork Fri Mar 15 19:14:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7638 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTz0YWpz3wv4 for ; Fri, 15 Mar 2024 19:15:19 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTs5CyDzFLw; Fri, 15 Mar 2024 19:15:13 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTq27kRz32p6; Fri, 15 Mar 2024 19:15:11 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTc4rQFz32nF for ; Fri, 15 Mar 2024 19:15:00 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTZ5jGCzpZ; Fri, 15 Mar 2024 19:14:58 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530099; 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=jdS7exNt6S/MTJAXmucb/EMQp5mMmPw1+bovbo6/VkY=; b=8upOI2Cjq2BRpR3y4jfgHTGD2kGO8L0mSCWjQ12UsoLOwqa70zbKR52gTOBqzQJpzJED9b zrpSIQIXAwybcWAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530099; 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=jdS7exNt6S/MTJAXmucb/EMQp5mMmPw1+bovbo6/VkY=; b=ETBRWZ9bzlg1op3J3yv46V+dybF8Qr26xWjpFHPsy+zNPXKITfs1JYNQOmxrKtuff6DJfq figCg0t99+3utwpVrQUGiJjZRJL2rrMIcrWgbCpnyvR6NxoDmwy75umnxEdzz535Lz8Xt5 dm7bw0kX9ASy7OR8SprsS4+XYv1xnjo/laxR37SRY3Jd/qgykUdIFWcau41wpF/ulP1lkY /odOeFxO+yz65WovU6tUUT7JCmVn2WwhKKfZR2lGXm9cZIsOQ/+msPF5+6MzgvEzRKhk65 un3OS22OLNLP9UouJTJ6iRkY9l6pWMx3AV3MKar5/CAxWBd4jFgIaVSejb3tEw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 14/17] inotify-tools: New package Date: Fri, 15 Mar 2024 20:14:39 +0100 Message-Id: <20240315191442.3951-15-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: J3ZSUM5PENWZOZHHJDIG4NS4DHED7GRZ X-Message-ID-Hash: J3ZSUM5PENWZOZHHJDIG4NS4DHED7GRZ X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This package is required for the grub-btrfs daemon Signed-off-by: Stefan Schantl --- config/rootfiles/common/inotify-tools | 19 ++++++ lfs/inotify-tools | 83 +++++++++++++++++++++++++++ make.sh | 1 + 3 files changed, 103 insertions(+) create mode 100644 config/rootfiles/common/inotify-tools create mode 100644 lfs/inotify-tools diff --git a/config/rootfiles/common/inotify-tools b/config/rootfiles/common/inotify-tools new file mode 100644 index 000000000..f99d64c01 --- /dev/null +++ b/config/rootfiles/common/inotify-tools @@ -0,0 +1,19 @@ +usr/bin/fsnotifywait +usr/bin/fsnotifywatch +usr/bin/inotifywait +usr/bin/inotifywatch +#usr/include/inotifytools +#usr/include/inotifytools/fanotify-dfid-name.h +#usr/include/inotifytools/fanotify.h +#usr/include/inotifytools/inotify-nosys.h +#usr/include/inotifytools/inotify.h +#usr/include/inotifytools/inotifytools.h +#usr/lib/libinotifytools.a +#usr/lib/libinotifytools.la +#usr/lib/libinotifytools.so +usr/lib/libinotifytools.so.0 +usr/lib/libinotifytools.so.0.4.1 +#usr/share/man/man1/fsnotifywait.1 +#usr/share/man/man1/fsnotifywatch.1 +#usr/share/man/man1/inotifywait.1 +#usr/share/man/man1/inotifywatch.1 diff --git a/lfs/inotify-tools b/lfs/inotify-tools new file mode 100644 index 000000000..bb70fbfc6 --- /dev/null +++ b/lfs/inotify-tools @@ -0,0 +1,83 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2023 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 4.23.9.0 + +THISAPP = inotify-tools-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_BLAKE2 = eddb0e44721cd8674f2309046998de16a030ed9ad84c49bc5950b9362055db9242dc0de1c615c3bd6c1f2835c83fc55446c9f8e6da52a98870c53f4e6cfa31f9 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +b2 : $(subst %,%_BLAKE2,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, b2sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_BLAKE2,$(objects)) : + @$(B2SUM) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) + $(UPDATE_AUTOMAKE) + cd $(DIR_APP) && ./autogen.sh + cd $(DIR_APP) && ./configure \ + --prefix=/usr + cd $(DIR_APP) && make $(MAKETUNING) + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/make.sh b/make.sh index 7e3ea09d1..30bd5f16b 100755 --- a/make.sh +++ b/make.sh @@ -1712,6 +1712,7 @@ buildipfire() { lfsmake2 rsnapshot lfsmake2 mympd lfsmake2 btrfs-progs + lfsmake2 inotify-tools # Kernelbuild ... current we have no platform that need # multi kernel builds so KCFG is empty From patchwork Fri Mar 15 19:14:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7639 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDV43rccz3wnw for ; Fri, 15 Mar 2024 19:15:24 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTz08R1zFLQ; Fri, 15 Mar 2024 19:15:19 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTr3Y9Xz32pt; Fri, 15 Mar 2024 19:15:12 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTc729Gz32nF for ; Fri, 15 Mar 2024 19:15:00 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTb3fsdzFKx; Fri, 15 Mar 2024 19:14:59 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530099; 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=LiaqQhGNAGUdypk9D2yOjF8SNKvksMwJXBWixE87Yno=; b=A0oqTuvDxd0fNsnfH0ksVv8cPyyMkdQ3NN7wC4xIcsDdfztfQckyxVAmY+xEn6Zkr3N2QM 8t7DqAGInyyAyVDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530099; 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=LiaqQhGNAGUdypk9D2yOjF8SNKvksMwJXBWixE87Yno=; b=GlNHAdOTM974dyK/WrZDozNGCNd8U7qVhSCUXHsHBaKhRko4k2YYXuTMg4DDh/z9+1C2z8 WkalQdA1V1zMHsJIUTBxMg2wKaDhyhwQp/fGUM/Wo4koRXE1uuceOi+LCB5UgTzBduJk9t Q95F2fjAQwNUyrIJmLDaQ9BbGQbs2f1cgTf6NidSiEFRSCaMcO0Pf4wlfL90MZzOjRwIS7 TtaVL+cmcjDcaSIY+LRr7PxJ7dmz52vxuTPDldNt9tsE5vNfWd/F0JSO6z/Jv4k3vaWmB1 gNXFV2FqqmmDKSmyrX7PRplvb/pPCBebcdhae5yCCH+UOJk61Uh1tLPQ2HgHNQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 15/17] grub-btrfs: New package Date: Fri, 15 Mar 2024 20:14:40 +0100 Message-Id: <20240315191442.3951-16-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: KWELULWQ544ELUS7BBK2T7IBRKWVKGOL X-Message-ID-Hash: KWELULWQ544ELUS7BBK2T7IBRKWVKGOL X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This kind of grub addon will extend the grub boot menu by a additional submenu where a BTRFS snapshot can be selected to directly use as root volume and boot into it. The grub-btrfsd daemon is using inotify(tools) to watch the snapshot directory for new or deleted snapshots and calls grub-mkconfig to adjust the snapshot grub submenu Signed-off-by: Stefan Schantl --- config/rootfiles/common/grub-btrfs | 14 ++++ config/rootfiles/common/x86_64/initscripts | 4 ++ lfs/grub-btrfs | 79 ++++++++++++++++++++++ lfs/initscripts | 3 + make.sh | 1 + src/initscripts/system/grub-btrfsd | 61 +++++++++++++++++ 6 files changed, 162 insertions(+) create mode 100644 config/rootfiles/common/grub-btrfs create mode 100644 lfs/grub-btrfs create mode 100644 src/initscripts/system/grub-btrfsd diff --git a/config/rootfiles/common/grub-btrfs b/config/rootfiles/common/grub-btrfs new file mode 100644 index 000000000..a612af065 --- /dev/null +++ b/config/rootfiles/common/grub-btrfs @@ -0,0 +1,14 @@ +boot/grub/grubenv +etc/default/grub-btrfs +etc/default/grub-btrfs/config +etc/grub.d/41_snapshots-btrfs +usr/bin/grub-btrfsd +#usr/lib/systemd/system/grub-btrfsd.service +#usr/share/doc/grub-btrfs +#usr/share/doc/grub-btrfs/README.md +#usr/share/doc/grub-btrfs/initramfs-overlayfs.md +#usr/share/licenses +#usr/share/licenses/grub-btrfs +#usr/share/licenses/grub-btrfs/LICENSE +#usr/share/man/man8/grub-btrfs.8.bz2 +#usr/share/man/man8/grub-btrfsd.8.bz2 diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/common/x86_64/initscripts index a5e1596fb..2d6fa85dc 100644 --- a/config/rootfiles/common/x86_64/initscripts +++ b/config/rootfiles/common/x86_64/initscripts @@ -26,6 +26,7 @@ etc/rc.d/init.d/firewall etc/rc.d/init.d/firstsetup etc/rc.d/init.d/fsresize etc/rc.d/init.d/functions +etc/rc.d/init.d/grub-btrfsd etc/rc.d/init.d/halt etc/rc.d/init.d/ipsec etc/rc.d/init.d/leds @@ -92,6 +93,7 @@ etc/rc.d/init.d/vnstat etc/rc.d/init.d/waitdrives etc/rc.d/init.d/wlanclient #etc/rc.d/rc0.d +etc/rc.d/rc0.d/K01grub-btrfsd #etc/rc.d/rc0.d/K01imspetor #etc/rc.d/rc0.d/K01motion #etc/rc.d/rc0.d/K01vdradmin @@ -135,10 +137,12 @@ etc/rc.d/rc3.d/S32apache etc/rc.d/rc3.d/S40fcron etc/rc.d/rc3.d/S98rc.local #etc/rc.d/rc3.d/S98sslh +etc/rc.d/rc3.d/S99grub-btrfsd #etc/rc.d/rc3.d/S99imspetor #etc/rc.d/rc3.d/S99motion #etc/rc.d/rc3.d/S99vdradmin #etc/rc.d/rc6.d +etc/rc.d/rc6.d/K01grub-btrfsd #etc/rc.d/rc6.d/K01imspetor #etc/rc.d/rc6.d/K01motion #etc/rc.d/rc6.d/K01vdradmin diff --git a/lfs/grub-btrfs b/lfs/grub-btrfs new file mode 100644 index 000000000..8dc0c4f3e --- /dev/null +++ b/lfs/grub-btrfs @@ -0,0 +1,79 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2023 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 4.13 + +THISAPP = grub-btrfs-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_BLAKE2 = e2f11a0a8282e3ec8ff8223e3bad70b5d5c5e81b4d740a1bf3554db412dbe48a8a0f216f4e6c65ae1d11c01a27b8b92bae9b470c60d2389505ce089511536e1a + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +b2 : $(subst %,%_BLAKE2,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, b2sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_BLAKE2,$(objects)) : + @$(B2SUM) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) + $(UPDATE_AUTOMAKE) + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/lfs/initscripts b/lfs/initscripts index e078632ab..4d67ee0c4 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -91,6 +91,7 @@ $(TARGET) : install -v -m 755 $$i /etc/rc.d/helper/; \ done + ln -sf ../init.d/grub-btrfsd /etc/rc.d/rc0.d/K01grub-btrfsd ln -sf ../init.d/imspetor /etc/rc.d/rc0.d/K01imspetor ln -sf ../init.d/motion /etc/rc.d/rc0.d/K01motion ln -sf ../init.d/vdradmin /etc/rc.d/rc0.d/K01vdradmin @@ -132,10 +133,12 @@ $(TARGET) : ln -sf ../init.d/fcron /etc/rc.d/rc3.d/S40fcron ln -sf ../../sysconfig/rc.local /etc/rc.d/rc3.d/S98rc.local ln -sf ../init.d/sslh /etc/rc.d/rc3.d/S98sslh + ln -sf ../init.d/grub-btrfsd /etc/rc.d/rc3.d/S99grub-btrfsd ln -sf ../init.d/imspetor /etc/rc.d/rc3.d/S99imspetor ln -sf ../init.d/motion /etc/rc.d/rc3.d/S99motion ln -sf ../init.d/vdradmin /etc/rc.d/rc3.d/S99vdradmin + ln -sf ../init.d/grub-btrfsd /etc/rc.d/rc6.d/K01grub-btrfsd ln -sf ../init.d/imspetor /etc/rc.d/rc6.d/K01imspetor ln -sf ../init.d/motion /etc/rc.d/rc6.d/K01motion ln -sf ../init.d/vdradmin /etc/rc.d/rc6.d/K01vdradmin diff --git a/make.sh b/make.sh index 30bd5f16b..0aa3d26af 100755 --- a/make.sh +++ b/make.sh @@ -1713,6 +1713,7 @@ buildipfire() { lfsmake2 mympd lfsmake2 btrfs-progs lfsmake2 inotify-tools + lfsmake2 grub-btrfs # Kernelbuild ... current we have no platform that need # multi kernel builds so KCFG is empty diff --git a/src/initscripts/system/grub-btrfsd b/src/initscripts/system/grub-btrfsd new file mode 100644 index 000000000..833f90cb1 --- /dev/null +++ b/src/initscripts/system/grub-btrfsd @@ -0,0 +1,61 @@ +#!/bin/sh +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2024 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +. /etc/sysconfig/rc +. ${rc_functions} + +SNAPSHOTDIR="/.snapshots" +PIDFILE="/run/grub-btrfsd.pid" + +root_is_btrfs() { + [ "$(stat -f --format="%T" /)" == "btrfs" ] || return 1 + + return 0 +} + +case "$1" in + start) + root_is_btrfs || exit 0 + + boot_mesg "Starting grub-btrfsd..." + loadproc -b -p "$PIDFILE" /usr/bin/grub-btrfsd --syslog "$SNAPSHOTDIR" + + # Store the gained PID to the defined pidfile + echo "$!" > "$PIDFILE" + ;; + + stop) + boot_mesg "Stopping grub-btrfsd..." + killproc -p "$PIDFILE" /usr/bin/grub-btrfsd + sleep 1; + ;; + + restart) + $0 stop + sleep 2 + $0 start + ;; + + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac From patchwork Fri Mar 15 19:14:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7640 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDVD6b44z3wnw for ; Fri, 15 Mar 2024 19:15:32 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDTz0kYLzFMg; Fri, 15 Mar 2024 19:15:19 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTr4nsBz32q4; Fri, 15 Mar 2024 19:15:12 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTd1fpNz32nF for ; Fri, 15 Mar 2024 19:15:01 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTb6Y1pz4Rt; Fri, 15 Mar 2024 19:14:59 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530100; 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=S7Ds3M43pefebnDx6tVVTqOyqAirRaHxdVo66VQLZhc=; b=WPGFOM71zCBwSlYXwRa+Z0L8kCvPfFUcrJxwsRG50SeUOsxgtTgh+ITY8yXHTYLfVW0xRq 37G0HUBGMpZCpDBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530100; 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=S7Ds3M43pefebnDx6tVVTqOyqAirRaHxdVo66VQLZhc=; b=A4ExKGX9qdPq6LcDhavpkI5asvOnKbaIZr0LBkA3yl1YtyBexCc8vT1yzRrtsVhCxj+e1R Ms3GA9P2Z4ejr7mvkGBP8rEJ/HOhuk8FJmGfAMDGqd8BNzvo/iLGwcWZ7AdKKWEjRx/qws XTIeoHhozo+wtSZEw2fLJPQcf9Rq6x6tjJXJWGhTD7Lj+WWo2fxlGpbswadL4u6h70QKaK fAlXQoF0/0gw0s90TmdyuO+Srbd5I+N2gUjD8EQFDjjcE2J0Wat0zxIUQVIA9pvo+Gd2t0 FO8p6e09QY3/n21gasX0sMayXEtiVBtwqwvMKx2mWYAL1qttlTvkNlOtHgdnEg== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 16/17] installer: Mark BTRFS support as experimental Date: Fri, 15 Mar 2024 20:14:41 +0100 Message-Id: <20240315191442.3951-17-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: RAXSPY4EDYUAJ25T5SI5I7EZMSJORNFT X-Message-ID-Hash: RAXSPY4EDYUAJ25T5SI5I7EZMSJORNFT X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Stefan Schantl --- src/installer/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/main.c b/src/installer/main.c index b3c9d27ee..154c2d66a 100644 --- a/src/installer/main.c +++ b/src/installer/main.c @@ -720,7 +720,7 @@ int main(int argc, char *argv[]) { { HW_FS_EXT4, _("ext4 Filesystem") }, { HW_FS_EXT4_WO_JOURNAL, _("ext4 Filesystem without journal") }, { HW_FS_XFS, _("XFS Filesystem") }, - { HW_FS_BTRFS, _("BTRFS Filesystem") }, + { HW_FS_BTRFS, _("BTRFS Filesystem (experimental)") }, { 0, NULL }, }; unsigned int num_filesystems = sizeof(filesystems) / sizeof(*filesystems); From patchwork Fri Mar 15 19:14:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7641 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TxDVD6f5yz3wv4 for ; Fri, 15 Mar 2024 19:15:32 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TxDV44PTjzFMY; Fri, 15 Mar 2024 19:15:24 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TxDTs65xSz32qx; Fri, 15 Mar 2024 19:15:13 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TxDTd2rtNz32lh for ; Fri, 15 Mar 2024 19:15:01 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TxDTc4Y9tzFLb; Fri, 15 Mar 2024 19:15:00 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710530100; 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=VK+cGQnA7BqnjS/LdJG2RdwbjS2UbCfv1keKg2FI9HQ=; b=gpGaZAuvl8OjcdKK+U5lCdmCpQeM8WHzcGk2CN1F9LfjsAk5nGIFnQogwV74M8c8+v12er YJBDPjjW48NMmSAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710530100; 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=VK+cGQnA7BqnjS/LdJG2RdwbjS2UbCfv1keKg2FI9HQ=; b=wXV9Z8HQ+MV4HjDPI9t+wwVhEDFRSTEw43yPkQgrFAXby8TUXHuZvGAXrf342GmNiVsYme I3/jikDYu+mDdnIxHz26+5GmDCdSAGosPTpu7brGK5FCTOzo9lIgcYIsrR1PcEs/6NI2be DaIGP536uvHTOTlOTJmgAqMsLRtnPFT+dN+JaiwQQrnBy4WQZnCFajNbgjnXH9XaCGlPUC LNl1OyIUKqL0k4CiCFV1INbplN/E3GRCWxu4EdqEP/rKyxoehiu1jQIuBF4qgyS+/w47OM Mj3wSk2rRTWC45k24yQv1eUIlh2u7qUfin2B9Z3GcqUtprNPn0AgxziQkrLGJg== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 17/17] installer: Adjust BTRFS layout Date: Fri, 15 Mar 2024 20:14:42 +0100 Message-Id: <20240315191442.3951-18-stefan.schantl@ipfire.org> In-Reply-To: <20240315191442.3951-1-stefan.schantl@ipfire.org> References: <20240315191442.3951-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: ML232QLAT5TAB4C6RJ2M4VZWYCCIEHF3 X-Message-ID-Hash: ML232QLAT5TAB4C6RJ2M4VZWYCCIEHF3 X-MailFrom: stefan.schantl@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: * Rename the fs root to @ to prevent name collision with home directory of user root. * Add @root which contains the home directory of the root user * Add @backup which will contains the created backups Fixes #13608 Signed-off-by: Stefan Schantl --- src/installer/hw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index 26c473e9c..4110deccf 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -47,10 +47,12 @@ // Array which contains the subvolumes which will be created when installing // IPFire on a BTRFS. const char* btrfs_subvolumes[8][2] = { - {"@root" ,"/"}, + {"@" ,"/"}, {"@snapshots", "/.snapshots"}, {"@home", "/home"}, + {"@root", "/root"}, {"@cache", "/var/cache"}, + {"@backup", "/var/ipfire/backup"}, {"@lib", "/var/lib"}, {"@logs", "/var/log"}, {"@mails", "/var/mail"},