예제 #1
0
    """
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

    # Cinnamon requires a functioning Xorg installation.
    profile = archinstall.Profile(None, 'xorg')
    with profile.load_instructions(namespace='xorg.py') as imported:
        if hasattr(imported, '_prep_function'):
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py")
# or through conventional import cinnamon
if __name__ == 'cinnamon':
    # Install dependency profiles
    installation.install_profile('xorg')

    # Install the application cinnamon from the template under /applications/
    cinnamon = archinstall.Application(installation, 'cinnamon')
    cinnamon.install()

    installation.enable_service('lightdm')  # Light Display Manager
예제 #2
0
	before continuing any further.
	"""
    if not archinstall.storage.get('_selected_servers', None):
        servers = archinstall.Menu(
            'Choose which servers to install, if none then a minimal installation wil be done',
            available_servers,
            multi=True).run()

        archinstall.storage['_selected_servers'] = servers

    return True


if __name__ == 'server':
    """
	This "profile" is a meta-profile.
	"""
    archinstall.log('Now installing the selected servers.', level=logging.INFO)
    archinstall.log(archinstall.storage['_selected_servers'],
                    level=logging.DEBUG)
    for server in archinstall.storage['_selected_servers']:
        archinstall.log(f'Installing {server} ...', level=logging.INFO)
        app = archinstall.Application(
            archinstall.storage['installation_session'], server)
        app.install()

    archinstall.log(
        'If your selections included multiple servers with the same port, you may have to reconfigure them.',
        fg="yellow",
        level=logging.INFO)
예제 #3
0
    """
	Magic function called by the importing installer
	before continuing any further.
	"""
    selected_servers = archinstall.generic_multi_select(
        available_servers,
        f"Choose which servers to install and enable (leave blank for a minimal installation): "
    )
    archinstall.storage['_selected_servers'] = selected_servers

    return True


if __name__ == 'server':
    """
	This "profile" is a meta-profile.
	"""
    archinstall.log(f'Now installing the selected servers.',
                    level=logging.INFO)
    archinstall.log(archinstall.storage['_selected_servers'],
                    level=logging.DEBUG)
    for server in archinstall.storage['_selected_servers']:
        archinstall.log(f'Installing {server} ...', level=logging.INFO)
        app = archinstall.Application(installation, server)
        app.install()

    archinstall.log(
        'If your selections included multiple servers with the same port, you may have to reconfigure them.',
        fg="yellow",
        level=logging.INFO)
예제 #4
0
is_top_level_profile = False

def _prep_function(*args, **kwargs):
	"""
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

	# LXQt requires a functional xorg installation.
	profile = archinstall.Profile(None, 'xorg')
	with profile.load_instructions(namespace='xorg.py') as imported:
		if hasattr(imported, '_prep_function'):
			return imported._prep_function()
		else:
			print('Deprecated (??): xorg profile has no _prep_function() anymore')

# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("lxqt", "/somewhere/lxqt.py")
# or through conventional import lxqt
if __name__ == 'lxqt':
	# Install dependency profiles
	installation.install_profile('xorg')

	# Install the application xfce4 from the template under /applications/
	xfce = archinstall.Application(installation, 'lxqt')
	xfce.install()

	installation.enable_service('sddm') # SDDM Display Manager
예제 #5
0
    profile = archinstall.Profile(None, 'xorg')
    with profile.load_instructions(namespace='xorg.py') as imported:
        if hasattr(imported, '_prep_function'):
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py")
# or through conventional import awesome
if __name__ == 'awesome':
    # Install the application awesome from the template under /applications/
    awesome = archinstall.Application(installation, 'awesome')
    awesome.install()

    installation.add_additional_packages(__packages__)

    # TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead.
    with open(f'{installation.target}/etc/xdg/awesome/rc.lua', 'r') as fh:
        awesome_lua = fh.read()

    ## Replace xterm with alacritty for a smoother experience.
    awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"')

    with open(f'{installation.target}/etc/xdg/awesome/rc.lua', 'w') as fh:
        fh.write(awesome_lua)

    ## TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config)
예제 #6
0
    profile = archinstall.Profile(None, 'xorg')
    with profile.load_instructions(namespace='xorg.py') as imported:
        if hasattr(imported, '_prep_function'):
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py")
# or through conventional import awesome
if __name__ == 'awesome':
    # Install the application awesome from the template under /applications/
    awesome = archinstall.Application(installation, 'awesome')
    awesome.install()

    # Then setup and configure the desktop environment: awesome
    editor = "nano"
    filebrowser = "nemo gpicview-gtk3"
    webbrowser = "chromium"  # TODO: Ask the user to select one instead
    utils = "openssh sshfs git htop pkgfile scrot dhclient wget libu2f-host"

    installation.add_additional_packages(
        f"{webbrowser} {utils} {filebrowser} {editor}")

    alacritty = archinstall.Application(installation, 'alacritty')
    alacritty.install()

    # TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead.
예제 #7
0
def os_setup(installation):
	# if len(mirrors):
	# Certain services might be running that affects the system during installation.
	# Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist
	# We need to wait for it before we continue since we opted in to use a custom mirror/region.
	installation.log('Waiting for automatic mirror selection (reflector) to complete.', level=logging.INFO)
	while archinstall.service_state('reflector') not in ('dead', 'failed'):
		time.sleep(1)
	# Set mirrors used by pacstrap (outside of installation)
	if archinstall.arguments.get('mirror-region', None):
		archinstall.use_mirrors(archinstall.arguments['mirror-region'])  # Set the mirrors for the live medium
	if installation.minimal_installation():
		installation.set_locale(archinstall.arguments['sys-language'], archinstall.arguments['sys-encoding'].upper())
		installation.set_hostname(archinstall.arguments['hostname'])
		if archinstall.arguments['mirror-region'].get("mirrors", None) is not None:
			installation.set_mirrors(
				archinstall.arguments['mirror-region'])  # Set the mirrors in the installation medium
		if archinstall.arguments["bootloader"] == "grub-install" and archinstall.has_uefi():
			installation.add_additional_packages("grub")
		installation.add_bootloader(archinstall.arguments["bootloader"])
		if archinstall.arguments['swap']:
			installation.setup_swap('zram')

		network_config = archinstall.arguments.get('nic', None)

		if network_config:
			handler = NetworkConfigurationHandler(network_config)
			handler.config_installer(installation)

		if archinstall.arguments.get('audio', None) is not None:
			installation.log(f"This audio server will be used: {archinstall.arguments.get('audio', None)}",level=logging.INFO)
			if archinstall.arguments.get('audio', None) == 'pipewire':
				archinstall.Application(installation, 'pipewire').install()
			elif archinstall.arguments.get('audio', None) == 'pulseaudio':
				print('Installing pulseaudio ...')
				installation.add_additional_packages("pulseaudio")
		else:
			installation.log("No audio server will be installed.", level=logging.INFO)

		if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '':
			installation.add_additional_packages(archinstall.arguments.get('packages', None))

		if archinstall.arguments.get('profile', None):
			installation.install_profile(archinstall.arguments.get('profile', None))

		if archinstall.arguments.get('!users',{}):
			for user, user_info in archinstall.arguments.get('!users', {}).items():
				installation.user_create(user, user_info["!password"], sudo=False)

		if archinstall.arguments.get('!superusers',{}):
			for superuser, user_info in archinstall.arguments.get('!superusers', {}).items():
				installation.user_create(superuser, user_info["!password"], sudo=True)

		if timezone := archinstall.arguments.get('timezone', None):
			installation.set_timezone(timezone)

		if archinstall.arguments.get('ntp', False):
			installation.activate_time_syncronization()

		if archinstall.accessibility_tools_in_use():
			installation.enable_espeakup()

		if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw):
			installation.user_set_pw('root', root_pw)
import archinstall
import json
import urllib.request

__packages__ = ['nano', 'wget', 'git']

if __name__ == '52-54-00-12-34-56':
    awesome = archinstall.Application(installation, 'postgresql')
    awesome.install()
"""
# Unmount and close previous runs (Mainly only used for re-runs, but won't hurt.)
archinstall.sys_command(f'umount -R /mnt', suppress_errors=True)
archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_errors=True)

# Select a harddrive and a disk password
harddrive = archinstall.all_disks()['/dev/sda']
disk_password = '******'

with archinstall.Filesystem(harddrive) as fs:
	# Use the entire disk instead of setting up partitions on your own
	fs.use_entire_disk('luks2')

	if harddrive.partition[1].size == '512M':
		raise OSError('Trying to encrypt the boot partition for petes sake..')
	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,
예제 #9
0
is_top_level_profile = False

def _prep_function(*args, **kwargs):
	"""
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

	# XFCE requires a functional xorg installation.
	profile = archinstall.Profile(None, 'xorg')
	with profile.load_instructions(namespace='xorg.py') as imported:
		if hasattr(imported, '_prep_function'):
			return imported._prep_function()
		else:
			print('Deprecated (??): xorg profile has no _prep_function() anymore')

# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py")
# or through conventional import xfce4
if __name__ == 'xfce4':
	# Install dependency profiles
	installation.install_profile('xorg')

	# Install the application xfce4 from the template under /applications/
	xfce = archinstall.Application(installation, 'xfce4')
	xfce.install()

	installation.enable_service('lightdm') # Light Display Manager
예제 #10
0
import archinstall

# import json
# import urllib.request

__packages__ = ['nano', 'wget', 'git']

if __name__ == '52-54-00-12-34-56':
    awesome = archinstall.Application(
        archinstall.storage['installation_session'], 'postgresql')
    awesome.install()
"""
# Unmount and close previous runs (Mainly only used for re-runs, but won't hurt.)
archinstall.sys_command(f'umount -R /mnt', suppress_errors=True)
archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_errors=True)

# Select a harddrive and a disk password
harddrive = archinstall.all_disks()['/dev/sda']
disk_password = '******'

with archinstall.Filesystem(harddrive) as fs:
	# Use the entire disk instead of setting up partitions on your own
	fs.use_entire_disk('luks2')

	if harddrive.partition[1].size == '512M':
		raise OSError('Trying to encrypt the boot partition for Pete's sake..')
	harddrive.partition[0].format('fat32')

	with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device:
		unlocked_device.format('btrfs')
예제 #11
0
	profile = archinstall.Profile(None, 'xorg')
	with profile.load_instructions(namespace='xorg.py') as imported:
		if hasattr(imported, '_prep_function'):
			return imported._prep_function()
		else:
			print('Deprecated (??): xorg profile has no _prep_function() anymore')

def _post_install(*args, **kwargs):
	"""
	Another magic function called after the system 
	has been installed. 
	"""
	installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow")
	try:
		subprocess.check_call("arch-chroot /mnt",shell=True)
	except subprocess.CallProcessError:
		return False
	
	return True

if __name__ == 'i3-wm':
	# Install dependency profiles
    installation.install_profile('xorg')
    # gaps is installed by deafult so we are overriding it here
    installation.add_additional_packages("lightdm-gtk-greeter lightdm")
    # install the i3 group now
    i3 = archinstall.Application(installation, 'i3-gaps')
    i3.install()
    # Auto start lightdm for all users
    installation.enable_service('lightdm')
예제 #12
0
def perform_installation(mountpoint):
    """
	Performs the installation steps on a block device.
	Only requirement is that the block devices are
	formatted and setup prior to entering this function.
	"""
    with archinstall.Installer(mountpoint,
                               kernels=archinstall.arguments.get(
                                   'kernels', ['linux'])) as installation:
        # Mount all the drives to the desired mountpoint
        # This *can* be done outside of the installation, but the installer can deal with it.
        if archinstall.arguments.get('disk_layouts'):
            installation.mount_ordered_layout(
                archinstall.arguments['disk_layouts'])

        # Placing /boot check during installation because this will catch both re-use and wipe scenarios.
        for partition in installation.partitions:
            if partition.mountpoint == installation.target + '/boot':
                if partition.size < 0.19:  # ~200 MiB in GiB
                    raise archinstall.DiskError(
                        f"The selected /boot partition in use is not large enough to properly install a boot loader. Please resize it to at least 200MiB and re-run the installation."
                    )

        # if len(mirrors):
        # Certain services might be running that affects the system during installation.
        # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist
        # We need to wait for it before we continue since we opted in to use a custom mirror/region.
        installation.log(
            'Waiting for automatic mirror selection (reflector) to complete.',
            level=logging.INFO)
        while archinstall.service_state('reflector') not in ('dead', 'failed'):
            time.sleep(1)
        # Set mirrors used by pacstrap (outside of installation)
        if archinstall.arguments.get('mirror-region', None):
            archinstall.use_mirrors(archinstall.arguments['mirror-region']
                                    )  # Set the mirrors for the live medium
        if installation.minimal_installation():
            installation.set_locale(
                archinstall.arguments['sys-language'],
                archinstall.arguments['sys-encoding'].upper())
            installation.set_hostname(archinstall.arguments['hostname'])
            if archinstall.arguments['mirror-region'].get("mirrors",
                                                          None) is not None:
                installation.set_mirrors(
                    archinstall.arguments['mirror-region']
                )  # Set the mirrors in the installation medium
            if archinstall.arguments['swap']:
                installation.setup_swap('zram')
            if archinstall.arguments[
                    "bootloader"] == "grub-install" and archinstall.has_uefi():
                installation.add_additional_packages("grub")
            installation.add_bootloader(archinstall.arguments["bootloader"])

            # If user selected to copy the current ISO network configuration
            # Perform a copy of the config
            if archinstall.arguments.get(
                    'nic',
                {}) == 'Copy ISO network configuration to installation':
                installation.copy_iso_network_config(
                    enable_services=True
                )  # Sources the ISO network configuration to the install medium.
            elif archinstall.arguments.get('nic',
                                           {}).get('NetworkManager', False):
                installation.add_additional_packages("networkmanager")
                installation.enable_service('NetworkManager.service')
            # Otherwise, if a interface was selected, configure that interface
            elif archinstall.arguments.get('nic', {}):
                installation.configure_nic(
                    **archinstall.arguments.get('nic', {}))
                installation.enable_service('systemd-networkd')
                installation.enable_service('systemd-resolved')

            if archinstall.arguments.get('audio', None) is not None:
                installation.log(
                    f"This audio server will be used: {archinstall.arguments.get('audio', None)}",
                    level=logging.INFO)
                if archinstall.arguments.get('audio', None) == 'pipewire':
                    archinstall.Application(installation, 'pipewire').install()
                elif archinstall.arguments.get('audio', None) == 'pulseaudio':
                    print('Installing pulseaudio ...')
                    installation.add_additional_packages("pulseaudio")
            else:
                installation.log("No audio server will be installed.",
                                 level=logging.INFO)

            if archinstall.arguments.get('packages',
                                         None) and archinstall.arguments.get(
                                             'packages', None)[0] != '':
                installation.add_additional_packages(
                    archinstall.arguments.get('packages', None))

            if archinstall.arguments.get('profile', None):
                installation.install_profile(
                    archinstall.arguments.get('profile', None))

            for user, user_info in archinstall.arguments.get('!users',
                                                             {}).items():
                installation.user_create(user,
                                         user_info["!password"],
                                         sudo=False)

            for superuser, user_info in archinstall.arguments.get(
                    '!superusers', {}).items():
                installation.user_create(superuser,
                                         user_info["!password"],
                                         sudo=True)

            if timezone := archinstall.arguments.get('timezone', None):
                installation.set_timezone(timezone)

            if archinstall.arguments.get('ntp', False):
                installation.activate_time_syncronization()

            if archinstall.accessibility_tools_in_use():
                installation.enable_espeakup()

            if (root_pw := archinstall.arguments.get('!root-password',
                                                     None)) and len(root_pw):
                installation.user_set_pw('root', root_pw)

            # This step must be after profile installs to allow profiles to install language pre-requisits.
            # After which, this step will set the language both for console and x11 if x11 was installed for instance.
            installation.set_keyboard_language(
                archinstall.arguments['keyboard-layout'])

            if archinstall.arguments['profile'] and archinstall.arguments[
                    'profile'].has_post_install():
                with archinstall.arguments['profile'].load_instructions(
                        namespace=
                        f"{archinstall.arguments['profile'].namespace}.py"
                ) as imported:
                    if not imported._post_install():
                        archinstall.log(
                            ' * Profile\'s post configuration requirements was not fulfilled.',
                            fg='red')
                        exit(1)
예제 #13
0
파일: i3-wm.py 프로젝트: AggamR/archinstall
	# i3 requires a functioning Xorg installation.
	profile = archinstall.Profile(None, 'xorg')
	with profile.load_instructions(namespace='xorg.py') as imported:
		if hasattr(imported, '_prep_function'):
			return imported._prep_function()
		else:
			print('Deprecated (??): xorg profile has no _prep_function() anymore')
def _post_install(*args, **kwargs):
	"""
	Another magic function called after the system 
	has been installed. 
	"""
	installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow")
	try:
		subprocess.check_call("arch-chroot /mnt",shell=True)
	except subprocess.CallProcessError:
		return False
	
	return True

if __name__ == 'i3-wm':
    # Install dependency profiles
    installation.install_profile('xorg')
    # we are installing lightdm to auto start i3
    installation.add_additional_packages("lightdm-gtk-greeter lightdm")
    # install the i3 group now
    i3 = archinstall.Application(installation, 'i3-wm')
    i3.install()
    # Auto start lightdm for all users
    installation.enable_service('lightdm')
예제 #14
0
# A desktop environment using "Sway"

import archinstall

is_top_level_profile = False


def _prep_function(*args, **kwargs):
    """
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""
    return True


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("sway", "/somewhere/sway.py")
# or through conventional import sway
if __name__ == 'sway':
    # Install the application sway from the template under /applications/
    sway = archinstall.Application(installation, 'sway')
    sway.install()
예제 #15
0
    """
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

    # MATE requires a functional xorg installation.
    profile = archinstall.Profile(None, 'xorg')
    with profile.load_instructions(namespace='xorg.py') as imported:
        if hasattr(imported, '_prep_function'):
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("mate", "/somewhere/mate.py")
# or through conventional import mate
if __name__ == 'mate':
    # Install dependency profiles
    installation.install_profile('xorg')

    # Install the application mate from the template under /applications/
    mate = archinstall.Application(installation, 'mate')
    mate.install()

    installation.enable_service('lightdm')  # Light Display Manager
예제 #16
0
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py")
# or through conventional import kde
if __name__ == 'kde':
    # Install dependency profiles
    installation.install_profile('xorg')

    # Install the application kde from the template under /applications/
    kde = archinstall.Application(installation, 'kde')
    kde.install()

    # Enable autostart of KDE for all users
    # (there's no handy service like Gnome, so we'll hack it)
    for root, folders, files in os.walk(f'{installation.mountpoint}/home'):
        for home in folders:
            with open(os.path.join(root, f"{home}/.bash_profile"),
                      'a') as bash_profile:
                bash_profile.write('\n')
                bash_profile.write(
                    'if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then\n')
                bash_profile.write(
                    '  exec startx\n'
                )  # Possibly do 'startx' only to remain logged in if KDE crashes.
                bash_profile.write('fi\n')
예제 #17
0
    """
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

    # budgie requires a functioning Xorg installation.
    profile = archinstall.Profile(None, 'xorg')
    with profile.load_instructions(namespace='xorg.py') as imported:
        if hasattr(imported, '_prep_function'):
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("budgie", "/somewhere/budgie.py")
# or through conventional import budgie
if __name__ == 'budgie':
    # Install dependency profiles
    installation.install_profile('xorg')

    # Install the application budgie from the template under /applications/
    budgie = archinstall.Application(installation, 'budgie')
    budgie.install()

    installation.enable_service('lightdm')  # Light Display Manager
예제 #18
0
def _prep_function(*args, **kwargs):
	"""
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

	# Deepin requires a functioning Xorg installation.
	profile = archinstall.Profile(None, 'xorg')
	with profile.load_instructions(namespace='xorg.py') as imported:
		if hasattr(imported, '_prep_function'):
			return imported._prep_function()
		else:
			print('Deprecated (??): xorg profile has no _prep_function() anymore')


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("deepin", "/somewhere/deepin.py")
# or through conventional import deepin
if __name__ == 'deepin':
	# Install dependency profiles
	installation.install_profile('xorg')

	# Install the application deepin from the template under /applications/
	deepin = archinstall.Application(installation, 'deepin')
	deepin.install()

	# Enable autostart of Deepin for all users
	installation.enable_service('lightdm')
예제 #19
0
	Magic function called by the importing installer
	before continuing any further. It also avoids executing any
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

    # KDE requires a functioning Xorg installation.
    profile = archinstall.Profile(None, 'xorg')
    with profile.load_instructions(namespace='xorg.py') as imported:
        if hasattr(imported, '_prep_function'):
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py")
# or through conventional import kde
if __name__ == 'kde-wayland':
    # Install dependency profiles
    installation.install_profile('xorg')

    # Install the application kde from the template under /applications/
    kde = archinstall.Application(installation, 'kde-wayland')
    kde.install()
    print("when you login,  select Plasma (Wayland) for the wayland session")
    # Enable autostart of KDE for all users
    installation.enable_service('sddm')
예제 #20
0
	other code in this stage. So it's a safe way to ask the user
	for more input before any other installer steps start.
	"""

    # Gnome optionally supports xorg, we'll install it since it also
    # includes graphic driver setups (this might change in the future)
    profile = archinstall.Profile(None, 'xorg')
    with profile.load_instructions(namespace='xorg.py') as imported:
        if hasattr(imported, '_prep_function'):
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("gnome", "/somewhere/gnome.py")
# or through conventional import gnome
if __name__ == 'gnome':
    # Install dependency profiles
    installation.install_profile('xorg')

    # Install the application gnome from the template under /applications/
    gnome = archinstall.Application(installation, 'gnome')
    gnome.install()

    installation.enable_service('gdm')  # Gnome Display Manager
    # We could also start it via xinitrc since we do have Xorg,
    # but for gnome that's deprecated and wayland is preferred.
예제 #21
0
if __name__ == 'i3':
	"""
	This "profile" is a meta-profile.
	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.
	We should honor that Arch Linux does not officially endorse a desktop-setup, nor is
	it trying to be a turn-key desktop distribution.

	There are plenty of desktop-turn-key-solutions based on Arch Linux,
	this is therefore just a helper to get started
	"""
	
	# Install common packages for all i3 configurations
	installation.add_additional_packages(__packages__)

	# Install dependency profiles
	installation.install_profile('xorg')

	# gaps is installed by deafult so we are overriding it here
	installation.add_additional_packages("lightdm-gtk-greeter lightdm")

	# Auto start lightdm for all users
	installation.enable_service('lightdm')

	# install the i3 group now
	i3 = archinstall.Application(installation, archinstall.storage['_i3_configuration'])
	i3.install()
예제 #22
0
    profile = archinstall.Profile(None, 'xorg')
    with profile.load_instructions(namespace='xorg.py') as imported:
        if hasattr(imported, '_prep_function'):
            return imported._prep_function()
        else:
            print(
                'Deprecated (??): xorg profile has no _prep_function() anymore'
            )


# Ensures that this code only gets executed if executed
# through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py")
# or through conventional import awesome
if __name__ == 'awesome':
    # Install the application awesome from the template under /applications/
    awesome = archinstall.Application(
        archinstall.storage['installation_session'], 'awesome')
    awesome.install()

    archinstall.storage['installation_session'].add_additional_packages(
        __packages__)

    # TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead.
    with open(
            f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua",
            'r') as fh:
        awesome_lua = fh.read()

    ## Replace xterm with alacritty for a smoother experience.
    awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"')

    with open(
예제 #23
0
def perform_installation(mountpoint):
    """
	Performs the installation steps on a block device.
	Only requirement is that the block devices are
	formatted and setup prior to entering this function.
	"""
    with archinstall.Installer(mountpoint,
                               kernels=archinstall.arguments.get(
                                   'kernels', ['linux'])) as installation:
        # Mount all the drives to the desired mountpoint
        # This *can* be done outside of the installation, but the installer can deal with it.
        if archinstall.arguments.get('disk_layouts'):
            installation.mount_ordered_layout(
                archinstall.arguments['disk_layouts'])

        # Placing /boot check during installation because this will catch both re-use and wipe scenarios.
        for partition in installation.partitions:
            if partition.mountpoint == installation.target + '/boot':
                if partition.size < 0.19:  # ~200 MiB in GiB
                    raise archinstall.DiskError(
                        f"The selected /boot partition in use is not large enough to properly install a boot loader. Please resize it to at least 200MiB and re-run the installation."
                    )

        # if len(mirrors):
        # Certain services might be running that affects the system during installation.
        # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist
        # We need to wait for it before we continue since we opted in to use a custom mirror/region.
        installation.log(
            'Waiting for automatic mirror selection (reflector) to complete.',
            level=logging.INFO)
        while archinstall.service_state('reflector') not in ('dead', 'failed'):
            time.sleep(1)

        # If we've activated NTP, make sure it's active in the ISO too and
        # make sure at least one time-sync finishes before we continue with the installation
        if archinstall.arguments.get('ntp', False):
            # Activate NTP in the ISO
            archinstall.SysCommand('timedatectl set-ntp true')

            # TODO: This block might be redundant, but this service is not activated unless
            # `timedatectl set-ntp true` is executed.
            logged = False
            while archinstall.service_state(
                    'dbus-org.freedesktop.timesync1.service') not in (
                        'running'):
                if not logged:
                    installation.log(
                        f"Waiting for dbus-org.freedesktop.timesync1.service to enter running state",
                        level=logging.INFO)
                    logged = True
                time.sleep(1)

            logged = False
            while 'Server: n/a' in archinstall.SysCommand(
                    'timedatectl timesync-status --no-pager --property=Server --value'
            ):
                if not logged:
                    installation.log(
                        f"Waiting for timedatectl timesync-status to report a timesync against a server",
                        level=logging.INFO)
                    logged = True
                time.sleep(1)

        # Set mirrors used by pacstrap (outside of installation)
        if archinstall.arguments.get('mirror-region', None):
            archinstall.use_mirrors(archinstall.arguments['mirror-region']
                                    )  # Set the mirrors for the live medium

        # Retrieve list of additional repositories and set boolean values appropriately
        enable_testing = 'testing' in archinstall.arguments.get(
            'additional-repositories', None)
        enable_multilib = 'multilib' in archinstall.arguments.get(
            'additional-repositories', None)

        if installation.minimal_installation(testing=enable_testing,
                                             multilib=enable_multilib):
            installation.set_locale(
                archinstall.arguments['sys-language'],
                archinstall.arguments['sys-encoding'].upper())
            installation.set_hostname(archinstall.arguments['hostname'])
            if archinstall.arguments['mirror-region'].get("mirrors",
                                                          None) is not None:
                installation.set_mirrors(
                    archinstall.arguments['mirror-region']
                )  # Set the mirrors in the installation medium
            if archinstall.arguments['swap']:
                installation.setup_swap('zram')
            if archinstall.arguments[
                    "bootloader"] == "grub-install" and archinstall.has_uefi():
                installation.add_additional_packages("grub")
            installation.add_bootloader(archinstall.arguments["bootloader"])

            # If user selected to copy the current ISO network configuration
            # Perform a copy of the config
            network_config = archinstall.arguments.get('nic', None)

            if network_config:
                handler = NetworkConfigurationHandler(network_config)
                handler.config_installer(installation)

            if archinstall.arguments.get('audio', None) is not None:
                installation.log(
                    f"This audio server will be used: {archinstall.arguments.get('audio', None)}",
                    level=logging.INFO)
                if archinstall.arguments.get('audio', None) == 'pipewire':
                    archinstall.Application(installation, 'pipewire').install()
                elif archinstall.arguments.get('audio', None) == 'pulseaudio':
                    print('Installing pulseaudio ...')
                    installation.add_additional_packages("pulseaudio")
            else:
                installation.log("No audio server will be installed.",
                                 level=logging.INFO)

            if archinstall.arguments.get('packages',
                                         None) and archinstall.arguments.get(
                                             'packages', None)[0] != '':
                installation.add_additional_packages(
                    archinstall.arguments.get('packages', None))

            if archinstall.arguments.get('profile', None):
                installation.install_profile(
                    archinstall.arguments.get('profile', None))

            if archinstall.arguments.get('!users', {}):
                for user, user_info in archinstall.arguments.get('!users',
                                                                 {}).items():
                    installation.user_create(user,
                                             user_info["!password"],
                                             sudo=False)

            if archinstall.arguments.get('!superusers', {}):
                for superuser, user_info in archinstall.arguments.get(
                        '!superusers', {}).items():
                    installation.user_create(superuser,
                                             user_info["!password"],
                                             sudo=True)

            if timezone := archinstall.arguments.get('timezone', None):
                installation.set_timezone(timezone)

            if archinstall.arguments.get('ntp', False):
                installation.activate_time_syncronization()

            if archinstall.accessibility_tools_in_use():
                installation.enable_espeakup()

            if (root_pw := archinstall.arguments.get('!root-password',
                                                     None)) and len(root_pw):
                installation.user_set_pw('root', root_pw)

            # This step must be after profile installs to allow profiles to install language pre-requisits.
            # After which, this step will set the language both for console and x11 if x11 was installed for instance.
            installation.set_keyboard_language(
                archinstall.arguments['keyboard-layout'])

            if archinstall.arguments['profile'] and archinstall.arguments[
                    'profile'].has_post_install():
                with archinstall.arguments['profile'].load_instructions(
                        namespace=
                        f"{archinstall.arguments['profile'].namespace}.py"
                ) as imported:
                    if not imported._post_install():
                        archinstall.log(
                            ' * Profile\'s post configuration requirements was not fulfilled.',
                            fg='red')
                        exit(1)