From 2b5b1ad83da34b73ae50dcccbf6e7f291e38b06b Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 4 Apr 2021 11:28:54 -0300 Subject: Fix misspellings --- archinstall/lib/disk.py | 10 +++++----- archinstall/lib/installer.py | 6 +++--- archinstall/lib/networking.py | 4 ++-- archinstall/lib/output.py | 4 ++-- archinstall/lib/profiles.py | 14 +++++++------- archinstall/lib/storage.py | 2 +- archinstall/lib/user_interaction.py | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 10d4ef5a..2ca2f4b0 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -25,7 +25,7 @@ class BlockDevice(): self.path = path self.info = info 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 @@ -284,10 +284,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 +305,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 +400,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: diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a4321893..857e5c4f 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -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]: @@ -268,7 +268,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. @@ -401,7 +401,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 diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py index 882bcff3..2dc8be9b 100644 --- a/archinstall/lib/networking.py +++ b/archinstall/lib/networking.py @@ -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) \ No newline at end of file + print(line) diff --git a/archinstall/lib/output.py b/archinstall/lib/output.py index 537fb695..dfc6959d 100644 --- a/archinstall/lib/output.py +++ b/archinstall/lib/output.py @@ -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 @@ -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() \ No newline at end of file + sys.stdout.flush() diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 08b1d618..4ef6c533 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -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() \ No newline at end of file + return self.execute() diff --git a/archinstall/lib/storage.py b/archinstall/lib/storage.py index 9bda017d..dfbcd8c7 100644 --- a/archinstall/lib/storage.py +++ b/archinstall/lib/storage.py @@ -15,7 +15,7 @@ storage = { #os.path.abspath(f'{os.path.dirname(__file__)}/../examples') ], 'UPSTREAM_URL' : 'https://raw.githubusercontent.com/Torxed/archinstall/master/profiles', - 'PROFILE_DB' : None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabing. + 'PROFILE_DB' : None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabbing. 'LOG_PATH' : '/var/log/archinstall', 'LOG_FILE' : 'install.log', 'MOUNT_POINT' : '/mnt' diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 630862ee..8cdbbe8c 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -151,7 +151,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 -- cgit v1.2.3-70-g09d2 From 5a321d6ce540d89b1464743738e43d4ac3205832 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 4 Apr 2021 11:52:51 -0300 Subject: Update repo to archlinux/archinstall --- CONTRIBUTING.md | 2 +- PKGBUILD | 2 +- PKGBUILDs/archinstall-bin/PKGBUILD | 4 ++-- PKGBUILDs/archinstall/PKGBUILD | 4 ++-- PKGBUILDs/python-archinstall/PKGBUILD | 4 ++-- README.md | 6 +++--- archinstall/lib/installer.py | 4 ++-- archinstall/lib/storage.py | 2 +- docs/examples/binary.rst | 2 +- docs/help/discord.rst | 2 +- docs/help/issues.rst | 2 +- docs/installing/binary.rst | 2 +- docs/installing/python.rst | 2 +- docs/pull_request_template.md | 2 +- examples/guided.py | 2 +- setup.py | 2 +- 16 files changed, 22 insertions(+), 22 deletions(-) (limited to 'archinstall') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59bc3eff..48cc14d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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).
+Currently, questions, bugs and suggestions should be reported through [GitHub issue tracker](https://github.com/archlinux/archinstall/issues).
For less formal discussions there are also a [archinstall Discord server](https://discord.gg/cqXU88y). ## Coding convention diff --git a/PKGBUILD b/PKGBUILD index 7e073666..77e6b512 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -8,7 +8,7 @@ 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') diff --git a/PKGBUILDs/archinstall-bin/PKGBUILD b/PKGBUILDs/archinstall-bin/PKGBUILD index 855d19a5..25d4b15d 100644 --- a/PKGBUILDs/archinstall-bin/PKGBUILD +++ b/PKGBUILDs/archinstall-bin/PKGBUILD @@ -5,11 +5,11 @@ pkgname="archinstall-bin" pkgver="2.1.3" pkgdesc="Installs a pre-built binary of ${pkgname}" pkgrel=1 -url="https://github.com/Torxed/archinstall" +url="https://github.com/archlinux/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") +source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/archlinux/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.') diff --git a/PKGBUILDs/archinstall/PKGBUILD b/PKGBUILDs/archinstall/PKGBUILD index 961ee79c..7b1c4947 100644 --- a/PKGBUILDs/archinstall/PKGBUILD +++ b/PKGBUILDs/archinstall/PKGBUILD @@ -5,11 +5,11 @@ pkgname="archinstall" pkgver="2.1.3" pkgdesc="Installs launcher scripts for archinstall" pkgrel=1 -url="https://github.com/Torxed/archinstall" +url="https://github.com/archlinux/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") +source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/archlinux/archinstall/archive/v$pkgver.tar.gz") depends=('python-archinstall') sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea') diff --git a/PKGBUILDs/python-archinstall/PKGBUILD b/PKGBUILDs/python-archinstall/PKGBUILD index 3a735ac9..1c3876f5 100644 --- a/PKGBUILDs/python-archinstall/PKGBUILD +++ b/PKGBUILDs/python-archinstall/PKGBUILD @@ -5,8 +5,8 @@ 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") +url="https://github.com/archlinux/archinstall" +source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/archlinux/archinstall/archive/v$pkgver.tar.gz") license=('GPLv3') provides=("${pkgname}") arch=('x86_64') diff --git a/README.md b/README.md index c1ec746e..9037a5d3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# drawing +# drawing 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)*. @@ -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 network-profile called [awesome](https://github.com/archlinux/archinstall/blob/master/profiles/awesome.py) *(more on network profiles in the documentation)* > **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,
~~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.
+There's also a [Building and Testing](https://github.com/archlinux/archinstall/wiki/Building-and-Testing) guide.
It will go through everything from packaging, building and running *(with qemu)* the installer against a dev branch. diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a4321893..c0d174ff 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -85,7 +85,7 @@ class Installer(): # We avoid printing /mnt/ 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() @@ -99,7 +99,7 @@ class Installer(): 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: {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 diff --git a/archinstall/lib/storage.py b/archinstall/lib/storage.py index 9bda017d..43d088bb 100644 --- a/archinstall/lib/storage.py +++ b/archinstall/lib/storage.py @@ -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', diff --git a/docs/examples/binary.rst b/docs/examples/binary.rst index 6940d591..c73b3a5d 100644 --- a/docs/examples/binary.rst +++ b/docs/examples/binary.rst @@ -11,7 +11,7 @@ It's compiled using `nuitka `_ with the flag `--standalone` Executing the binary -------------------- -As an example we'll use the `guided `_ installer. +As an example we'll use the `guided `_ installer. To run the `guided` installed, all you have to do *(after installing or compiling the binary)*, is run: diff --git a/docs/help/discord.rst b/docs/help/discord.rst index 609fbecb..ce15766a 100644 --- a/docs/help/discord.rst +++ b/docs/help/discord.rst @@ -3,7 +3,7 @@ Discord ======= -There's a discord channel which is frequent by some `contributors `_. +There's a discord channel which is frequent by some `contributors `_. To join the server, head over to `https://discord.gg/cqXU88y `_'s server and join in. There's not many rules other than common sense and treat others with respect. diff --git a/docs/help/issues.rst b/docs/help/issues.rst index f29b18cc..d4f71b70 100644 --- a/docs/help/issues.rst +++ b/docs/help/issues.rst @@ -3,7 +3,7 @@ Issue tracker & bugs ==================== -Issues and bugs should be reported over at `https://github.com/Torxed/archinstall/issues `_. +Issues and bugs should be reported over at `https://github.com/archlinux/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. diff --git a/docs/installing/binary.rst b/docs/installing/binary.rst index c51fb2c0..9156a1bf 100644 --- a/docs/installing/binary.rst +++ b/docs/installing/binary.rst @@ -21,7 +21,7 @@ Archinstall is on the `official repositories `_ contains a binary `PKGBUILD `_ which can be either copied straight off the website. Or cloned using `git clone https://github.com/Torxed/archinstall`. +The `source `_ contains a binary `PKGBUILD `_ 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. diff --git a/docs/installing/python.rst b/docs/installing/python.rst index 94cfb243..68365753 100644 --- a/docs/installing/python.rst +++ b/docs/installing/python.rst @@ -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 diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md index 886ea244..6da175ae 100644 --- a/docs/pull_request_template.md +++ b/docs/pull_request_template.md @@ -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).
+Make sure you've checked out the [contribution guideline](https://github.com/archlinux/archinstall/blob/master/CONTRIBUTING.md).
Most of the guidelines are not enforced, but is heavily encouraged. ## Description diff --git a/examples/guided.py b/examples/guided.py index 723eed5b..5803e13f 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -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: diff --git a/setup.py b/setup.py index 02029a70..35d51025 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setuptools.setup( description="Arch Linux installer - guided, templates etc.", long_description=long_description, long_description_content_type="text/markdown", - url="https://github.com/Torxed/archinstall", + url="https://github.com/archlinux/archinstall", packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3.8", -- cgit v1.2.3-70-g09d2 From 6c31ad7aa06e2d0b946e9e2843e4385e26daeca9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 4 Apr 2021 17:43:56 +0200 Subject: encryption_passwed -> encryption_password --- archinstall/lib/disk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 2ca2f4b0..0608b47b 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -28,7 +28,7 @@ class BlockDevice(): # 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})" -- cgit v1.2.3-70-g09d2 From 992ee851d4d57cdd11f490123f94c2c23f8c1e76 Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Sun, 4 Apr 2021 22:12:31 +0300 Subject: Add lowercase conversion for usernames --- archinstall/lib/user_interaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 8cdbbe8c..e5cdb670 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -49,7 +49,7 @@ 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(' ') + new_user = input(prompt).strip(' ').lower() if not new_user and forced: # TODO: make this text more generic? @@ -67,7 +67,7 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan super_users = {} while 1: - new_user = input(prompt).strip(' ') + new_user = input(prompt).strip(' ').lower() if not new_user: break password = get_password(prompt=f'Password for user {new_user}: ') -- cgit v1.2.3-70-g09d2 From 9b2af4eb4cbcbb9f32aecbe43d2987a796864048 Mon Sep 17 00:00:00 2001 From: Zach Osman Date: Sun, 4 Apr 2021 15:46:02 -0400 Subject: Closed #110 --- archinstall/lib/output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall') diff --git a/archinstall/lib/output.py b/archinstall/lib/output.py index dfc6959d..6b184b4b 100644 --- a/archinstall/lib/output.py +++ b/archinstall/lib/output.py @@ -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, -- cgit v1.2.3-70-g09d2 From 69a873084593c32b2766315c02a1ddbcdac731d9 Mon Sep 17 00:00:00 2001 From: Zach Osman Date: Sun, 4 Apr 2021 16:14:13 -0400 Subject: Removing background color definitions for all log functions --- archinstall/lib/user_interaction.py | 5 ++--- examples/guided.py | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 8cdbbe8c..e7243a25 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -22,7 +22,7 @@ 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: @@ -54,7 +54,7 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri 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.") @@ -108,7 +108,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' ) diff --git a/examples/guided.py b/examples/guided.py index 2e553c4d..a92343f7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -176,7 +176,6 @@ def ask_user_questions(): if not imported._prep_function(): archinstall.log( ' * Profile\'s preparation requirements was not fulfilled.', - bg='black', fg='red' ) exit(1) -- cgit v1.2.3-70-g09d2 From b46e391ebca3e6d4ebb1c19c099d6f05187ef120 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 4 Apr 2021 22:40:17 +0200 Subject: Fixes: AttributeError: 'BlockDevice' object has no attribute 'keep_partitions' --- archinstall/lib/disk.py | 1 + 1 file changed, 1 insertion(+) (limited to 'archinstall') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 0608b47b..dbb69662 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -24,6 +24,7 @@ class BlockDevice(): self.path = path self.info = info + self.keep_partitions = True self.part_cache = OrderedDict() # TODO: Currently disk encryption is a BIT misleading. # It's actually partition-encryption, but for future-proofing this -- cgit v1.2.3-70-g09d2 From 2c73989da4fc19de86e273f9fdda9840b312dff5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 5 Apr 2021 11:38:17 +0200 Subject: Removed a TODO comment --- archinstall/lib/luks.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index 62067ec1..a1d42196 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -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.') -- cgit v1.2.3-70-g09d2 From 7f691ce1c992c16551459162fbef593daad1e4c8 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 15:30:18 +0200 Subject: Switch to setup.cfg Configure setup.cfg to find all Python packages. Add more metadata to package. --- VERSION | 1 - __init__.py | 3 --- archinstall/__init__.py | 4 +++- setup.cfg | 35 +++++++++++++++++++++++++++++++++++ setup.py | 29 ++--------------------------- 5 files changed, 40 insertions(+), 32 deletions(-) delete mode 100644 VERSION delete mode 100644 __init__.py create mode 100644 setup.cfg (limited to 'archinstall') diff --git a/VERSION b/VERSION deleted file mode 100644 index abae0d9a..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.1.3 \ No newline at end of file diff --git a/__init__.py b/__init__.py deleted file mode 100644 index bd22d3f4..00000000 --- a/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# This __init__ file is just here to support the -# use of archinstall as a git submodule. -from .archinstall import * diff --git a/archinstall/__init__.py b/archinstall/__init__.py index d4452d38..c2773b64 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -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,4 @@ for arg in sys.argv[1:]: key, val = arg[2:], True arguments[key] = val else: - positionals.append(arg) \ No newline at end of file + positionals.append(arg) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..ccbddf8a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,35 @@ +[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 diff --git a/setup.py b/setup.py index 35d51025..a4f49f92 100644 --- a/setup.py +++ b/setup.py @@ -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/archlinux/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() -- cgit v1.2.3-70-g09d2 From ecf7a2a237a04882c93fd4d743b037f7af6bc253 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 16:21:12 +0200 Subject: Add console_scripts archinstall entry point archinstall should be callable from the command-line. Previously this was achieved with a shell script, however Python packages contain a built in way to to this via the entry points mechanism. --- archinstall/__init__.py | 29 +++++++++++++++++++++++++++++ archinstall/__main__.py | 30 +----------------------------- setup.cfg | 4 ++++ 3 files changed, 34 insertions(+), 29 deletions(-) (limited to 'archinstall') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index c2773b64..d98b6daa 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -30,3 +30,32 @@ for arg in sys.argv[1:]: arguments[key] = val else: 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() diff --git a/archinstall/__main__.py b/archinstall/__main__.py index 63c2f715..86ed0108 100644 --- a/archinstall/__main__.py +++ b/archinstall/__main__.py @@ -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() diff --git a/setup.cfg b/setup.cfg index ccbddf8a..3190791e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,3 +33,7 @@ archinstall = examples/*.py profiles/*.py profiles/applications/*.py + +[options.entry_points] +console_scripts = + archinstall = archinstall:run_as_a_module -- cgit v1.2.3-70-g09d2 From 5de1154ce9708f770bacae5faa2ef3c3eea4c2e2 Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Mon, 5 Apr 2021 18:38:21 +0300 Subject: Replace lowercase conversion with correct checking --- archinstall/lib/user_interaction.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index e5cdb670..30008fad 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -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 @@ -49,8 +49,15 @@ 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(' ').lower() - + new_user = input(prompt).strip(' ') + + if not re.match('[a-z_][a-z0-9_-]*[$]?', new_user) or len(new_user) > 32: + log( + "The username you entered is invalid. Try again", + level=LOG_LEVELS.Warning, + fg='red' + ) + continue 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 @@ -67,9 +74,16 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan super_users = {} while 1: - new_user = input(prompt).strip(' ').lower() + new_user = input(prompt).strip(' ') if not new_user: break + if not re.match('[a-z_][a-z0-9_-]*[$]?', new_user) or len(new_user) > 32: + log( + "The username you entered is invalid. Try again", + level=LOG_LEVELS.Warning, + fg='red' + ) + 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'): -- cgit v1.2.3-70-g09d2 From ed2187ee709e40e9da50cec9f0eaf45e77d6a8e9 Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Mon, 5 Apr 2021 19:22:48 +0300 Subject: Update regex rule and move check to a function --- archinstall/lib/user_interaction.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 30008fad..a337066e 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -18,6 +18,16 @@ 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: ') @@ -51,12 +61,7 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri while 1: new_user = input(prompt).strip(' ') - if not re.match('[a-z_][a-z0-9_-]*[$]?', new_user) or len(new_user) > 32: - log( - "The username you entered is invalid. Try again", - level=LOG_LEVELS.Warning, - fg='red' - ) + if not check_for_correct_username(new_user): continue if not new_user and forced: # TODO: make this text more generic? @@ -77,12 +82,7 @@ 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 re.match('[a-z_][a-z0-9_-]*[$]?', new_user) or len(new_user) > 32: - log( - "The username you entered is invalid. Try again", - level=LOG_LEVELS.Warning, - fg='red' - ) + if not check_for_correct_username(new_user): continue password = get_password(prompt=f'Password for user {new_user}: ') -- cgit v1.2.3-70-g09d2 From 1da9e52d52b1f88d5069392da29b8893377009e3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 5 Apr 2021 22:06:25 +0200 Subject: Corrected for keymap before encrypt hook Also think that we should patch mkinitcpio, not replace it. Especially in the btrfs case where we simply just want to add `btrfs` to the `MODULES` section. --- archinstall/lib/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 0fc9f969..d80f8aa6 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -306,14 +306,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 -- cgit v1.2.3-70-g09d2 From 924b369233e28c11c8bfec423fa25dc9d84e61de Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Mon, 5 Apr 2021 23:13:27 +0300 Subject: Fix incorrect behavior for empty sudo username --- archinstall/lib/user_interaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index a337066e..44c0cb13 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -61,8 +61,6 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri while 1: new_user = input(prompt).strip(' ') - if not check_for_correct_username(new_user): - continue 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 @@ -70,6 +68,8 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri 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}} -- cgit v1.2.3-70-g09d2