Merge branch 'master' into fix-undef-vars

This commit is contained in:
Anton Hvornum 2021-04-06 16:31:31 +00:00 committed by GitHub
commit ce2ebc0026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 175 additions and 271 deletions

View File

@ -6,7 +6,7 @@ Therefore guidelines and style changes to the code might come into affect as wel
## Discussions
Currently, questions, bugs and suggestions should be reported through [GitHub issue tracker](https://github.com/Torxed/archinstall/issues).<br>
Currently, questions, bugs and suggestions should be reported through [GitHub issue tracker](https://github.com/archlinux/archinstall/issues).<br>
For less formal discussions there are also a [archinstall Discord server](https://discord.gg/cqXU88y).
## Coding convention

View File

@ -2,43 +2,24 @@
# Contributor: Giancarlo Razzolini <grazzolini@archlinux.org>
# Contributor: demostanis worlds <demostanis@protonmail.com>
pkgbase=archinstall-git
pkgname=('archinstall-git' 'python-archinstall-git')
pkgname=archinstall-git
pkgver=$(git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')
pkgrel=1
pkgdesc="Just another guided/automated Arch Linux installer with a twist"
arch=('any')
url="https://github.com/Torxed/archinstall"
url="https://github.com/archlinux/archinstall"
license=('GPL')
depends=('python')
makedepends=('python-setuptools')
provides=('python-archinstall')
conflicts=('archinstall' 'python-archinstall' 'python-archinstall-git')
build() {
cd "$startdir"
cd "$startdir"
python setup.py build
}
package_archinstall-git() {
depends=('python-archinstall-git')
conflicts=('archinstall')
cd "$startdir"
mkdir -p "${pkgdir}/usr/bin"
# Install a guided profile
cat - > "${pkgdir}/usr/bin/archinstall" <<EOF
#!/bin/sh
python -m archinstall $@
EOF
chmod +x "${pkgdir}/usr/bin/archinstall"
}
package_python-archinstall-git() {
conflicts=('python-archinstall')
cd "$startdir"
python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 --skip-build
package() {
cd "$startdir"
python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}

View File

@ -1,39 +0,0 @@
# Maintainer: Anton Hvornum anton@hvornum.se
# Contributor: Anton Hvornum anton@hvornum.se
pkgname="archinstall-bin"
pkgver="2.1.3"
pkgdesc="Installs a pre-built binary of ${pkgname}"
pkgrel=1
url="https://github.com/Torxed/archinstall"
license=('GPLv3')
provides=("${pkgname}")
arch=('x86_64')
source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/Torxed/archinstall/archive/v$pkgver.tar.gz")
#depends=('python>=3.8')
makedepends=('python>=3.8' 'nuitka')
optdepends=('pyttsx3: Adds text-to-speach support for log/screen output.')
sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea')
build() {
cd "${pkgname}-${pkgver}"
nuitka3 --standalone --show-progress archinstall
cp -r examples/ archinstall.dist/
}
package() {
echo "${srcdir}"
cd "${pkgname}-${pkgver}"
mkdir -p "${pkgdir}/var/lib/archinstall/"
mkdir -p "${pkgdir}/usr/bin"
mv archinstall.dist/* "${pkgdir}/var/lib/archinstall/"
echo '#!/bin/bash' > "${pkgdir}/usr/bin/archinstall-bin"
echo '(cd /var/lib/archinstall && exec ./archinstall)' >> "${pkgdir}/usr/bin/archinstall-bin"
chmod +x "${pkgdir}/var/lib/archinstall/archinstall"
chmod +x "${pkgdir}/usr/bin/archinstall-bin"
}

View File

@ -1,30 +0,0 @@
# Maintainer: Anton Hvornum <anton@hvornum.se>
# Contributor: demostanis worlds <demostanis@protonmail.com>
pkgname="archinstall"
pkgver="2.1.3"
pkgdesc="Installs launcher scripts for archinstall"
pkgrel=1
url="https://github.com/Torxed/archinstall"
license=('GPLv3')
provides=("${pkgname}")
arch=('x86_64')
source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/Torxed/archinstall/archive/v$pkgver.tar.gz")
depends=('python-archinstall')
sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea')
package() {
mkdir -p "${pkgdir}/usr/bin"
# Install a guided profile
cat - > "${pkgdir}/usr/bin/archinstall" <<EOF
#!/bin/sh
python -m archinstall $@
EOF
chmod +x "${pkgdir}/usr/bin/archinstall"
}
# vim:ft=sh

View File

@ -1,40 +0,0 @@
# Maintainer: Anton Hvornum <anton@hvornum.se>
# Contributor: demostanis worlds <demostanis@protonmail.com>
pkgname="python-archinstall"
pkgver="2.1.3"
pkgdesc="Installs ${pkgname} as a python library."
pkgrel=1
url="https://github.com/Torxed/archinstall"
source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/Torxed/archinstall/archive/v$pkgver.tar.gz")
license=('GPLv3')
provides=("${pkgname}")
arch=('x86_64')
depends=('python>=3.8')
makedepends=('python-setuptools')
optdepends=('pyttsx3: Adds text-to-speech support for log/screen output.')
sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea')
build() {
cd "archinstall-${pkgver}"
python setup.py build
# Build man pages
cd docs
make man
}
package() {
cd "archinstall-${pkgver}"
python setup.py install \
--prefix=/usr \
--root="${pkgdir}" \
--optimize=1
install -Dm644 docs/_build/man/archinstall.1 "${pkgdir}"/usr/share/man/man1/archinstall.1
}
# vim:ft=sh

View File

@ -1,4 +1,4 @@
# <img src="https://github.com/Torxed/archinstall/raw/master/docs/logo.png" alt="drawing" width="200"/>
# <img src="https://github.com/archlinux/archinstall/raw/master/docs/logo.png" alt="drawing" width="200"/>
Just another guided/automated [Arch Linux](https://wiki.archlinux.org/index.php/Arch_Linux) installer with a twist.
The installer also doubles as a python library to install Arch Linux and manage services, packages and other things inside the installed system *(Usually from a live medium)*.
@ -42,7 +42,7 @@ with archinstall.Filesystem(harddrive, archinstall.GPT) as fs:
harddrive.partition[0].format('fat32')
with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device:
unlocked_device.format('btrfs')
with archinstall.Installer(unlocked_device, hostname='testmachine') as installation:
if installation.minimal_installation():
installation.add_bootloader(harddrive.partition[0])
@ -62,7 +62,7 @@ This installer will perform the following:
* Installs a basic instance of Arch Linux *(base base-devel linux linux-firmware btrfs-progs efibootmgr)*
* Installs and configures a bootloader to partition 0.
* Install additional packages *(nano, wget, git)*
* Installs a network-profile called [awesome](https://github.com/Torxed/archinstall/blob/master/profiles/awesome.py) *(more on network profiles in the documentation)*
* Installs a profile with a window manager called [awesome](https://github.com/archlinux/archinstall/blob/master/profiles/awesome.py) *(more on profile installations in the [documentation](https://python-archinstall.readthedocs.io/en/latest/archinstall/Profile.html))*.
> **Creating your own ISO with this script on it:** Follow [ArchISO](https://wiki.archlinux.org/index.php/archiso)'s guide on how to create your own ISO or use a pre-built [guided ISO](https://hvornum.se/archiso/) to skip the python installation step, or to create auto-installing ISO templates. Further down are examples and cheat sheets on how to create different live ISO's.
@ -87,5 +87,5 @@ This will create a *5GB* `testimage.img` and create a loop device which we can u
`archinstall` is installed and executed in [guided mode](#docs-todo). Once the installation is complete,<br>
~~you can use qemu/kvm to boot the test media.~~ *(You'd actually need to do some EFI magic in order to point the EFI vars to the partition 0 in the test medium so this won't work entirely out of the box, but gives you a general idea of what we're going for here)*
There's also a [Building and Testing](https://github.com/Torxed/archinstall/wiki/Building-and-Testing) guide.<br>
There's also a [Building and Testing](https://github.com/archlinux/archinstall/wiki/Building-and-Testing) guide.<br>
It will go through everything from packaging, building and running *(with qemu)* the installer against a dev branch.

View File

@ -1 +0,0 @@
2.1.3

View File

@ -1,3 +0,0 @@
# This __init__ file is just here to support the
# use of archinstall as a git submodule.
from .archinstall import *

View File

@ -14,6 +14,8 @@ from .lib.output import *
from .lib.storage import *
from .lib.hardware import *
__version__ = "2.1.3"
## Basic version of arg.parse() supporting:
## --key=value
## --boolean
@ -27,4 +29,33 @@ for arg in sys.argv[1:]:
key, val = arg[2:], True
arguments[key] = val
else:
positionals.append(arg)
positionals.append(arg)
# TODO: Learn the dark arts of argparse...
# (I summon thee dark spawn of cPython)
def run_as_a_module():
"""
Since we're running this as a 'python -m archinstall' module OR
a nuitka3 compiled version of the project.
This function and the file __main__ acts as a entry point.
"""
# Add another path for finding profiles, so that list_profiles() in Script() can find guided.py, unattended.py etc.
storage['PROFILE_PATH'].append(os.path.abspath(f'{os.path.dirname(__file__)}/examples'))
if len(sys.argv) == 1:
sys.argv.append('guided')
try:
script = Script(sys.argv[1])
except ProfileNotFound as err:
print(f"Couldn't find file: {err}")
sys.exit(1)
os.chdir(os.path.abspath(os.path.dirname(__file__)))
# Remove the example directory from the PROFILE_PATH, to avoid guided.py etc shows up in user input questions.
storage['PROFILE_PATH'].pop()
script.execute()

View File

@ -2,33 +2,5 @@ import archinstall
import sys
import os
# TODO: Learn the dark arts of argparse...
# (I summon thee dark spawn of cPython)
def run_as_a_module():
"""
Since we're running this as a 'python -m archinstall' module OR
a nuitka3 compiled version of the project.
This function and the file __main__ acts as a entry point.
"""
# Add another path for finding profiles, so that list_profiles() in Script() can find guided.py, unattended.py etc.
archinstall.storage['PROFILE_PATH'].append(os.path.abspath(f'{os.path.dirname(__file__)}/examples'))
if len(sys.argv) == 1:
sys.argv.append('guided')
try:
script = archinstall.Script(sys.argv[1])
except archinstall.ProfileNotFound as err:
print(f"Couldn't find file: {err}")
sys.exit(1)
os.chdir(os.path.abspath(os.path.dirname(__file__)))
# Remove the example directory from the PROFILE_PATH, to avoid guided.py etc shows up in user input questions.
archinstall.storage['PROFILE_PATH'].pop()
script.execute()
if __name__ == '__main__':
run_as_a_module()
archinstall.run_as_a_module()

View File

@ -24,11 +24,12 @@ class BlockDevice():
self.path = path
self.info = info
self.keep_partitions = True
self.part_cache = OrderedDict()
# TODO: Currently disk encryption is a BIT missleading.
# TODO: Currently disk encryption is a BIT misleading.
# It's actually partition-encryption, but for future-proofing this
# I'm placing the encryption password on a BlockDevice level.
self.encryption_passwoed = None
self.encryption_password = None
def __repr__(self, *args, **kwargs):
return f"BlockDevice({self.device})"
@ -284,10 +285,10 @@ class Partition():
handle = luks2(self, None, None)
return handle.encrypt(self, *args, **kwargs)
def format(self, filesystem=None, path=None, allow_formatting=None, log_formating=True):
def format(self, filesystem=None, path=None, allow_formatting=None, log_formatting=True):
"""
Format can be given an overriding path, for instance /dev/null to test
the formating functionality and in essence the support for the given filesystem.
the formatting functionality and in essence the support for the given filesystem.
"""
if filesystem is None:
filesystem = self.filesystem
@ -305,7 +306,7 @@ class Partition():
if not allow_formatting:
raise PermissionError(f"{self} is not formatable either because instance is locked ({self.allow_formatting}) or a blocking flag was given ({allow_formatting})")
if log_formating:
if log_formatting:
log(f'Formatting {path} -> {filesystem}', level=LOG_LEVELS.Info)
if filesystem == 'btrfs':
@ -400,7 +401,7 @@ class Partition():
2. UnknownFilesystemFormat that indicates that we don't support the given filesystem type
"""
try:
self.format(self.filesystem, '/dev/null', log_formating=False, allow_formatting=True)
self.format(self.filesystem, '/dev/null', log_formatting=False, allow_formatting=True)
except SysCallError:
pass # We supported it, but /dev/null is not formatable as expected so the mkfs call exited with an error code
except UnknownFilesystemFormat as err:

View File

@ -73,7 +73,7 @@ class Installer():
return self
def __exit__(self, *args, **kwargs):
# b''.join(sys_command(f'sync')) # No need to, since the underlaying fs() object will call sync.
# b''.join(sys_command(f'sync')) # No need to, since the underlying fs() object will call sync.
# TODO: https://stackoverflow.com/questions/28157929/how-to-safely-handle-an-exception-inside-a-context-manager
if len(args) >= 2 and args[1]:
@ -85,7 +85,7 @@ class Installer():
# We avoid printing /mnt/<log path> because that might confuse people if they note it down
# and then reboot, and a identical log file will be found in the ISO medium anyway.
print(f"[!] A log file has been created here: {os.path.join(storage['LOG_PATH'], storage['LOG_FILE'])}")
print(f" Please submit this issue (and file) to https://github.com/Torxed/archinstall/issues")
print(f" Please submit this issue (and file) to https://github.com/archlinux/archinstall/issues")
raise args[1]
self.genfstab()
@ -98,8 +98,10 @@ class Installer():
self.log('Some required steps were not successfully installed/configured before leaving the installer:', bg='black', fg='red', level=LOG_LEVELS.Warning)
for step in missing_steps:
self.log(f' - {step}', bg='black', fg='red', level=LOG_LEVELS.Warning)
self.log(f"Detailed error logs can be found at: {storage['LOG_PATH']}", level=LOG_LEVELS.Warning)
self.log(f"Submit this zip file as an issue to https://github.com/Torxed/archinstall/issues", level=LOG_LEVELS.Warning)
self.log(f"Submit this zip file as an issue to https://github.com/archlinux/archinstall/issues", level=LOG_LEVELS.Warning)
self.sync_log_to_install_medium()
return False
@ -268,7 +270,7 @@ class Installer():
return True
def minimal_installation(self):
## Add nessecary packages if encrypting the drive
## Add necessary packages if encrypting the drive
## (encrypted partitions default to btrfs for now, so we need btrfs-progs)
## TODO: Perhaps this should be living in the function which dictates
## the partitioning. Leaving here for now.
@ -306,14 +308,14 @@ class Installer():
mkinit.write('MODULES=(btrfs)\n')
mkinit.write('BINARIES=(/usr/bin/btrfs)\n')
mkinit.write('FILES=()\n')
mkinit.write('HOOKS=(base udev autodetect modconf block encrypt filesystems keymap keyboard fsck)\n')
mkinit.write('HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)\n')
sys_command(f'/usr/bin/arch-chroot {self.mountpoint} mkinitcpio -p linux')
elif self.partition.encrypted:
with open(f'{self.mountpoint}/etc/mkinitcpio.conf', 'w') as mkinit:
mkinit.write('MODULES=()\n')
mkinit.write('BINARIES=()\n')
mkinit.write('FILES=()\n')
mkinit.write('HOOKS=(base udev autodetect modconf block encrypt filesystems keymap keyboard fsck)\n')
mkinit.write('HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)\n')
sys_command(f'/usr/bin/arch-chroot {self.mountpoint} mkinitcpio -p linux')
self.helper_flags['base'] = True
@ -401,7 +403,7 @@ class Installer():
# The tricky thing with doing the import archinstall.session instead is that
# profiles might be run from a different chroot, and there's no way we can
# guarantee file-path safety when accessing the installer object that way.
# Doing the __builtins__ replacement, ensures that the global vriable "installation"
# Doing the __builtins__ replacement, ensures that the global variable "installation"
# is always kept up to date. It's considered a nasty hack - but it's a safe way
# of ensuring 100% accuracy of archinstall session variables.
__builtins__['installation'] = self

View File

@ -43,8 +43,6 @@ class luks2():
return True
def encrypt(self, partition, password=None, key_size=512, hash_type='sha512', iter_time=10000, key_file=None):
# TODO: We should be able to integrate this into the main log some how.
# Perhaps post-mortem?
if not self.partition.allow_formatting:
raise DiskError(f'Could not encrypt volume {self.partition} due to it having a formatting lock.')

View File

@ -56,7 +56,7 @@ def wirelessScan(interface):
storage['_WIFI'][interface]['scanning'] = True
# TOOD: Full WiFi experience might get evolved in the future, pausing for now 2021-01-25
# TODO: Full WiFi experience might get evolved in the future, pausing for now 2021-01-25
def getWirelessNetworks(interface):
# TODO: Make this oneliner pritter to check if the interface is scanning or not.
if not '_WIFI' in storage or interface not in storage['_WIFI'] or storage['_WIFI'][interface].get('scanning', False) is False:
@ -65,4 +65,4 @@ def getWirelessNetworks(interface):
time.sleep(5)
for line in sys_command(f"iwctl station {interface} get-networks"):
print(line)
print(line)

View File

@ -6,7 +6,7 @@ from pathlib import Path
from .storage import storage
# TODO: use logging's built in levels instead.
# Altough logging is threaded and I wish to avoid that.
# Although logging is threaded and I wish to avoid that.
# It's more Pythonistic or w/e you want to call it.
class LOG_LEVELS:
Critical = 0b001
@ -88,7 +88,7 @@ def log(*args, **kwargs):
# Attempt to colorize the output if supported
# Insert default colors and override with **kwargs
if supports_color():
kwargs = {'bg' : 'black', 'fg': 'white', **kwargs}
kwargs = {'fg': 'white', **kwargs}
string = stylize_output(string, **kwargs)
# If a logfile is defined in storage,
@ -130,4 +130,4 @@ def log(*args, **kwargs):
# We use sys.stdout.write()+flush() instead of print() to try and
# fix issue #94
sys.stdout.write(f"{string}\n")
sys.stdout.flush()
sys.stdout.flush()

View File

@ -112,11 +112,11 @@ class Script():
if f"{self.profile}" in self.examples:
return self.localize_path(self.examples[self.profile]['path'])
# TODO: Redundant, the below block shouldnt be needed as profiles are stripped of their .py, but just in case for now:
# TODO: Redundant, the below block shouldn't be needed as profiles are stripped of their .py, but just in case for now:
elif f"{self.profile}.py" in self.examples:
return self.localize_path(self.examples[f"{self.profile}.py"]['path'])
# Path was not found in any known examples, check if it's an abolute path
# Path was not found in any known examples, check if it's an absolute path
if os.path.isfile(self.profile):
return self.profile
@ -156,7 +156,7 @@ class Profile(Script):
def install(self):
# Before installing, revert any temporary changes to the namespace.
# This ensures that the namespace during installation is the original initation namespace.
# This ensures that the namespace during installation is the original initiation namespace.
# (For instance awesome instead of aweosme.py or app-awesome.py)
self.namespace = self.original_namespace
return self.execute()
@ -194,11 +194,11 @@ class Application(Profile):
if f"{self.profile}" in self.examples:
return self.localize_path(self.examples[self.profile]['path'])
# TODO: Redundant, the below block shouldnt be needed as profiles are stripped of their .py, but just in case for now:
# TODO: Redundant, the below block shouldn't be needed as profiles are stripped of their .py, but just in case for now:
elif f"{self.profile}.py" in self.examples:
return self.localize_path(self.examples[f"{self.profile}.py"]['path'])
# Path was not found in any known examples, check if it's an abolute path
# Path was not found in any known examples, check if it's an absolute path
if os.path.isfile(self.profile):
return os.path.basename(self.profile)
@ -210,7 +210,7 @@ class Application(Profile):
def install(self):
# Before installing, revert any temporary changes to the namespace.
# This ensures that the namespace during installation is the original initation namespace.
# This ensures that the namespace during installation is the original initiation namespace.
# (For instance awesome instead of aweosme.py or app-awesome.py)
self.namespace = self.original_namespace
return self.execute()
return self.execute()

View File

@ -14,7 +14,7 @@ storage = {
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'profiles'),
#os.path.abspath(f'{os.path.dirname(__file__)}/../examples')
],
'UPSTREAM_URL' : 'https://raw.githubusercontent.com/Torxed/archinstall/master/profiles',
'UPSTREAM_URL' : 'https://raw.githubusercontent.com/archlinux/archinstall/master/profiles',
'PROFILE_DB' : None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabing.
'LOG_PATH' : '/var/log/archinstall',
'LOG_FILE' : 'install.log',

View File

@ -1,4 +1,4 @@
import getpass, pathlib, os, shutil
import getpass, pathlib, os, shutil, re
from .exceptions import *
from .profiles import Profile
from .locale_helpers import search_keyboard_layout
@ -18,11 +18,21 @@ def get_terminal_width():
def get_longest_option(options):
return max([len(x) for x in options])
def check_for_correct_username(username):
if re.match(r'^[a-z_][a-z0-9_-]*\$?$', username) and len(username) <= 32:
return True
log(
"The username you entered is invalid. Try again",
level=LOG_LEVELS.Warning,
fg='red'
)
return False
def get_password(prompt="Enter a password: "):
while (passwd := getpass.getpass(prompt)):
passwd_verification = getpass.getpass(prompt='And one more time for verification: ')
if passwd != passwd_verification:
log(' * Passwords did not match * ', bg='black', fg='red')
log(' * Passwords did not match * ', fg='red')
continue
if len(passwd.strip()) <= 0:
@ -50,14 +60,16 @@ def print_large_list(options, padding=5, margin_bottom=0, separator=': '):
def ask_for_superuser_account(prompt='Create a required super-user with sudo privileges: ', forced=False):
while 1:
new_user = input(prompt).strip(' ')
if not new_user and forced:
# TODO: make this text more generic?
# It's only used to create the first sudo user when root is disabled in guided.py
log(' * Since root is disabled, you need to create a least one (super) user!', bg='black', fg='red')
log(' * Since root is disabled, you need to create a least one (super) user!', fg='red')
continue
elif not new_user and not forced:
raise UserError("No superuser was created.")
elif not check_for_correct_username(new_user):
continue
password = get_password(prompt=f'Password for user {new_user}: ')
return {new_user: {"!password" : password}}
@ -70,6 +82,8 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan
new_user = input(prompt).strip(' ')
if not new_user:
break
if not check_for_correct_username(new_user):
continue
password = get_password(prompt=f'Password for user {new_user}: ')
if input("Should this user be a sudo (super) user (y/N): ").strip(' ').lower() in ('y', 'yes'):
@ -108,7 +122,6 @@ def ask_to_configure_network():
log(
"You need to enter a valid IP in IP-config mode.",
level=LOG_LEVELS.Warning,
bg='black',
fg='red'
)
@ -151,7 +164,7 @@ def ask_for_main_filesystem_format():
def generic_select(options, input_text="Select one of the above by index or absolute value: ", sort=True):
"""
A generic select function that does not output anything
other than the options and their indexs. As an example:
other than the options and their indexes. As an example:
generic_select(["first", "second", "third option"])
1: first

View File

@ -22,7 +22,7 @@ Locale related
.. autofunction:: archinstall.search_keyboard_layout
.. autofunction:: archinstall.set_keyboard_layout
.. autofunction:: archinstall.set_keyboard_language
Services
========
@ -34,7 +34,7 @@ Mirrors
.. autofunction:: archinstall.filter_mirrors_by_region
.. autofunction:: archinstall.add_custom_mirror
.. autofunction:: archinstall.add_custom_mirrors
.. autofunction:: archinstall.insert_mirrors
@ -87,4 +87,4 @@ Exceptions
.. autofunction:: archinstall.ProfileError
.. autofunction:: archinstall.SysCallError
.. autofunction:: archinstall.SysCallError

View File

@ -1,4 +1,4 @@
.. _examples.python:
.. _examples.binary:
Binary executable
=================
@ -11,7 +11,7 @@ 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.
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:
@ -20,4 +20,4 @@ To run the `guided` installed, all you have to do *(after installing or compilin
./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.
Anything else won't be found. This is subject to change in the future to make it a bit more flexible.

View File

@ -3,7 +3,7 @@
Discord
=======
There's a discord channel which is frequent by some `contributors <https://github.com/Torxed/archinstall/graphs/contributors>`_.
There's a discord channel which is frequent by some `contributors <https://github.com/archlinux/archinstall/graphs/contributors>`_.
To join the server, head over to `https://discord.gg/cqXU88y <https://discord.gg/cqXU88y>`_'s server and join in.
There's not many rules other than common sense and treat others with respect.

View File

@ -3,7 +3,7 @@
Issue tracker & bugs
====================
Issues and bugs should be reported over at `https://github.com/Torxed/archinstall/issues <https://github.com/Torxed/archinstall/issues>`_.
Issues and bugs should be reported over at `https://github.com/archlinux/archinstall/issues <https://github.com/Torxed/archinstall/issues>`_.
General questions, enhancements and security issues can be reported over there too.
For quick issues or if you need help, head over the to the Discord server which has a help channel.

View File

@ -43,12 +43,15 @@ Some of the features of Archinstall are:
examples/python
examples/binary
..
examples/scripting
.. toctree::
..
.. toctree::
:maxdepth: 3
:caption: Programming Guide
..
programming_guide/requirements
programming_guide/basic_concept
@ -64,4 +67,4 @@ Some of the features of Archinstall are:
:maxdepth: 3
:caption: API Helper functions
archinstall/general
archinstall/general

View File

@ -1,10 +1,10 @@
.. _installing.binary
.. _installing.binary:
Binary executable
=================
Archinstall can be compiled into a standalone executable.
For Arch Linux based systems, there's a package for this called `archinstall <https://archlinux.life/>`_.
For Arch Linux based systems, there's a package for this called `archinstall <https://archlinux.org/packages/extra/any/archinstall/>`_.
.. warning::
This is not required if you're running archinstall on a pre-built ISO. The installation is only required if you're creating your own scripted installations.
@ -21,7 +21,7 @@ Archinstall is on the `official repositories <https://wiki.archlinux.org/index.p
Using PKGBUILD
--------------
The `source <https://github.com/Torxed/archinstall>`_ contains a binary `PKGBUILD <https://github.com/Torxed/archinstall/tree/master/PKGBUILD/archinstall>`_ which can be either copied straight off the website. Or cloned using `git clone https://github.com/Torxed/archinstall`.
The `source <https://github.com/archlinux/archinstall>`_ contains a binary `PKGBUILD <https://github.com/Torxed/archinstall/tree/master/PKGBUILD/archinstall>`_ which can be either copied straight off the website. Or cloned using `git clone https://github.com/Torxed/archinstall`.
Once you've obtained the `PKGBUILD`, building it is pretty straight forward.
@ -37,7 +37,7 @@ Which should produce a `archinstall-X.x.z-1.pkg.tar.zst` that can be installed u
.. note::
For a complete guide on the build process, please consult the wiki on `PKGBUILD <https://wiki.archlinux.org/index.php/PKGBUILD>`_.
For a complete guide on the build process, please consult the `PKGBUILD on ArchWiki <https://wiki.archlinux.org/index.php/PKGBUILD>`_.
Manual compilation
------------------
@ -49,4 +49,4 @@ Simply clone or download the source, and while standing in the cloned folder `./
nuitka3 --standalone --show-progress archinstall
This requires the `nuitka <https://archlinux.org/packages/community/any/nuitka/>`_ package as well as `python3` to be installed locally.
This requires the `nuitka <https://archlinux.org/packages/community/any/nuitka/>`_ package as well as `python3` to be installed locally.

View File

@ -66,7 +66,7 @@ Default is :code:`auto detect best mirror`
As an example:
* :code:`Sweden` *(wich a capital :code:`S`)* will only use mirrors from Sweden.
* :code:`Sweden` *(with a capital :code:`S`)* will only use mirrors from Sweden.
Selection of drive
------------------
@ -175,4 +175,4 @@ After which you can press :code:`Enter` can be pressed in order to start the for
Post installation
-----------------
Once the installation is complete, green text should appear saying that it's safe to `reboot`, which is also the command you use to reboot.
Once the installation is complete, green text should appear saying that it's safe to `reboot`, which is also the command you use to reboot.

View File

@ -54,7 +54,7 @@ Or you can clone it, we'll clone it here but both methods work the same.
.. code-block:: console
git clone https://github.com/Torxed/archinstall
git clone https://github.com/archlinux/archinstall
Either you can move the folder into your project and simply do

View File

@ -1,6 +1,6 @@
# Pull Request Template
Make sure you've checked out the [contribution guideline](https://github.com/Torxed/archinstall/blob/master/CONTRIBUTING.md).<br>
Make sure you've checked out the [contribution guideline](https://github.com/archlinux/archinstall/blob/master/CONTRIBUTING.md).<br>
Most of the guidelines are not enforced, but is heavily encouraged.
## Description

View File

@ -58,7 +58,7 @@ def ask_user_questions():
if archinstall.arguments['harddrive'].has_partitions():
archinstall.log(f"{archinstall.arguments['harddrive']} contains the following partitions:", fg='yellow')
# We curate a list pf supported paritions
# We curate a list pf supported partitions
# and print those that we don't support.
partition_mountpoints = {}
for partition in archinstall.arguments['harddrive']:
@ -69,7 +69,7 @@ def ask_user_questions():
except archinstall.UnknownFilesystemFormat as err:
archinstall.log(f" {partition} (Filesystem not supported)", fg='red')
# We then ask what to do with the paritions.
# We then ask what to do with the partitions.
if (option := archinstall.ask_for_disk_layout()) == 'abort':
archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.")
exit(1)
@ -89,7 +89,7 @@ def ask_user_questions():
mountpoint = input(f"Enter a mount-point for {partition}: ").strip(' ')
if len(mountpoint):
# Get a valid & supported filesystem for the parition:
# Get a valid & supported filesystem for the partition:
while 1:
new_filesystem = input(f"Enter a valid filesystem for {partition} (leave blank for {partition.filesystem}): ").strip(' ')
if len(new_filesystem) <= 0:
@ -112,7 +112,7 @@ def ask_user_questions():
try:
partition.format(new_filesystem, path='/dev/null', log_formating=False, allow_formatting=True)
except archinstall.UnknownFilesystemFormat:
archinstall.log(f"Selected filesystem is not supported yet. If you want archinstall to support '{new_filesystem}', please create a issue-ticket suggesting it on github at https://github.com/Torxed/archinstall/issues.")
archinstall.log(f"Selected filesystem is not supported yet. If you want archinstall to support '{new_filesystem}', please create a issue-ticket suggesting it on github at https://github.com/archlinux/archinstall/issues.")
archinstall.log(f"Until then, please enter another supported filesystem.")
continue
except archinstall.SysCallError:
@ -120,7 +120,7 @@ def ask_user_questions():
# But that means our .format() function supported it.
break
# When we've selected all three criterias,
# When we've selected all three criteria,
# We can safely mark the partition for formatting and where to mount it.
# TODO: allow_formatting might be redundant since target_mountpoint should only be
# set if we actually want to format it anyway.
@ -170,13 +170,12 @@ def ask_user_questions():
else:
archinstall.arguments['profile'] = archinstall.list_profiles()[archinstall.arguments['profile']]
# Check the potentially selected profiles preperations to get early checks if some additional questions are needed.
# Check the potentially selected profiles preparations to get early checks if some additional questions are needed.
if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_prep_function():
with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported:
if not imported._prep_function():
archinstall.log(
' * Profile\'s preparation requirements was not fulfilled.',
bg='black',
fg='red'
)
exit(1)
@ -342,4 +341,4 @@ def perform_installation(device, boot_partition, language, mirrors):
ask_user_questions()
perform_installation_steps()
perform_installation_steps()

View File

@ -1,4 +1,4 @@
import archinstall
installation.add_additional_packages("gnome gnome-extra gdm") # We'll create a gnome-minimal later, but for now, we'll avoid issues by giving more than we need.
# Note: gdm should be part of the gnome group, but adding it here for clarity
installation.add_additional_packages("gnome gnome-tweaks gnome-todo gnome-sound-recorder gdm")
# Note: gdm should be part of the gnome group, but adding it here for clarity

View File

@ -13,8 +13,8 @@ def _prep_function(*args, **kwargs):
supported_desktops = ['gnome', 'kde', 'awesome']
desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ')
# Temporarly store the selected desktop profile
# in a session-safe location, since this module will get re-loaded
# Temporarily store the selected desktop profile
# in a session-safe location, since this module will get reloaded
# the next time it gets executed.
archinstall.storage['_desktop_profile'] = desktop
@ -29,7 +29,7 @@ def _prep_function(*args, **kwargs):
if __name__ == 'desktop':
"""
This "profile" is a meta-profile.
There are no specific desktop-steps, it simply routes
There are no desktop-specific steps, it simply routes
the installer to whichever desktop environment/window manager was chosen.
Maybe in the future, a network manager or similar things *could* be added here.
@ -37,7 +37,7 @@ if __name__ == 'desktop':
it trying to be a turn-key desktop distribution.
There are plenty of desktop-turn-key-solutions based on Arch Linux,
this is therefor just a helper to get started
this is therefore just a helper to get started
"""
# TODO: Remove magic variable 'installation' and place it

View File

@ -1,4 +1,4 @@
# A desktop environement using "KDE".
# A desktop environment using "KDE".
import archinstall, os
# TODO: Remove hard dependency of bash (due to .bash_profile)

View File

@ -1,4 +1,4 @@
# A desktop environement using "KDE".
# A desktop environment using "KDE".
import archinstall, os

3
pyproject.toml Normal file
View File

@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

39
setup.cfg Normal file
View File

@ -0,0 +1,39 @@
[metadata]
name = archinstall
version = attr: archinstall.__version__
description = Arch Linux installer - guided, templates etc.
author = Anton Hvornum
author_email = anton@hvornum.se
long_description = file: README.md
long_description_content_type = text/markdown
license = GPL
license_files =
LICENSE
project_urls =
Source = https://github.com/archlinux/archinstall
Documentation = https://archinstall.readthedocs.io/
classifers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Operating System :: POSIX :: Linux
[options]
packages = find:
python_requires = >= 3.8
[options.packages.find]
include =
archinstall
archinstall.*
[options.package_data]
archinstall =
examples/*.py
profiles/*.py
profiles/applications/*.py
[options.entry_points]
console_scripts =
archinstall = archinstall:run_as_a_module

View File

@ -1,27 +1,2 @@
import setuptools, glob, shutil
with open("README.md", "r") as fh:
long_description = fh.read()
with open('VERSION', 'r') as fh:
VERSION = fh.read()
setuptools.setup(
name="archinstall",
version=VERSION,
author="Anton Hvornum",
author_email="anton@hvornum.se",
description="Arch Linux installer - guided, templates etc.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/Torxed/archinstall",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3.8",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: POSIX :: Linux",
],
python_requires='>=3.8',
setup_requires=['wheel'],
package_data={'archinstall': glob.glob('examples/*.py') + glob.glob('profiles/*.py') + glob.glob('profiles/applications/*.py')},
)
import setuptools
setuptools.setup()