Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-09-28 16:38:10 +0200
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-09-28 16:38:10 +0200
commit410a0ba0b3065acd3db09bcd511036975fa0967f (patch)
tree59d843498db308059f0388eb8315c42f187ccfc2 /docs/examples
parentd44c671661707282e6ec06dc4a0c0cafb8ba19aa (diff)
Added documentation for: https://python-archinstall.readthedocs.io/en/latest/
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/binary.rst23
-rw-r--r--docs/examples/python.rst59
2 files changed, 82 insertions, 0 deletions
diff --git a/docs/examples/binary.rst b/docs/examples/binary.rst
new file mode 100644
index 00000000..7b25e201
--- /dev/null
+++ b/docs/examples/binary.rst
@@ -0,0 +1,23 @@
+.. _examples.python:
+
+Binary executable
+=================
+
+.. warning:: The binary option is limited and stiff. It's hard to modify or create your own installer-scripts this way unless you compile the source manually. If your usecase needs custom scripts, either use the pypi setup method or you'll need to adjust the PKGBUILD prior to building the arch package.
+
+The binary executable is a standalone compiled version of the library.
+It's compiled using `nuitka <https://nuitka.net/>`_ with the flag `--standalone`.
+
+Executing the binary
+--------------------
+
+As an example we'll use the `guided <https://github.com/Torxed/archinstall/blob/master/examples/guided.py>`_ installer.
+To run the `guided` installed, all you have to do *(after installing or compiling the binary)*, is run:
+
+
+.. code-block::
+
+ ./archinstall guided
+
+As mentioned, the binary is a bit rudimentary and only supports executing whatever is found directly under `./archinstall/examples`.
+Anything else won't be found. This is subject to change in the future to make it a bit more flexible. \ No newline at end of file
diff --git a/docs/examples/python.rst b/docs/examples/python.rst
new file mode 100644
index 00000000..ca0de708
--- /dev/null
+++ b/docs/examples/python.rst
@@ -0,0 +1,59 @@
+.. _examples.python:
+
+Python module
+=============
+
+Archinstall supports running in `module mode <https://docs.python.org/3/library/__main__.html>`_.
+The way the library is invoked in module mode is limited to executing scripts under the **example** folder.
+
+It's there for important to place any script or profile you wish to invoke in the examples folder prior to building and installing.
+
+Pre-requisits
+-------------
+
+We'll assume you've followed the `installing.python.manual`_ method.
+Before actually installing the library, you will need to place your custom installer-scripts under `./archinstall/examples/` as a python file.
+
+More on how you create these in the next section.
+
+.. warning::
+
+ This is subject to change in the future as this method is currently a bit stiff. The script path will become a parameter. But for now, this is by design.
+
+Creating a script
+-----------------
+
+Lets create a `test_installer` - installer as an example. This is assuming that the folder `./archinstall` is a git-clone of the main repo.
+We begin by creating `./archinstall/examples/test_installer.py`. The placement here is important later.
+
+This script can now already be called using `python -m archinstall test_installer` after a successful installation of the library itself.
+But the script won't do much. So we'll do something simple like list all the harddrives as an example.
+
+To do this, we'll begin by importing `archinstall` in our `./archinstall/examples/test_installer.py` and call some functions.
+
+.. code-block:: python
+
+ import archinstall
+
+ all_drives = archinstall.list_drives()
+ print(all_drives)
+
+This should print out a list of drives and some meta-information about them.
+As an example, this will do just fine.
+
+Now, go ahead and install the library either as a user-module or system-wide.
+
+Calling a module
+----------------
+
+Assuming you've followed the example in `Creating a script`_, you can now safely call it with:
+
+.. code-block::
+
+ python -m archinstall test_installer
+
+This should now print all available drives on your system.
+
+.. note::
+
+ This should work on any system, not just Arch Linux based ones. But note that other functions in the library relies heavily on Arch Linux based commands to execute the installation steps. Such as `arch-chroot`. \ No newline at end of file