diff --git a/0014-repoChange.patch b/0014-repoChange.patch new file mode 100644 index 0000000000000000000000000000000000000000..ba042ed844bace5529d0021822958b377c78e11e --- /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 0000000000000000000000000000000000000000..45f7b1115694cbaf9117d05106ebb0e3fe417d73 --- /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 a34d4260dbe25d99f03e7c7a33c99bb3bdfc0edd..858dd1f8e43048098a96561fbece0c0acb5dfa6b 100644 --- a/calamares.spec +++ b/calamares.spec @@ -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,12 @@ cd %{_builddir} || exit 0 rm -rf %{buildroot} %changelog +* 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 - Update to 1230 version +- Update to 1230 version * Wed Oct 9 2024 Li Ping - 3.3.7-1 - Initial package +- Initial package +