Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorYash Tripathi <tripathiyash97@gmail.com>2021-05-21 16:38:22 +0530
committerYash Tripathi <tripathiyash97@gmail.com>2021-05-21 16:38:22 +0530
commite01e8a42de147cc0f84b786d5e37b1224011474c (patch)
tree142241293ffbc4ab0ffd6a750fae4d10d1538822 /archinstall
parent23d223b15cacd5139150162a4328022ef12f6469 (diff)
parent54a693be4fa2fbce83fd894b5ac3b0909f3a1e10 (diff)
Merge branch 'archlinux:master' into master
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/general.py10
-rw-r--r--archinstall/lib/mirrors.py2
2 files changed, 11 insertions, 1 deletions
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index 81793cb8..249c7890 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -366,3 +366,13 @@ def pid_exists(pid: int):
return any(subprocess.check_output(['/usr/bin/ps', '--no-headers', '-o', 'pid', '-p', str(pid)]).strip())
except subprocess.CalledProcessError:
return False
+
+
+def run_custom_user_commands(commands, installation):
+ for index, command in enumerate(commands):
+ log(f'Executing custom command "{command}" ...', fg='yellow')
+ with open(f"{installation.target}/var/tmp/user-command.{index}.sh", "w") as temp_script:
+ temp_script.write(command)
+ execution_output = SysCommand(f"arch-chroot {installation.target} bash /var/tmp/user-command.{index}.sh")
+ log(execution_output)
+ os.unlink(f"{installation.target}/var/tmp/user-command.{index}.sh")
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index a7ed7da3..ccfc2808 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -16,7 +16,7 @@ def filter_mirrors_by_region(regions, destination='/etc/pacman.d/mirrorlist', *a
region_list = []
for region in regions.split(','):
region_list.append(f'country={region}')
- response = urllib.request.urlopen(f"https://archlinux.org/mirrorlist/?{'&'.join(region_list)}&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on'")
+ response = urllib.request.urlopen(urllib.request.Request(f"https://archlinux.org/mirrorlist/?{'&'.join(region_list)}&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on'", headers={'User-Agent': 'ArchInstall'}))
new_list = response.read().replace(b"#Server", b"Server")
with open(destination, "wb") as mirrorlist:
mirrorlist.write(new_list)