index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds+github@gmail.com> | 2020-09-30 09:11:36 +0000 |
---|---|---|
committer | Anton Hvornum <anton.feeds+github@gmail.com> | 2020-09-30 09:11:36 +0000 |
commit | 85fd06fa8a20a1861c9ec0d8e15da954fe5cdd43 (patch) | |
tree | 9bcb45341bd95a225800c5c7680c632e4ebff5cd /profiles | |
parent | 5a4d68e617ba4e76137db96542ebaeb08acd70cb (diff) |
-rw-r--r-- | profiles/awesome.py | 71 | ||||
-rw-r--r-- | profiles/xorg.py | 8 |
diff --git a/profiles/awesome.py b/profiles/awesome.py index e44c2428..a0267156 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -2,29 +2,48 @@ import archinstall -# Install dependency profiles -archinstall.install_profile('xorg') - -arguments = { - 'keyboard_layout' : 'sv-latin1', - "editor" : "nano", - "mediaplayer" : "lollypop gstreamer gst-plugins-good gnome-keyring", - "filebrowser" : "nemo gpicview-gtk3", - "webbrowser" : "chromium", - "window_manager" : "awesome", - "virtulization" : "qemu ovmf", - "utils" : "openssh sshfs git htop pkgfile scrot dhclient wget smbclient cifs-utils libu2f-host", - "audio" : "pulseaudio pulseaudio-alsa pavucontrol" -} - -installation.add_additional_packages("{webbrowser} {utils} {mediaplayer} {window_manager} {virtulization} {filebrowser} {editor}".format(**arguments)) - -with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'a') as X11: - X11.write('setxkbmap se\n') - -with open(f'{installation.mountpoint}/etc/vconsole.conf', 'a') as vconsole: - vconsole.write('KEYMAP={keyboard_layout}\n'.format(**arguments)) - vconsole.write('FONT=lat9w-16\n') - -awesome = archinstall.Application(installation, 'awesome') -awesome.install()
\ No newline at end of file +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. + """ + + profile = archinstall.Profile(None, 'xorg') + with profile.load_instructions() 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 dependency profiles + installation.install_profile('xorg') + + arguments = { + 'keyboard_layout' : 'sv-latin1', + "editor" : "nano", + "mediaplayer" : "lollypop gstreamer gst-plugins-good gnome-keyring", + "filebrowser" : "nemo gpicview-gtk3", + "webbrowser" : "chromium", + "window_manager" : "awesome", + "virtulization" : "qemu ovmf", + "utils" : "openssh sshfs git htop pkgfile scrot dhclient wget smbclient cifs-utils libu2f-host", + "audio" : "pulseaudio pulseaudio-alsa pavucontrol" + } + + installation.add_additional_packages("{webbrowser} {utils} {mediaplayer} {window_manager} {virtulization} {filebrowser} {editor}".format(**arguments)) + + with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'a') as X11: + X11.write('setxkbmap se\n') + + with open(f'{installation.mountpoint}/etc/vconsole.conf', 'a') as vconsole: + vconsole.write('KEYMAP={keyboard_layout}\n'.format(**arguments)) + vconsole.write('FONT=lat9w-16\n') + + awesome = archinstall.Application(installation, 'awesome') + awesome.install()
\ No newline at end of file diff --git a/profiles/xorg.py b/profiles/xorg.py index 26492f7c..38492c5c 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -95,12 +95,10 @@ def _prep_function(*args, **kwargs): return True -# Absolute import, not conventional import. # Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("/somewhere/xorg.py") -if os.path.basename(__name__) == 'xorg.py': - print('This should not be printed!') - +# through importlib.util.spec_from_file_location("xorg", "/somewhere/xorg.py") +# or through conventional import xorg +if __name__ == 'xorg': installation.add_additional_packages("xorg-server xorg-xinit") # with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'a') as X11: |