added openmamba automatic partitioning patch [release 1.0.1-8mamba;Thu May 21 2015]

This commit is contained in:
Silvan Calarco 2024-01-05 21:03:40 +01:00
parent 3752836b28
commit 9d4942fdc4
2 changed files with 91 additions and 2 deletions

View File

@ -0,0 +1,82 @@
--- calamares-1.0.1/src/modules/partition/gui/EraseDiskPage.cpp.orig 2015-05-21 12:53:55.003623191 +0200
+++ calamares-1.0.1/src/modules/partition/gui/EraseDiskPage.cpp 2015-05-21 15:26:40.937147517 +0200
@@ -36,6 +36,7 @@
#include <QFormLayout>
#include <QListView>
#include <QLabel>
+#include <QProcess>
EraseDiskPage::EraseDiskPage( QWidget* parent )
: QWidget( parent )
@@ -170,18 +171,70 @@
m_core->createPartitionTable( dev, PartitionTable::msdos );
}
+#define GiB * 1024ul * 1024ul * 1024ul
+
+ qint64 total_size = (dev->totalSectors() - first_free_sector) * dev->logicalSectorSize();
+ qint64 root_size = 30 GiB;
+
+ QProcess p;
+ p.start( "awk", { "/MemTotal/ {print $2}", "/proc/meminfo" } );
+ p.waitForFinished();
+ QString memoryLine = p.readAllStandardOutput().simplified();
+ // Set automatic swap size to RAM * 1.1
+ qint64 swap_size = memoryLine.toLongLong() * 1152ul;
+ // No swap on small disks
+ if (total_size - swap_size < 30 GiB) swap_size = 0;
+
+ // home partition if big enough disk
+ qint64 home_size = total_size - swap_size - 30 GiB;
+ if (home_size < 30 GiB) {
+ home_size = 0;
+ root_size = total_size - swap_size;
+ }
+
Partition* rootPartition = PMUtils::createNewPartition(
dev->partitionTable(),
*dev,
PartitionRole( PartitionRole::Primary ),
FileSystem::Ext4,
first_free_sector,
- dev->totalSectors() - 1 //last sector
+ first_free_sector + root_size / dev->logicalSectorSize() - 1
);
PartitionInfo::setMountPoint( rootPartition, "/" );
PartitionInfo::setFormat( rootPartition, true );
m_core->createPartition( dev, rootPartition );
+ first_free_sector = first_free_sector + root_size / dev->logicalSectorSize();
+
+ if (swap_size > 0) {
+ Partition* swapPartition = PMUtils::createNewPartition(
+ dev->partitionTable(),
+ *dev,
+ PartitionRole( PartitionRole::Primary ),
+ FileSystem::LinuxSwap,
+ first_free_sector,
+ first_free_sector + swap_size / dev->logicalSectorSize() - 1
+ );
+ //PartitionInfo::setMountPoint( swapPartition, "" );
+ PartitionInfo::setFormat( swapPartition, true );
+ m_core->createPartition( dev, swapPartition );
+ first_free_sector = first_free_sector + swap_size / dev->logicalSectorSize();
+ }
+
+ if (home_size > 0) {
+ Partition* homePartition = PMUtils::createNewPartition(
+ dev->partitionTable(),
+ *dev,
+ PartitionRole( PartitionRole::Primary ),
+ FileSystem::Ext4,
+ first_free_sector,
+ first_free_sector + home_size / dev->logicalSectorSize() - 1
+ );
+ PartitionInfo::setMountPoint( homePartition, "/home" );
+ PartitionInfo::setFormat( homePartition, true );
+ m_core->createPartition( dev, homePartition );
+ }
+ m_core->setBootLoaderInstallPath( dev->deviceNode() );
{
qDeleteAll( m_previewFrame->children() );

View File

@ -1,6 +1,6 @@
Name: calamares Name: calamares
Version: 1.0.1 Version: 1.0.1
Release: 7mamba Release: 8mamba
Summary: Distribution-independent installer framework Summary: Distribution-independent installer framework
Group: Graphical Desktop/Applications/Utilities Group: Graphical Desktop/Applications/Utilities
Vendor: openmamba Vendor: openmamba
@ -17,6 +17,7 @@ Patch3: calamares-1.0.1-fix_reboot.patch
Patch4: calamares-1.0.1-dracut_hostonly.patch Patch4: calamares-1.0.1-dracut_hostonly.patch
Patch5: calamares-1.0.1-locale_use_LANG.patch Patch5: calamares-1.0.1-locale_use_LANG.patch
Patch6: calamares-1.0.1-replace_chroot_call.patch Patch6: calamares-1.0.1-replace_chroot_call.patch
Patch7: calamares-1.0.1-openmamba_autopartitioning.patch
License: GPL License: GPL
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel BuildRequires: glibc-devel
@ -69,6 +70,8 @@ This package contains libraries and header files for developing applications tha
%prep %prep
%setup -q -a1 %setup -q -a1
#-D -T
#:<< _EOF
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
@ -76,9 +79,10 @@ This package contains libraries and header files for developing applications tha
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1
rmdir src/modules/partition/partitionmanager rmdir src/modules/partition/partitionmanager
mv partitionmanager-%{version} src/modules/partition/partitionmanager mv partitionmanager-%{version} src/modules/partition/partitionmanager
%build %build
%cmake -d build \ %cmake -d build \
@ -198,6 +202,9 @@ install -D -m0755 src/branding/default/squid.png %{buildroot}%{_datadir}/pixmaps
%changelog %changelog
* Thu May 21 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.1-8mamba
- added openmamba automatic partitioning patch
* Sat Mar 07 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.1-7mamba * Sat Mar 07 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.1-7mamba
- add upstream patch to fix error in chroot_call in EFI installation - add upstream patch to fix error in chroot_call in EFI installation
- require grub and grub-efi-x86_64 - require grub and grub-efi-x86_64