index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | .gitlab-ci.yml | 83 | ||||
-rw-r--r-- | archinstall/lib/disk.py | 16 | ||||
-rw-r--r-- | archinstall/lib/hardware.py | 10 |
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..c57892db --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,83 @@ +# This file contains GitLab CI/CD configuration for the ArchInstall project. +# It defines several jobs that get run when a new commit is made, and is comparable to the GitHub workflows. +# All jons will be run in the official archlinux container image, so we will declare that here. +# There is an expectation that a runner exists that has the --privileged flag enabled for the build ISO job to run correctly. +# These jobs should leverage the same tag as that runner. If necessary, change the tag from 'docker' to the one it uses. + +image: archlinux:latest + +stages: + - lint + - test + - build + - publish + +mypy: + stage: lint + tags: + - docker + script: + - pacman --noconfirm -Syu python mypy + - mypy . --ignore-missing-imports || exit 0 + +flake8: + stage: lint + tags: + - docker + script: + - pacman --noconfirm -Syu python python-pip + - python -m pip install --upgrade pip + - pip install flake8 + - flake8 . --count --select=E9,F63,F7 --show-source --statistics + - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + +# We currently do not have unit tests implemented but this stage is written in anticipation of their future usage. +# When a stage name is preceeded with a '.' it's treated as "disabled" by GitLab and is not executed, so it's fine for it to be declared. +.pytest: + stage: test + tags: + - docker + script: + - pacman --noconfirm -Syu python python-pip + - python -m pip install --upgrade pip + - pip install pytest + - pytest + +# This stage might fail with exit code 137 on a shared runner. This is probably due to the CPU/memory consumption needed to run the build. +build_iso: + stage: build + tags: + - docker + script: + - pwd + - find . + - cat /etc/os-release + - mkdir -p /tmp/archlive/airootfs/root/archinstall-git; cp -r . /tmp/archlive/airootfs/root/archinstall-git + - echo "pip uninstall archinstall -y; cd archinstall-git; python setup.py install" > /tmp/archlive/airootfs/root/.zprofile + - echo "echo \"This is an unofficial ISO for development and testing of archinstall. No support will be provided.\"" >> /tmp/archlive/airootfs/root/.zprofile + - echo "echo \"This ISO was built from Git SHA $CI_COMMIT_SHA\"" >> /tmp/archlive/airootfs/root/.zprofile + - echo "echo \"Type archinstall to launch the installer.\"" >> /tmp/archlive/airootfs/root/.zprofile + - cat /tmp/archlive/airootfs/root/.zprofile + - pacman -Sy; pacman --noconfirm -S git archiso + - cp -r /usr/share/archiso/configs/releng/* /tmp/archlive + - echo -e "git\npython\npython-pip\npython-setuptools" >> /tmp/archlive/packages.x86_64 + - find /tmp/archlive + - cd /tmp/archlive; mkarchiso -v -w work/ -o out/ ./ + artifacts: + name: "Arch Live ISO" + paths: + - /tmp/archlive/out/*.iso + expire_in: 1 week + +## The following CI/CD variables need to be set to the PyPi username and password in the GitLab project's settings for this stage to work. +# * FLIT_USERNAME +# * FLIT_PASSWORD +publish_pypi: + stage: publish + tags: + - docker + script: + - pacman -Sy; pacman --noconfirm -S python python-pip + - python -m pip install --upgrade pip + - pip install setuptools wheel flit + - flit diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index d0e3f6a2..de39bafd 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -448,16 +448,16 @@ class Filesystem: if self.blockdevice.keep_partitions is False: log(f'Wiping {self.blockdevice} by using partition format {self.mode}', level=logging.DEBUG) if self.mode == GPT: - if self.raw_parted(f'{self.blockdevice.device} mklabel gpt').exit_code == 0: + if self.parted_mklabel(self.blockdevice.device, "gpt"): self.blockdevice.flush_cache() return self else: - raise DiskError('Problem setting the partition format to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel gpt') + raise DiskError('Problem setting the disk label type to GPT:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel gpt') elif self.mode == MBR: - if SysCommand(f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos').exit_code == 0: + if self.parted_mklabel(self.blockdevice.device, "msdos"): return self else: - raise DiskError('Problem setting the partition format to MBR:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos') + raise DiskError('Problem setting the disk label type to msdos:', f'/usr/bin/parted -s {self.blockdevice.device} mklabel msdos') else: raise DiskError(f'Unknown mode selected to format in: {self.mode}') @@ -552,6 +552,14 @@ class Filesystem: def set(self, partition: int, string: str): return self.parted(f'{self.blockdevice.device} set {partition + 1} {string}') == 0 + def parted_mklabel(self, device: str, disk_label: str): + # Try to unmount devices before attempting to run mklabel + try: + SysCommand(f'bash -c "umount {device}?"') + except: + pass + return self.raw_parted(f'{device} mklabel {disk_label}').exit_code == 0 + def device_state(name, *args, **kwargs): # Based out of: https://askubuntu.com/questions/528690/how-to-get-list-of-all-non-removable-disk-device-names-ssd-hdd-and-sata-ide-onl/528709#528709 diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 45e042db..a63155f5 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -48,10 +48,12 @@ AVAILABLE_GFX_DRIVERS = { "intel-media-driver", "vulkan-intel", ], - "Nvidia": { - "open-source": ["mesa", "xf86-video-nouveau", "libva-mesa-driver"], - "proprietary": ["nvidia"], - }, + "Nvidia (open-source)": [ + "mesa", + "xf86-video-nouveau", + "libva-mesa-driver" + ], + "Nvidia (proprietary)": ["nvidia"], "VMware / VirtualBox (open-source)": ["mesa", "xf86-video-vmware"], } |