summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gdbinit7
-rwxr-xr-xmk31
-rw-r--r--settings.conf23
-rw-r--r--src/modules/pacstrap/CMakeLists.txt9
-rw-r--r--src/modules/pacstrap/module.desc5
-rw-r--r--src/modules/pacstrap/pacstrap.conf18
-rw-r--r--src/modules/pacstrap/pacstrap.cpp173
-rw-r--r--src/modules/pacstrap/pacstrap.h51
8 files changed, 295 insertions, 22 deletions
diff --git a/.gdbinit b/.gdbinit
new file mode 100644
index 000000000..743e793ba
--- /dev/null
+++ b/.gdbinit
@@ -0,0 +1,7 @@
+file /home/bill/calamares/git/build/calamares
+
+#break /home/bill/calamares/git/src/modules/netinstall/NetInstallPAge.cpp:83
+break /home/bill/calamares/git/src/modules/netinstall/PackageModel.cpp:161
+break /home/bill/calamares/git/src/modules/locale/LocalePage.cpp:250
+
+run
diff --git a/mk b/mk
index 7d549f0b3..8e943a6f7 100755
--- a/mk
+++ b/mk
@@ -1,14 +1,33 @@
#!/bin/bash
-[ -d build ] || mkdir build
+# sudo pacman -S arch-install-scripts
+
+
+if [ ! -d build ]
+then mkdir build
+else rm build/Makefile > /dev/null
+fi
+# if [ ! -d /etc/calamares/ ]
+# then sudo mkdir /etc/calamares
+# sudo ln -s `pwd`/settings.conf /etc/calamares/
+# sudo ln -s `pwd`/src/branding /etc/calamares/
+# fi
+
+
cd build
-cmake -DCMAKE_BUILD_TYPE=Debug \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DSKIP_MODULES="interactiveterminal webview" ..
-[ -f Makefile ] && make
-sudo make uninstall ; sudo make install
+cmake -DCMAKE_BUILD_TYPE=Debug \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DSKIP_MODULES="dracut dracutlukscfg dummycpp dummyprocess dummypython \
+ dummypythonqt grubcfg initramfs initramfscfg \
+ interactiveterminal license luksbootkeyfile \
+ luksopenswaphookcfg plymouthcfg removeuser webview" ..
+[ -f Makefile ] && make ; (($?)) && cd .. && exit
+#sudo make uninstall
+sudo make install
cd ..
+
[ "`lsmod | grep squashfs`" ] || sudo modprobe squashfs
[ -f /usr/bin/calamares ] && sudo calamares
+# [ -f build/calamares ] && sudo build/calamares
diff --git a/settings.conf b/settings.conf
index d2bff983b..6c4f620d9 100644
--- a/settings.conf
+++ b/settings.conf
@@ -8,7 +8,8 @@
# "local" means LIBDIR/calamares/modules with settings in SHARE/calamares/modules or
# /etc/calamares/modules.
# YAML: list of strings.
-modules-search: [ local ]
+# modules-search: [ local ]
+modules-search: [ build/src/modules ]
# Instances section. This section is optional, and it defines custom instances for
# modules of any kind. An instance entry has an instance name, a module name, and
@@ -61,44 +62,34 @@ modules-search: [ local ]
sequence:
- show:
- welcome
-# - dummypythonqt
- locale
- keyboard
+# - netinstall
- partition
- users
# - tracking
- summary
- exec:
-# - dummycpp
-# - dummyprocess
-# - dummypython
-# - dummypythonqt
- partition
+ - pacstrap
- mount
- - unpackfs
+# - unpackfs
+ - networkcfg
+# - packages
- machineid
- fstab
- locale
- keyboard
- localecfg
-# - luksbootkeyfile
-# - luksopenswaphookcfg
-# - dracutlukscfg
-# - plymouthcfg
- initcpiocfg
- initcpio
- users
- displaymanager
- - networkcfg
- hwclock
- services
-# - dracut
-# - initramfs
-# - grubcfg
- bootloader
- umount
- show:
-# - webview@owncloud
- finished
# A branding component is a directory, either in SHARE/calamares/branding or in
diff --git a/src/modules/pacstrap/CMakeLists.txt b/src/modules/pacstrap/CMakeLists.txt
new file mode 100644
index 000000000..f9f9fea37
--- /dev/null
+++ b/src/modules/pacstrap/CMakeLists.txt
@@ -0,0 +1,9 @@
+calamares_add_plugin( pacstrap
+ TYPE job
+ EXPORT_MACRO PLUGINDLLEXPORT_PRO
+ SOURCES
+ pacstrap.cpp
+ LINK_PRIVATE_LIBRARIES
+ calamares
+ SHARED_LIB
+)
diff --git a/src/modules/pacstrap/module.desc b/src/modules/pacstrap/module.desc
new file mode 100644
index 000000000..37cfb122c
--- /dev/null
+++ b/src/modules/pacstrap/module.desc
@@ -0,0 +1,5 @@
+---
+type: "job"
+name: "pacstrap"
+interface: "qtplugin"
+load: "libcalamares_job_pacstrap.so"
diff --git a/src/modules/pacstrap/pacstrap.conf b/src/modules/pacstrap/pacstrap.conf
new file mode 100644
index 000000000..dfed55705
--- /dev/null
+++ b/src/modules/pacstrap/pacstrap.conf
@@ -0,0 +1,18 @@
+---
+syntax: "YAML map of anything"
+example:
+ whats_this: "module-specific configuration"
+ from_where: "pacstrap.conf"
+a_list:
+ - "item1"
+ - "item2"
+ - "item3"
+ - "item4"
+a_list_of_maps:
+ - name: "an Item"
+ contents:
+ - "an element"
+ - "another element"
+ - name: "another item"
+ contents:
+ - "not much"
diff --git a/src/modules/pacstrap/pacstrap.cpp b/src/modules/pacstrap/pacstrap.cpp
new file mode 100644
index 000000000..3779caee6
--- /dev/null
+++ b/src/modules/pacstrap/pacstrap.cpp
@@ -0,0 +1,173 @@
+/* === This file is part of Calamares - <http://github.com/calamares> ===
+ *
+ * Copyright 2014, Teo Mrnjavac <teo@kde.org> (original dummypython code)
+ * Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
+ *
+ * Calamares 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.
+ *
+ * Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "pacstrap.h"
+
+#include <QProcess>
+#include <QDateTime>
+#include <QThread>
+
+#include "CalamaresVersion.h"
+#include "JobQueue.h"
+#include "GlobalStorage.h"
+
+#include "utils/Logger.h"
+
+PacstrapCppJob::PacstrapCppJob( QObject* parent )
+ : Calamares::CppJob( parent )
+{
+}
+
+
+PacstrapCppJob::~PacstrapCppJob()
+{
+}
+
+
+QString
+PacstrapCppJob::prettyName() const
+{
+ return tr( "Pacstrap C++ Job" );
+}
+
+
+static QString variantListToString( const QVariantList& variantList );
+static QString variantMapToString( const QVariantMap& variantMap );
+static QString variantHashToString( const QVariantHash& variantHash );
+
+
+static QString
+variantToString( const QVariant& variant )
+{
+ switch ( variant.type() )
+ {
+ case QVariant::Map:
+ return variantMapToString( variant.toMap() );
+
+ case QVariant::Hash:
+ return variantHashToString( variant.toHash() );
+
+ case QVariant::List:
+ case QVariant::StringList:
+ return variantListToString( variant.toList() );
+
+ default:
+ return variant.toString();
+ }
+}
+
+
+static QString
+variantListToString( const QVariantList& variantList )
+{
+ QStringList result;
+ for ( const QVariant& variant : variantList )
+ result.append( variantToString( variant ) );
+ return '{' + result.join(',') + '}';
+}
+
+
+static QString
+variantMapToString( const QVariantMap& variantMap )
+{
+ QStringList result;
+ for ( auto it = variantMap.constBegin(); it != variantMap.constEnd(); ++it )
+ result.append( it.key() + '=' + variantToString( it.value() ) );
+ return '[' + result.join(',') + ']';
+}
+
+
+static QString
+variantHashToString( const QVariantHash& variantHash )
+{
+ QStringList result;
+ for ( auto it = variantHash.constBegin(); it != variantHash.constEnd(); ++it )
+ result.append( it.key() + '=' + variantToString( it.value() ) );
+ return '<' + result.join(',') + '>';
+}
+
+
+Calamares::JobResult
+PacstrapCppJob::exec()
+{
+// Calamares::GlobalStorage *gs = Calamares::JobQueue::instance()->globalStorage();
+// foreach (const QString &key, gs->keys())
+// cDebug() << QString("[PACSTRAPCPP]: globalStorage[%1]=%2\n").arg( key, gs->value( key ).toString() );
+
+// QProcess::execute( "echo SKIPPING parabola-prepare.desc" );
+
+
+ Calamares::GlobalStorage *globalStorage = Calamares::JobQueue::instance()->globalStorage();
+ QString mountpoint = "/tmp/pacstrap";
+ QString target_device = "";
+ QVariantList partitions = globalStorage->value( "partitions" ).toList() ;
+
+ // locate target device for root filesystem
+ foreach (const QVariant &partition, partitions)
+ {
+cDebug() << QString("[PACSTRAPCPP]: partition=%1").arg(variantToString(partition));
+
+ QVariantMap variantMap = partition.toMap();
+ QString device = variantMap.value("device").toString();
+ QString fs = variantMap.value("fs").toString();
+ QString mount_point = variantMap.value("mountPoint").toString();
+ QString uuid = variantMap.value("uuid").toString();
+
+ if (mount_point == "/")
+ target_device = device;
+
+if (mount_point == "/")cDebug() << QString("[PACSTRAPCPP]: target_device=%1").arg(device);
+ }
+ if (target_device == "")
+ return Calamares::JobResult::error("Target device for root filesystem is unspecified.");
+
+
+ QString keyring_cmd = "/bin/sh -c \"pacman -Sy --noconfirm parabola-keyring && \
+ pacman-key --populate parabola && \
+ pacman-key --refresh-keys \"";
+ QString mkdir_cmd = QString( "/bin/sh -c \"mkdir %1\"" ).arg( mountpoint );
+ QString mount_cmd = QString( "/bin/sh -c \"mount %1 %2\"" ).arg( target_device, mountpoint );
+ QString pacstrap_cmd = QString( "/bin/sh -c \"pacstrap -c %1 base linux-libre\"" ).arg( mountpoint );
+// QString pacstrap_kernel_cmd = QString( "/bin/sh -c \"pacstrap -c %1 linux-libre\"" ).arg( mountpoint );
+ QString umount_cmd = QString( "/bin/sh -c \"umount %1\"" ).arg( target_device );
+
+cDebug() << QString("[PACSTRAPCPP]: pacstrap_cmd=%1").arg(pacstrap_cmd);
+QProcess::execute( "/bin/sh -c \"ls /tmp/\"" );
+
+ // boot-strap install root filesystem
+// QProcess::execute( keyring_cmd );
+ QProcess::execute( mkdir_cmd );
+ QProcess::execute( mount_cmd );
+ QProcess::execute( pacstrap_cmd );
+ QProcess::execute( umount_cmd );
+
+ emit progress( 0.1 );
+
+ return Calamares::JobResult::ok();
+// return Calamares::JobResult::error("just cuz");
+}
+
+
+void
+PacstrapCppJob::setConfigurationMap( const QVariantMap& configurationMap )
+{
+ m_configurationMap = configurationMap;
+}
+
+CALAMARES_PLUGIN_FACTORY_DEFINITION( PacstrapCppJobFactory, registerPlugin<PacstrapCppJob>(); )
diff --git a/src/modules/pacstrap/pacstrap.h b/src/modules/pacstrap/pacstrap.h
new file mode 100644
index 000000000..b325c4bff
--- /dev/null
+++ b/src/modules/pacstrap/pacstrap.h
@@ -0,0 +1,51 @@
+/* === This file is part of Calamares - <http://github.com/calamares> ===
+ *
+ * Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
+ *
+ * Calamares 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.
+ *
+ * Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DUMMYCPPJOB_H
+#define DUMMYCPPJOB_H
+
+#include <QObject>
+#include <QVariantMap>
+
+#include <CppJob.h>
+
+#include <utils/PluginFactory.h>
+
+#include <PluginDllMacro.h>
+
+class PLUGINDLLEXPORT PacstrapCppJob : public Calamares::CppJob
+{
+ Q_OBJECT
+
+public:
+ explicit PacstrapCppJob( QObject* parent = nullptr );
+ virtual ~PacstrapCppJob();
+
+ QString prettyName() const override;
+
+ Calamares::JobResult exec() override;
+
+ void setConfigurationMap( const QVariantMap& configurationMap ) override;
+
+private:
+ QVariantMap m_configurationMap;
+};
+
+CALAMARES_PLUGIN_FACTORY_DECLARATION( PacstrapCppJobFactory )
+
+#endif // DUMMYCPPJOB_H