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@hvornum.se>2023-11-21 14:34:30 +0100
committerGitHub <noreply@github.com>2023-11-21 14:34:30 +0100
commitcc806d9c4ce29212c2848c15b4b184feace3e1ac (patch)
tree28f4f1cb3b943d178a07a37369d3133093c51e17 /docs/examples
parente6344f93f7e476d05bbcd642f2ed91fdde545870 (diff)
Started a re-write of the docs (#1967)
* Started a re-write of the docs, using CSV for tables and re-organizing parameter definitions * Added final config options in --config, some have external references which needs to be populated * Forgot to escape a comma * Clarified a note * Added disk configuration and disk encryption docs * Changed way of installing using source and python * Added a 'list script' that lists available scripts. This could be converted to a argparse later. But this does the trick for now. And it's added to ease documentation and listing of available options. * Added a 'Known issues' section, as well as renamed the issues tab * Finished up the known issues section * Added a section regarding --plugin * Added plugin description, tweaked disk_config to the latest changes from #2221 * Added custom-commands docs, and improved some creds and known issue links
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/binary.rst23
-rw-r--r--docs/examples/python.rst83
2 files changed, 60 insertions, 46 deletions
diff --git a/docs/examples/binary.rst b/docs/examples/binary.rst
deleted file mode 100644
index 51dbd1dd..00000000
--- a/docs/examples/binary.rst
+++ /dev/null
@@ -1,23 +0,0 @@
-.. _examples.binary:
-
-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/archlinux/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:: console
-
- ./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.
diff --git a/docs/examples/python.rst b/docs/examples/python.rst
index b5478fe2..7fb3f6c3 100644
--- a/docs/examples/python.rst
+++ b/docs/examples/python.rst
@@ -4,7 +4,7 @@ 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.
+The way the library is invoked in module mode is limited to executing scripts under the `scripts`_ folder.
It's therefore important to place any script or profile you wish to invoke in the examples folder prior to building and installing.
@@ -12,7 +12,7 @@ Pre-requisites
--------------
We'll assume you've followed the :ref:`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.
+Before actually installing the library, you will need to place your custom installer-scripts under `scripts`_ as a python file.
More on how you create these in the next section.
@@ -24,36 +24,73 @@ 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.
+We begin by creating "`scripts`_:code:`/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.
+This script can now already be called using :code:`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 hard drives as an example.
-To do this, we'll begin by importing `archinstall` in our `./archinstall/examples/test_installer.py` and call some functions.
+To do this, we'll begin by importing :code:`archinstall` in our "`scripts`_:code:`/test_installer.py`" and call a function whtin ``archinstall``.
.. code-block:: python
import archinstall
- all_drives = archinstall.all_blockdevices(partitions=False)
- print(list(all_drives.keys()))
+ print(archinstall.disk.device_handler.devices)
+
+Now, go ahead and reference the :ref:`installing.python.manual` installation method.
+After runnig ``python -m archinstall test_installer`` it should print something that looks like:
+
+.. code-block:: text
+
+ [
+ BDevice(
+ disk=<parted.disk.Disk object at 0x7fbe17156050>,
+ device_info=_DeviceInfo(
+ model='PC801 NVMe SK hynix 512GB',
+ path=PosixPath('/dev/nvme0n1'),
+ type='nvme',
+ total_size=Size(value=512110190592, unit=<Unit.B: 1>,
+ sector_size=SectorSize(value=512, unit=<Unit.B: 1>)),
+ free_space_regions=[
+ <archinstall.lib.disk.device_model.DeviceGeometry object at 0x7fbe166c4250>,
+ <archinstall.lib.disk.device_model.DeviceGeometry object at 0x7fbe166c4c50>,
+ <archinstall.lib.disk.device_model.DeviceGeometry object at 0x7fbe166c4a10>],
+ sector_size=SectorSize(value=512, unit=<Unit.B: 1>),
+ read_only=False,
+ dirty=False
+ ),
+ partition_infos=[
+ _PartitionInfo(
+ partition=<parted.partition.Partition object at 0x7fbe166c4a90>,
+ name='primary',
+ type=<PartitionType.Primary: 'primary'>,
+ fs_type=<FilesystemType.Fat32: 'fat32'>,
+ path='/dev/nvme0n1p1',
+ start=Size(value=2048, unit=<Unit.sectors: 'sectors'>, sector_size=SectorSize(value=512, unit=<Unit.B: 1>)),
+ length=Size(value=535822336, unit=<Unit.B: 1>, sector_size=SectorSize(value=512, unit=<Unit.B: 1>)),
+ flags=[
+ <PartitionFlag.Boot: 1>,
+ <PartitionFlag.ESP: 18>
+ ],
+ partn=1,
+ partuuid='a26be943-c193-41f4-9930-9341cf5f6b19',
+ uuid='6EE9-2C00',
+ disk=<parted.disk.Disk object at 0x7fbe17156050>,
+ mountpoints=[
+ PosixPath('/boot')
+ ],
+ btrfs_subvol_infos=[]
+ ),
+ _PartitionInfo(...)
+ ]
+ )
+ ]
+
+That means your script is in the right place, and ``archinstall`` is working as intended.
-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:: console
-
- python -m archinstall test_installer
+.. note::
-This should now print all available drives on your system.
+ Most calls, including the one above requires `root <https://en.wikipedia.org/wiki/Superuser>`_ privileges.
-.. note::
- This should work on any system, not just Arch Linux based ones. But note that other functions in the library rely heavily on Arch Linux based commands to execute the installation steps. Such as `arch-chroot`.
+.. _scripts: https://github.com/archlinux/archinstall/tree/master/archinstall/scripts \ No newline at end of file