Merge branch 'archlinux:master' into master
This commit is contained in:
commit
e01e8a42de
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"audio": "pipewire",
|
||||
"bootloader": "systemd-bootctl",
|
||||
"custom-commands": [
|
||||
"cd /home/devel; git clone https://aur.archlinux.org/paru.git",
|
||||
"chown -R devel:devel /home/devel/paru",
|
||||
"usermod -aG docker devel"
|
||||
],
|
||||
"!encryption-password": "supersecret",
|
||||
"filesystem": "btrfs",
|
||||
"harddrive": {
|
||||
"path": "/dev/nvme0n1"
|
||||
},
|
||||
"hostname": "development-box",
|
||||
"kernels": [
|
||||
"linux"
|
||||
],
|
||||
"keyboard-language": "us",
|
||||
"mirror-region": {
|
||||
"Worldwide": {
|
||||
"https://mirror.rackspace.com/archlinux/$repo/os/$arch": true
|
||||
}
|
||||
},
|
||||
"nic": {
|
||||
"NetworkManager": true
|
||||
},
|
||||
"packages": ["docker", "git", "wget", "zsh"],
|
||||
"profile": "gnome",
|
||||
"superusers": {
|
||||
"devel": {
|
||||
"!password": "devel"
|
||||
}
|
||||
},
|
||||
"timezone": "US/Eastern",
|
||||
"users": {}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import os
|
|||
import time
|
||||
|
||||
import archinstall
|
||||
from archinstall.lib.general import run_custom_user_commands
|
||||
from archinstall.lib.hardware import has_uefi
|
||||
from archinstall.lib.networking import check_mirror_reachable
|
||||
from archinstall.lib.profiles import Profile
|
||||
|
|
@ -186,10 +187,7 @@ def ask_user_questions():
|
|||
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.',
|
||||
fg='red'
|
||||
)
|
||||
archinstall.log(' * Profile\'s preparation requirements was not fulfilled.', fg='red')
|
||||
exit(1)
|
||||
|
||||
# Ask about audio server selection if one is not already set
|
||||
|
|
@ -381,6 +379,10 @@ def perform_installation(mountpoint):
|
|||
archinstall.log(' * Profile\'s post configuration requirements was not fulfilled.', fg='red')
|
||||
exit(1)
|
||||
|
||||
# If the user provided custom commands to be run post-installation, execute them now.
|
||||
if archinstall.arguments.get('custom-commands', None):
|
||||
run_custom_user_commands(archinstall.arguments['custom-commands'], installation)
|
||||
|
||||
installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow")
|
||||
if not archinstall.arguments.get('silent'):
|
||||
choice = input("Would you like to chroot into the newly created installation and perform post-installation configuration? [Y/n] ")
|
||||
|
|
|
|||
Loading…
Reference in New Issue