From 1006116b9e410e03bc26e64459aa687b45778727 Mon Sep 17 00:00:00 2001 From: lw520203 <1823363429@qq.com> Date: Thu, 9 Jan 2025 00:25:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A1=A5=E4=B8=81-?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=95=9C=E5=83=8F=E7=B1=BB=E5=9E=8B=E9=80=89?= =?UTF-8?q?=E6=8B=A9repo=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 自动分区磁盘清理 --- 0014-repoChange.patch | 68 +++++++++++++++++++++ 0015-AutoPartitionClear.patch | 107 ++++++++++++++++++++++++++++++++++ calamares.spec | 17 ++++-- 3 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 0014-repoChange.patch create mode 100644 0015-AutoPartitionClear.patch diff --git a/0014-repoChange.patch b/0014-repoChange.patch new file mode 100644 index 0000000..ba042ed --- /dev/null +++ b/0014-repoChange.patch @@ -0,0 +1,68 @@ +From b5ab7bd0e57484ebffa193a92833f3b1e289d7d9 Mon Sep 17 00:00:00 2001 +From: lw520203 <1823363429@qq.com> +Date: Wed, 8 Jan 2025 23:38:02 +0800 +Subject: [PATCH] =?UTF-8?q?netinstall/ISO=E9=95=9C=E5=83=8F=E5=88=87?= + =?UTF-8?q?=E6=8D=A2repo=E6=BA=90?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + src/modules/packages/main.py | 5 +++++ + src/modules/unpackfs/main.py | 14 +++++++++++++- + 2 files changed, 18 insertions(+), 1 deletion(-) + +diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py +index 2c6e6adb4..030455cd0 100644 +--- a/src/modules/packages/main.py ++++ b/src/modules/packages/main.py +@@ -17,6 +17,7 @@ + import abc + from string import Template + import subprocess ++import os + + import libcalamares + from libcalamares.utils import check_target_env_call, target_env_call +@@ -905,6 +906,10 @@ def run(): + else: + options.append(option) + ++ if os.path.exists("/etc/yum.repos.d/local.repo"): ++ options.append("--disablerepo=*") ++ options.append("--enablerepo=local-repo") ++ + for entry in operations: + group_packages = 0 + libcalamares.utils.debug(pretty_name()) +diff --git a/src/modules/unpackfs/main.py b/src/modules/unpackfs/main.py +index 7db5f2ea6..9237eb58e 100644 +--- a/src/modules/unpackfs/main.py ++++ b/src/modules/unpackfs/main.py +@@ -275,10 +275,22 @@ def file_copy(source, entry, progress_cb): + libcalamares.utils.host_env_process_output(["cp", "-af", "/etc/add_selinux_policy.sh", entry.destination + "/etc/add_selinux_policy.sh"], output_cb) + libcalamares.utils.host_env_process_output(["chmod", "+x", entry.destination + "/etc/add_selinux_policy.sh"], output_cb) + ++ ++ rpm_package_path = "/run/initramfs/live/Packages" ++ if os.path.exists(rpm_package_path): ++ repo_source_file = "/etc/yum.repos.d/local.repo" ++ repo_file_content = "[local-repo]\nname=local\nbaseurl=file:///run/initramfs/live\nenabled=1\ngpgcheck=0" ++ libcalamares.utils.host_env_process_output(["mkdir", "-p", "/etc/yum.repos.d/"], output_cb) ++ libcalamares.utils.host_env_process_output(["touch", repo_source_file], output_cb) ++ with open(repo_source_file,'w') as file: ++ subprocess.run(['echo', '-e', repo_file_content], stdout = file) ++ ++ ++ + completed_packages = 0 + if os.path.exists("/etc/yum.repos.d/local.repo"): + libcalamares.utils.host_env_process_output( +- ["cp", "-af", "/etc/yum.repos.d/local.repo", entry.destination + "/etc/yum.repos.d/"], output_cb) ++ ["cp", "-af", "/etc/yum.repos.d/local.repo", entry.destination + "/etc/yum.repos.d/local.repo"], output_cb) + + if arch == "aarch64": + packages = ["yum", "grub2-efi", "passwd", "sudo"] +-- +2.46.0 + diff --git a/0015-AutoPartitionClear.patch b/0015-AutoPartitionClear.patch new file mode 100644 index 0000000..45f7b11 --- /dev/null +++ b/0015-AutoPartitionClear.patch @@ -0,0 +1,107 @@ +From 2f02640c1c6bf9248269cbc96fd41270fcd02b37 Mon Sep 17 00:00:00 2001 +From: lw520203 <1823363429@qq.com> +Date: Tue, 14 Jan 2025 23:40:35 +0800 +Subject: [PATCH] =?UTF-8?q?=E7=A3=81=E7=9B=98=E8=87=AA=E5=8A=A8=E5=88=86?= + =?UTF-8?q?=E5=8C=BA=E6=B8=85=E7=90=86?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +磁盘自动分区清理 +--- + src/modules/partition/core/PartitionCoreModule.cpp | 2 +- + src/modules/partition/jobs/ClearMountsJob.cpp | 14 ++++++++++---- + src/modules/partition/jobs/ClearMountsJob.h | 4 +++- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp +index 51e99f2d2..59973b798 100644 +--- a/src/modules/partition/core/PartitionCoreModule.cpp ++++ b/src/modules/partition/core/PartitionCoreModule.cpp +@@ -676,7 +676,7 @@ PartitionCoreModule::jobs( const Config* config ) const + { + if ( info->isDirty() ) + { +- auto* job = new ClearMountsJob( info->device.data() ); ++ auto* job = new ClearMountsJob( info->device.data(), config ); + job->setMapperExceptions( doNotClose ); + lst << Calamares::job_ptr( job ); + } +diff --git a/src/modules/partition/jobs/ClearMountsJob.cpp b/src/modules/partition/jobs/ClearMountsJob.cpp +index d36c4e512..113bff826 100644 +--- a/src/modules/partition/jobs/ClearMountsJob.cpp ++++ b/src/modules/partition/jobs/ClearMountsJob.cpp +@@ -17,6 +17,7 @@ + #include "partition/Sync.h" + #include "utils/Logger.h" + #include "utils/String.h" ++#include "Config.h" + + // KPMcore + #include +@@ -399,9 +400,10 @@ stringify( const QList< MessageAndPath >& news ) + return l; + } + +-ClearMountsJob::ClearMountsJob( Device* device ) ++ClearMountsJob::ClearMountsJob( Device* device, const Config* config ) + : Calamares::Job() + , m_deviceNode( device->deviceNode() ) ++ , m_config( config ) + { + } + +@@ -425,14 +427,18 @@ ClearMountsJob::exec() + QList< MessageAndPath > goodNews; + + apply( getCryptoDevices( m_mapperExceptions ), tryCryptoClose, goodNews ); +- apply( getLVMVolumes(), tryClearLVM, goodNews ); ++ apply( getLVMVolumes(), tryUmount, goodNews ); + apply( getPVGroups( deviceName ), tryVGDisable, goodNews ); + + apply( getCryptoDevices( m_mapperExceptions ), tryCryptoClose, goodNews ); + apply( getPartitionsForDevice( deviceName ), tryUmount, goodNews ); + apply( getSwapsForDevice( m_deviceNode ), tryClearSwap, goodNews ); +- diskClear(deviceName); +- mpathClear(deviceName); ++ auto choice = m_config -> installChoice(); ++ if(choice == Config::InstallChoice::Erase){ ++ apply( getLVMVolumes(), tryClearLVM, goodNews ); ++ diskClear(deviceName); ++ mpathClear(deviceName); ++ } + + Calamares::JobResult ok = Calamares::JobResult::ok(); + ok.setMessage( tr( "Cleared all mounts for %1" ).arg( m_deviceNode ) ); +diff --git a/src/modules/partition/jobs/ClearMountsJob.h b/src/modules/partition/jobs/ClearMountsJob.h +index fb3aca1e4..992779d73 100644 +--- a/src/modules/partition/jobs/ClearMountsJob.h ++++ b/src/modules/partition/jobs/ClearMountsJob.h +@@ -11,6 +11,7 @@ + #define CLEARMOUNTSJOB_H + + #include "Job.h" ++#include "Config.h" + + class Device; + +@@ -42,7 +43,7 @@ public: + * No ownership is transferred; the @p device is used only to access + * the device node (name). + */ +- explicit ClearMountsJob( Device* device ); ++ explicit ClearMountsJob( Device* device, const Config* config ); + + QString prettyName() const override; + QString prettyStatusMessage() const override; +@@ -54,6 +55,7 @@ public: + private: + const QString m_deviceNode; + QStringList m_mapperExceptions; ++ const Config* m_config; + }; + + #endif // CLEARMOUNTSJOB_H +-- +2.46.0 + diff --git a/calamares.spec b/calamares.spec index a34d426..3516064 100644 --- a/calamares.spec +++ b/calamares.spec @@ -2,7 +2,7 @@ Name: calamares Version: 3.3.7 -Release: 2 +Release: 4 Summary: Installer from a live CD/DVD/USB to disk License: GPL-3.0-or-later @@ -54,7 +54,9 @@ Patch8: 0009-qss.patch Patch9: 0010-cDebugDelect.patch Patch10: 0011-fix-87-position-and-translate.patch Patch11: 0012-replace-icon.patch -Patch12: 0013-1230.patch +Patch12: 0013-1230.patch +Patch13: 0014-repoChange.patch +Patch14: 0015-AutoPartitionClear.patch # Calamares is only supported where live images (and GRUB) are. (#1171380) # This list matches the arches where grub2-efi is used to boot the system @@ -347,8 +349,15 @@ cd %{_builddir} || exit 0 rm -rf %{buildroot} %changelog +* Wed Jan 15 2025 Liu Wang <1823363429@qq.com> - 3.3.7-4 +- Auto partition disk clear + +* Wed Jan 8 2025 Liu Wang <1823363429@qq.com> - 3.3.7-3 +- Select repo source by image type + * Fri Dec 27 2024 Li Zixin - 3.3.7-2 - Update to 1230 version +- Update to 1230 version * Wed Oct 9 2024 Li Ping - 3.3.7-1 - Initial package +- Initial package + -- Gitee From 64efbdae911d84acb1b2dde40b27ca0b6dcdf4d4 Mon Sep 17 00:00:00 2001 From: lw520203 <1823363429@qq.com> Date: Wed, 15 Jan 2025 15:15:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calamares.spec | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/calamares.spec b/calamares.spec index 3516064..04da974 100644 --- a/calamares.spec +++ b/calamares.spec @@ -2,7 +2,7 @@ Name: calamares Version: 3.3.7 -Release: 4 +Release: 3 Summary: Installer from a live CD/DVD/USB to disk License: GPL-3.0-or-later @@ -349,10 +349,7 @@ cd %{_builddir} || exit 0 rm -rf %{buildroot} %changelog -* Wed Jan 15 2025 Liu Wang <1823363429@qq.com> - 3.3.7-4 -- Auto partition disk clear - -* Wed Jan 8 2025 Liu Wang <1823363429@qq.com> - 3.3.7-3 +* Wed Jan 15 2025 Liu Wang <1823363429@qq.com> - 3.3.7-3 - Select repo source by image type * Fri Dec 27 2024 Li Zixin - 3.3.7-2 -- Gitee From 21edd25d3308738324d26027c734be3773fff7e5 Mon Sep 17 00:00:00 2001 From: lw520203 <1823363429@qq.com> Date: Wed, 15 Jan 2025 15:18:08 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calamares.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/calamares.spec b/calamares.spec index 04da974..858dd1f 100644 --- a/calamares.spec +++ b/calamares.spec @@ -2,7 +2,7 @@ Name: calamares Version: 3.3.7 -Release: 3 +Release: 2 Summary: Installer from a live CD/DVD/USB to disk License: GPL-3.0-or-later @@ -349,7 +349,7 @@ cd %{_builddir} || exit 0 rm -rf %{buildroot} %changelog -* Wed Jan 15 2025 Liu Wang <1823363429@qq.com> - 3.3.7-3 +* Wed Jan 15 2025 Liu Wang <1823363429@qq.com> - 3.3.7-2 - Select repo source by image type * Fri Dec 27 2024 Li Zixin - 3.3.7-2 -- Gitee