#!/bin/python from functions import print_head print_head('username configuration', 'Please enter the username:'******'your choice:' + user_name) break else: print('Your entry has invalid characters.') file = open("/opt/ArchEvoConf/user_name", "w") file.write(user_name) file.close()
#!/bin/python import glob import re from functions import print_head from functions import selection_table import subprocess import os from functions import print_head print_head( 'Pacman mirror configuration', 'Please select the country from which pacman download his packages:') countries = subprocess.check_output('reflector --list-countries', shell=True).decode() countries = countries.splitlines() new_countries = [] for country in countries: country = re.sub(r'[A-Za-z]*\s*\d*$', '', country).strip() new_countries.append(country) countries = sorted(new_countries) selection_table(countries, 2) while True: selected_country = input("select:")
#!/bin/python from functions import print_head print_head('root password configuration', 'Please enter the root password:'******'your choice:"' + root_password + '"') break else: print('The password is too short. Please at least six characters.') file = open("/opt/ArchEvoConf/root_password", "w") file.write(root_password) file.close()
#!/bin/python import subprocess import re from functions import print_head from functions import selection_table print_head('timezone configuration', 'Please enter your continent:') continents = subprocess.check_output( 'timedatectl list-timezones | sed "s/\/.*$//" | uniq', shell=True).decode().split('\n') continents.remove('') continents = sorted(continents) for continent in continents: print(continent) print() while True: selected_continent = input("select:") if selected_continent in continents: print('your choice:"' + selected_continent + '"') break else: print('Your entry is invalid.') citys = subprocess.check_output('timedatectl list-timezones | grep ' + selected_continent + ' | sed "s/^.*\///"',
#!/bin/python from functions import print_head print_head('Hostname configuration', 'Please enter the hostname:') while True: hostname = input("select:") if hostname.isalpha(): print('your choice:' + hostname) break else: print('your entry was invalid; the hostname may only contain alphabetic characters') file = open("/opt/ArchEvoConf/hostname", "w") file.write(hostname) file.close()
#!/bin/python import subprocess import re from functions import print_head from functions import selection_table print_head('Locale configuration', 'Please enter the locale:') f = open("/etc/locale.gen", "r") file = f.read() locales_list = file.split('\n') new_list = [] for i in locales_list: i = re.sub(r'#', '', i) i = re.search("^\w{2,4}_\w{2,4}", i) if isinstance(i, re.Match): if i.group(0) not in new_list: new_list.append(i.group(0)) locales = sorted(new_list) selection_table(locales, 5) print() while True: selected_locale = input("select:")
#!/bin/python from functions import print_head from functions import print_request print_head('GPU configuration', 'Please enter your gpu:') gpus = ['amd/ati', 'nvidia', 'intel', 'vm'] for gpu in gpus: print(gpu) print() while True: selected_gpu = input("select:") if selected_gpu in gpus: print('your choice:"' + selected_gpu + '"') break else: print('Your entry is invalid.') print_request('Please select the graphic card driver:') if selected_gpu == 'amd/ati': gpu_drivers = ['amdgpu', 'ati'] note = """" note: ...amd... """
#!/bin/python from functions import print_head print_head('user password configuration', 'Please enter the user password:'******'your choice:' + user_password) break else: print('The password is too short. Please at least six characters.') file = open("/opt/ArchEvoConf/user_password", "w") file.write(user_password) file.close()
#!/bin/python from functions import print_head print_head('Linux kernel configuration', 'Please enter your linux version:') linux_versions = ['linux', 'linux-lts', 'linux-hardened'] for linux_version in linux_versions: print(linux_version) print() while True: selected_linux_version = input("select:") if selected_linux_version in linux_versions: print('your choice:"' + selected_linux_version + '"') break else: print('Your entry is invalid.') file = open("/opt/ArchEvoConf/linux_version", "w") file.write(selected_linux_version) file.close()
#!/bin/python from functions import print_head print_head('LUKS configuration', 'Please enter the HDD password (LUKS):') while True: luks_password = input("select:") if len(luks_password) > 8: print('your choice:"' + luks_password + '"') break else: print('The password is too short. Please use at least eight characters.') print("If your password is shorter, you don't need encryption :-)") print("Optimal: more than 18 characters; Punctuation marks; Numbers; Big and small letters! Everything mixed up.") file = open("/opt/ArchEvoConf/luks_password", "w") file.write(luks_password) file.close()
#!/bin/python import subprocess import os from functions import print_head print_head('Drive configuration', 'Please select the drive where Arch Linux will be installed:') drives = subprocess.check_output( 'lsblk -d -o NAME | tail -n +2 | grep -v "^sr[0-999]" | grep -v "^loop[0-999]"', shell=True).decode().strip() drives = drives.splitlines() for drive in drives: drive_size = subprocess.check_output('lsblk --output SIZE -n -d /dev/' + drive, shell=True).decode().strip() print(drive + ' (' + drive_size + ')') print() while True: drive_input = input("select:") if drive_input in drives: print('your choice:"' + drive_input + '"') break else: print('your entry was invalid')
#!/bin/python import glob import re from functions import print_head from functions import selection_table print_head('Keyboard Configuration', 'Please choose your keyboard layout/keymap:') keymaps = glob.glob('/usr/share/kbd/keymaps/i386/**/*.map.gz', recursive=True) new_keymaps = [] for keymap in keymaps: temp = re.sub(r'^/.*/', '', keymap) temp = re.sub('.map.gz', '', temp) new_keymaps.append(temp) keymaps = new_keymaps keymaps = sorted(keymaps) selection_table(keymaps, 2) print() while True: selected_keymap = input("select:") if selected_keymap in keymaps: print('your choice:"' + selected_keymap + '"')
#!/bin/python import subprocess from functions import print_head print_head('CPU configuration', '') cpu_info = subprocess.check_output( "lshw -c cpu | grep vendor | awk -F : '{ print $2 }' | xargs", shell=True).decode().strip().lower() cpu_vendor = '' if 'amd' in cpu_info: print('The installer has recognized an AMD cpu.') cpu_vendor = 'amd' if 'intel' in cpu_info: print('The installer has recognized an Intel cpu.') cpu_vendor = 'intel' if cpu_vendor: file = open("/opt/ArchEvoConf/cpu_vendor", "w") file.write(cpu_vendor) file.close()