Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
2Shirt 2021-03-24 22:22:54 -06:00
commit 60e5d86f8e
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
498 changed files with 23128 additions and 888 deletions

65
scripts/max-cpu-temp Executable file
View file

@ -0,0 +1,65 @@
#!/bin/env python3
#
import json
import re
import subprocess
CPU_REGEX = re.compile(r'(core|k\d+)temp', re.IGNORECASE)
NON_TEMP_REGEX = re.compile(r'^(fan|in|curr)', re.IGNORECASE)
def get_data():
cmd = ('sensors', '-j')
data = {}
raw_data = []
try:
proc = subprocess.run(
args=cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding='utf-8',
check=True,
)
except subprocess.CalledProcessError:
return data
for line in proc.stdout.splitlines():
if line.strip() == ',':
# Assuming malformatted line caused by missing data
continue
raw_data.append(line)
try:
data = json.loads('\n'.join(raw_data))
except json.JSONDecodeError:
# Still broken, just return the empty dict
pass
return data
def get_max_temp(data):
cpu_temps = []
max_cpu_temp = '??° C'
for adapter, sources in data.items():
if not CPU_REGEX.search(adapter):
continue
sources.pop('Adapter', None)
for labels in sources.values():
for label, temp in sorted(labels.items()):
if 'input' not in label or NON_TEMP_REGEX.search(label):
continue
cpu_temps.append(temp)
# Format data
if cpu_temps:
max_cpu_temp = int(max(cpu_temps))
max_cpu_temp = f'{max_cpu_temp:02d}° C'
# Done
return max_cpu_temp
if __name__ == '__main__':
sensor_data = get_data()
print(get_max_temp(sensor_data))

View file

@ -10,6 +10,9 @@ sudo sed -i -r "s/^(Server = )/#\1/" /etc/pacman.conf
# Disable signature checks # Disable signature checks
sudo sed -i -r "s/^SigLevel.*/SigLevel = Never/" /etc/pacman.conf sudo sed -i -r "s/^SigLevel.*/SigLevel = Never/" /etc/pacman.conf
# Init Pacman keyring
sudo systemctl start pacman-init.service
# Refresh package databases # Refresh package databases
sudo pacman -Sy sudo pacman -Sy

33
scripts/resize-and-run Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
#
# Magic numbers:
## Width: | 20 | term_x | 20 | 180 (conky) | 20 |
## Height: | 24 | 10 (titlebar) | term_y | 24 | 30 (Tint2) |
## X Offset: 20 - 5 (shadow?)
## Y Offset: 24 - 5 (shadow?)
conky_width=180
gap_x=20
gap_y=24
picom_shadow=5
tint2_height=30
titlebar_height=10
source ~/.screen_data
if [[ "${dpi}" -ge 192 ]]; then
conky_width=360
gap_x=40
gap_y=48
picom_shadow=5
tint2_height=60
titlebar_height=20
fi
offset_x=$(echo "$gap_x - $picom_shadow" | bc)
offset_y=$(echo "$gap_y - $picom_shadow" | bc)
term_width="$(echo "$width_px - ($gap_x * 3) - $conky_width" | bc)"
term_height="$(echo "$height_px - ($gap_y * 2) - $titlebar_height - $tint2_height" | bc)"
sleep 0.1s
wmctrl -r :ACTIVE: -e "0,$offset_x,$offset_y,$term_width,$term_height" && "$@"

4
scripts/start-max Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
#
wmctrl -r:ACTIVE: -b toggle,maximized_vert,maximized_horz && "$@"

View file

@ -1,31 +0,0 @@
#!/bin/bash
#
## WizardKit: GUI exit script
# Inspired by: https://github.com/cramermarius/rofi-menus/blob/master/scripts/powermenu.sh
actions="Restart\nPoweroff\nLogout"
temp_file="$(mktemp --suffix=.png)"
# Show blurred background
import -window root "${temp_file}"
convert "${temp_file}" -blur 0x4 "${temp_file}"
feh -F "${temp_file}" &
feh_pid="$!"
# Show menu
selection="$(echo -e "$actions" | rofi -i -lines 3 -dmenu -p "Power Menu")"
# Done
kill "${feh_pid}"
case $selection in
Logout)
wk-power-command logout
;;
Poweroff)
wk-power-command poweroff
;;
Restart)
wk-power-command reboot
;;
esac

View file

@ -219,6 +219,38 @@ WINDOWS_BUILDS = {
'18894': ('10', None, '20H1', None, 'preview build'), '18894': ('10', None, '20H1', None, 'preview build'),
'18895': ('10', None, '20H1', None, 'preview build'), '18895': ('10', None, '20H1', None, 'preview build'),
'18898': ('10', None, '20H1', None, 'preview build'), '18898': ('10', None, '20H1', None, 'preview build'),
'18908': ('10', None, '20H1', None, 'preview build'),
'18912': ('10', None, '20H1', None, 'preview build'),
'18917': ('10', None, '20H1', None, 'preview build'),
'18922': ('10', None, '20H1', None, 'preview build'),
'18932': ('10', None, '20H1', None, 'preview build'),
'18936': ('10', None, '20H1', None, 'preview build'),
'18941': ('10', None, '20H1', None, 'preview build'),
'18945': ('10', None, '20H1', None, 'preview build'),
'18950': ('10', None, '20H1', None, 'preview build'),
'18956': ('10', None, '20H1', None, 'preview build'),
'18963': ('10', None, '20H1', None, 'preview build'),
'18965': ('10', None, '20H1', None, 'preview build'),
'18970': ('10', None, '20H1', None, 'preview build'),
'18975': ('10', None, '20H1', None, 'preview build'),
'18980': ('10', None, '20H1', None, 'preview build'),
'18985': ('10', None, '20H1', None, 'preview build'),
'18990': ('10', None, '20H1', None, 'preview build'),
'18995': ('10', None, '20H1', None, 'preview build'),
'18999': ('10', None, '20H1', None, 'preview build'),
'19002': ('10', None, '20H1', None, 'preview build'),
'19008': ('10', None, '20H1', None, 'preview build'),
'19013': ('10', None, '20H1', None, 'preview build'),
'19018': ('10', None, '20H1', None, 'preview build'),
'19023': ('10', None, '20H1', None, 'preview build'),
'19025': ('10', None, '20H1', None, 'preview build'),
'19028': ('10', None, '20H1', None, 'preview build'),
'19030': ('10', None, '20H1', None, 'preview build'),
'19033': ('10', None, '20H1', None, 'preview build'),
'19035': ('10', None, '20H1', None, 'preview build'),
'19037': ('10', None, '20H1', None, 'preview build'),
'19041': ('10', 'v2004', '20H1', 'May 2020 Update', None),
'19042': ('10', 'v20H2', '20H2', 'October 2020 Update', None),
} }

View file

@ -6,6 +6,7 @@ import logging
import os import os
import re import re
import subprocess import subprocess
import time
from threading import Thread from threading import Thread
from queue import Queue, Empty from queue import Queue, Empty
@ -79,8 +80,9 @@ def build_cmd_kwargs(cmd, minimized=False, pipe=True, shell=False, **kwargs):
} }
# Strip sudo if appropriate # Strip sudo if appropriate
if cmd[0] == 'sudo' and os.name == 'posix' and os.geteuid() == 0: if cmd[0] == 'sudo':
cmd.pop(0) if os.name == 'posix' and os.geteuid() == 0: # pylint: disable=no-member
cmd.pop(0)
# Add additional kwargs if applicable # Add additional kwargs if applicable
for key in 'check cwd encoding errors stderr stdin stdout'.split(): for key in 'check cwd encoding errors stderr stdin stdout'.split():
@ -214,6 +216,28 @@ def start_thread(function, args=None, daemon=True):
return thread return thread
def stop_process(proc, graceful=True):
"""Stop process.
NOTES: proc should be a subprocess.Popen obj.
If graceful is True then a SIGTERM is sent before SIGKILL.
"""
# Graceful exit
if graceful:
if os.name == 'posix' and os.geteuid() != 0: # pylint: disable=no-member
run_program(['sudo', 'kill', str(proc.pid)], check=False)
else:
proc.terminate()
time.sleep(2)
# Force exit
if os.name == 'posix' and os.geteuid() != 0: # pylint: disable=no-member
run_program(['sudo', 'kill', '-9', str(proc.pid)], check=False)
else:
proc.kill()
def wait_for_procs(name, exact=True, timeout=None): def wait_for_procs(name, exact=True, timeout=None):
"""Wait for all process matching name.""" """Wait for all process matching name."""
LOG.debug('name: %s, exact: %s, timeout: %s', name, exact, timeout) LOG.debug('name: %s, exact: %s, timeout: %s', name, exact, timeout)

View file

@ -1421,6 +1421,48 @@ def build_sfdisk_partition_line(table_type, dev_path, size, details):
return line return line
def check_destination_health(destination):
"""Check destination health, returns str."""
result = ''
# Bail early
if not isinstance(destination, hw_obj.Disk):
# Return empty string
return result
# Run safety checks
try:
destination.safety_checks()
except hw_obj.CriticalHardwareError:
result = 'Critical hardware error detected on destination'
except hw_obj.SMARTSelfTestInProgressError:
result = 'SMART self-test in progress on destination'
except hw_obj.SMARTNotSupportedError:
pass
# Done
return result
def check_for_missing_items(state):
"""Check if source or destination dissapeared."""
items = {
'Source': state.source,
'Destination': state.destination,
}
for name, item in items.items():
if not item:
continue
if hasattr(item, 'path'):
if not item.path.exists():
std.print_error(f'{name} disappeared')
elif hasattr(item, 'exists'):
if not item.exists():
std.print_error(f'{name} disappeared')
else:
LOG.error('Unknown %s type: %s', name, item)
def clean_working_dir(working_dir): def clean_working_dir(working_dir):
"""Clean working directory to ensure a fresh recovery session. """Clean working directory to ensure a fresh recovery session.
@ -1726,7 +1768,8 @@ def main():
state.ost.select_ticket() state.ost.select_ticket()
try: try:
state.init_recovery(args) state.init_recovery(args)
except std.GenericAbort: except (FileNotFoundError, std.GenericAbort):
check_for_missing_items(state)
std.abort() std.abort()
# Show menu # Show menu
@ -1843,6 +1886,7 @@ def mount_raw_image_macos(path):
def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True): def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True):
# pylint: disable=too-many-statements
"""Run ddrescue using passed settings.""" """Run ddrescue using passed settings."""
cmd = build_ddrescue_cmd(block_pair, pass_name, settings) cmd = build_ddrescue_cmd(block_pair, pass_name, settings)
state.update_progress_pane('Active') state.update_progress_pane('Active')
@ -1877,6 +1921,13 @@ def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True):
if _i % 30 == 0: if _i % 30 == 0:
# Update SMART pane # Update SMART pane
_update_smart_pane() _update_smart_pane()
# Check destination
warning_message = check_destination_health(state.destination)
if warning_message:
# Error detected on destination, stop recovery
exe.stop_process(proc)
break
if _i % 60 == 0: if _i % 60 == 0:
# Clear ddrescue pane # Clear ddrescue pane
tmux.clear_pane() tmux.clear_pane()
@ -1895,7 +1946,7 @@ def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True):
LOG.warning('ddrescue stopped by user') LOG.warning('ddrescue stopped by user')
warning_message = 'Aborted' warning_message = 'Aborted'
std.sleep(2) std.sleep(2)
exe.run_program(['sudo', 'kill', str(proc.pid)], check=False) exe.stop_process(proc, graceful=False)
break break
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
# Continue to next loop to update panes # Continue to next loop to update panes
@ -1969,7 +2020,8 @@ def run_recovery(state, main_menu, settings_menu, dry_run=True):
state.mark_started() state.mark_started()
try: try:
run_ddrescue(state, pair, pass_name, settings, dry_run=dry_run) run_ddrescue(state, pair, pass_name, settings, dry_run=dry_run)
except (KeyboardInterrupt, std.GenericAbort): except (FileNotFoundError, KeyboardInterrupt, std.GenericAbort):
check_for_missing_items(state)
abort = True abort = True
break break

View file

@ -150,7 +150,7 @@ class Sensors():
# Get temps # Get temps
for i in range(seconds): for i in range(seconds):
self.update_sensor_data() self.update_sensor_data(exit_on_thermal_limit=False)
sleep(1) sleep(1)
# Calculate averages # Calculate averages
@ -158,7 +158,15 @@ class Sensors():
for sources in adapters.values(): for sources in adapters.values():
for source_data in sources.values(): for source_data in sources.values():
temps = source_data['Temps'] temps = source_data['Temps']
source_data[temp_label] = sum(temps) / len(temps) try:
source_data[temp_label] = sum(temps) / len(temps)
except ZeroDivisionError:
# Going to use unrealistic 0°C instead
LOG.error(
'No temps saved for %s',
source_data.get('label', 'UNKNOWN'),
)
source_data[temp_label] = 0
def start_background_monitor( def start_background_monitor(
self, out_path, self, out_path,
@ -253,7 +261,7 @@ def fix_sensor_name(name):
name = name.replace('Smc', 'SMC') name = name.replace('Smc', 'SMC')
name = re.sub(r'(\D+)(\d+)', r'\1 \2', name, re.IGNORECASE) name = re.sub(r'(\D+)(\d+)', r'\1 \2', name, re.IGNORECASE)
name = re.sub(r'^K (\d+)Temp', r'AMD K\1 Temps', name, re.IGNORECASE) name = re.sub(r'^K (\d+)Temp', r'AMD K\1 Temps', name, re.IGNORECASE)
name = re.sub(r'T(ctl|die)', r'CPU (T\1)', name, re.IGNORECASE) name = re.sub(r'T(ccd\s+\d+|ctl|die)', r'CPU (T\1)', name, re.IGNORECASE)
name = re.sub(r'\s+', ' ', name) name = re.sub(r'\s+', ' ', name)
return name return name
@ -286,7 +294,7 @@ def get_sensor_data_linux():
## current temp is labeled xxxx_input ## current temp is labeled xxxx_input
for source, labels in sources.items(): for source, labels in sources.items():
for label, temp in labels.items(): for label, temp in labels.items():
if label.startswith('fan') or label.startswith('in'): if label.startswith('fan') or label.startswith('in') or label.startswith('curr'):
# Skip fan RPMs and voltages # Skip fan RPMs and voltages
continue continue
if 'input' in label: if 'input' in label:

View file

@ -216,7 +216,8 @@ def copy_source(source, items, overwrite=False):
linux.unmount('/mnt/Source') linux.unmount('/mnt/Source')
# Raise exception if item(s) were not found # Raise exception if item(s) were not found
raise FileNotFoundError('One or more items not found') if items_not_found:
raise FileNotFoundError('One or more items not found')
def create_table(dev_path, use_mbr=False): def create_table(dev_path, use_mbr=False):

View file

@ -76,14 +76,20 @@ def get_root_logger_path():
return log_path return log_path
def remove_empty_log(): def remove_empty_log(log_path=None):
"""Remove log if empty.""" """Remove log if empty.
NOTE: Under Windows an empty log is 2 bytes long.
"""
is_empty = False is_empty = False
# Get log path
if not log_path:
log_path = get_root_logger_path()
# Check if log is empty # Check if log is empty
log_path = get_root_logger_path()
try: try:
is_empty = log_path and log_path.exists() and log_path.stat().st_size == 0 is_empty = log_path and log_path.exists() and log_path.stat().st_size <= 2
except (FileNotFoundError, AttributeError): except (FileNotFoundError, AttributeError):
# File doesn't exist or couldn't verify it's empty # File doesn't exist or couldn't verify it's empty
pass pass
@ -119,34 +125,35 @@ def update_log_path(
dest_dir=None, dest_name=None, keep_history=True, timestamp=True): dest_dir=None, dest_name=None, keep_history=True, timestamp=True):
"""Moves current log file to new path and updates the root logger.""" """Moves current log file to new path and updates the root logger."""
root_logger = logging.getLogger() root_logger = logging.getLogger()
cur_handler = None
cur_path = get_root_logger_path()
new_path = format_log_path(dest_dir, dest_name, timestamp=timestamp) new_path = format_log_path(dest_dir, dest_name, timestamp=timestamp)
old_handler = None
old_path = get_root_logger_path()
os.makedirs(new_path.parent, exist_ok=True) os.makedirs(new_path.parent, exist_ok=True)
# Get current logging file handler # Get current logging file handler
for handler in root_logger.handlers: for handler in root_logger.handlers:
if isinstance(handler, logging.FileHandler): if isinstance(handler, logging.FileHandler):
cur_handler = handler old_handler = handler
break break
if not cur_handler: if not old_handler:
raise RuntimeError('Logging FileHandler not found') raise RuntimeError('Logging FileHandler not found')
# Copy original log to new location # Copy original log to new location
if keep_history: if keep_history:
if new_path.exists(): if new_path.exists():
raise FileExistsError(f'Refusing to clobber: {new_path}') raise FileExistsError(f'Refusing to clobber: {new_path}')
shutil.move(cur_path, new_path) shutil.copy(old_path, new_path)
# Remove old log if empty # Create new handler (preserving formatter settings)
remove_empty_log()
# Create new cur_handler (preserving formatter settings)
new_handler = logging.FileHandler(new_path, mode='a') new_handler = logging.FileHandler(new_path, mode='a')
new_handler.setFormatter(cur_handler.formatter) new_handler.setFormatter(old_handler.formatter)
# Replace current handler # Remove old_handler and log if empty
root_logger.removeHandler(cur_handler) root_logger.removeHandler(old_handler)
old_handler.close()
remove_empty_log(old_path)
# Add new handler
root_logger.addHandler(new_handler) root_logger.addHandler(new_handler)

View file

@ -122,8 +122,8 @@ def mount_network_share(details, mount_point=None, read_write=False):
'-t', 'cifs', '-t', 'cifs',
'-o', ( '-o', (
f'{"rw" if read_write else "ro"}' f'{"rw" if read_write else "ro"}'
f',uid={os.getuid()}' f',uid={os.getuid()}' # pylint: disable=no-member
f',gid={os.getgid()}' f',gid={os.getgid()}' # pylint: disable=no-member
f',username={username}' f',username={username}'
f',{"password=" if password else "guest"}{password}' f',{"password=" if password else "guest"}{password}'
), ),

View file

@ -5,6 +5,9 @@ import logging
import os import os
import pathlib import pathlib
import platform import platform
import winreg
from contextlib import suppress
from wk.borrowed import acpi from wk.borrowed import acpi
from wk.exe import run_program from wk.exe import run_program
@ -15,6 +18,39 @@ from wk.std import GenericError, GenericWarning, sleep
# STATIC VARIABLES # STATIC VARIABLES
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
KNOWN_DATA_TYPES = {
'BINARY': winreg.REG_BINARY,
'DWORD': winreg.REG_DWORD,
'DWORD_LITTLE_ENDIAN': winreg.REG_DWORD_LITTLE_ENDIAN,
'DWORD_BIG_ENDIAN': winreg.REG_DWORD_BIG_ENDIAN,
'EXPAND_SZ': winreg.REG_EXPAND_SZ,
'LINK': winreg.REG_LINK,
'MULTI_SZ': winreg.REG_MULTI_SZ,
'NONE': winreg.REG_NONE,
'QWORD': winreg.REG_QWORD,
'QWORD_LITTLE_ENDIAN': winreg.REG_QWORD_LITTLE_ENDIAN,
'SZ': winreg.REG_SZ,
}
KNOWN_HIVES = {
'HKCR': winreg.HKEY_CLASSES_ROOT,
'HKCU': winreg.HKEY_CURRENT_USER,
'HKLM': winreg.HKEY_LOCAL_MACHINE,
'HKU': winreg.HKEY_USERS,
'HKEY_CLASSES_ROOT': winreg.HKEY_CLASSES_ROOT,
'HKEY_CURRENT_USER': winreg.HKEY_CURRENT_USER,
'HKEY_LOCAL_MACHINE': winreg.HKEY_LOCAL_MACHINE,
'HKEY_USERS': winreg.HKEY_USERS,
}
KNOWN_HIVE_NAMES = {
winreg.HKEY_CLASSES_ROOT: 'HKCR',
winreg.HKEY_CURRENT_USER: 'HKCU',
winreg.HKEY_LOCAL_MACHINE: 'HKLM',
winreg.HKEY_USERS: 'HKU',
winreg.HKEY_CLASSES_ROOT: 'HKEY_CLASSES_ROOT',
winreg.HKEY_CURRENT_USER: 'HKEY_CURRENT_USER',
winreg.HKEY_LOCAL_MACHINE: 'HKEY_LOCAL_MACHINE',
winreg.HKEY_USERS: 'HKEY_USERS',
}
OS_VERSION = float(platform.win32_ver()[0]) OS_VERSION = float(platform.win32_ver()[0])
REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer' REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer'
SLMGR = pathlib.Path(f'{os.environ.get("SYSTEMROOT")}/System32/slmgr.vbs') SLMGR = pathlib.Path(f'{os.environ.get("SYSTEMROOT")}/System32/slmgr.vbs')
@ -177,5 +213,198 @@ def run_sfc_scan():
raise OSError raise OSError
# Registry Functions
def reg_delete_key(hive, key, recurse=False):
"""Delete a key from the registry.
NOTE: If recurse is False then it will only work on empty keys.
"""
hive = reg_get_hive(hive)
hive_name = KNOWN_HIVE_NAMES.get(hive, '???')
# Delete subkeys first
if recurse:
with suppress(WindowsError), winreg.OpenKey(hive, key) as open_key:
while True:
subkey = fr'{key}\{winreg.EnumKey(open_key, 0)}'
reg_delete_key(hive, subkey, recurse=recurse)
# Delete key
try:
winreg.DeleteKey(hive, key)
LOG.warning(r'Deleting registry key: %s\%s', hive_name, key)
except FileNotFoundError:
# Ignore
pass
except PermissionError:
LOG.error(r'Failed to delete registry key: %s\%s', hive_name, key)
if recurse:
# Re-raise exception
raise
# recurse is not True so assuming we tried to remove a non-empty key
msg = fr'Refusing to remove non-empty key: {hive_name}\{key}'
raise FileExistsError(msg)
def reg_delete_value(hive, key, value):
"""Delete a value from the registry."""
access = winreg.KEY_ALL_ACCESS
hive = reg_get_hive(hive)
hive_name = KNOWN_HIVE_NAMES.get(hive, '???')
# Delete value
with winreg.OpenKey(hive, key, access=access) as open_key:
try:
winreg.DeleteValue(open_key, value)
LOG.warning(
r'Deleting registry value: %s\%s "%s"', hive_name, key, value,
)
except FileNotFoundError:
# Ignore
pass
except PermissionError:
LOG.error(
r'Failed to delete registry value: %s\%s "%s"', hive_name, key, value,
)
# Re-raise exception
raise
def reg_get_hive(hive):
"""Get winreg HKEY constant from string, returns HKEY constant."""
if isinstance(hive, int):
# Assuming we're already a winreg HKEY constant
pass
else:
hive = KNOWN_HIVES[hive.upper()]
# Done
return hive
def reg_get_data_type(data_type):
"""Get registry data type from string, returns winreg constant."""
if isinstance(data_type, int):
# Assuming we're already a winreg value type constant
pass
else:
data_type = KNOWN_DATA_TYPES[data_type.upper()]
# Done
return data_type
def reg_key_exists(hive, key):
"""Test if the specified hive/key exists, returns bool."""
exists = False
hive = reg_get_hive(hive)
# Query key
try:
winreg.QueryValue(hive, key)
except FileNotFoundError:
# Leave set to False
pass
else:
exists = True
# Done
return exists
def reg_read_value(hive, key, value, force_32=False, force_64=False):
"""Query value from hive/hey, returns multiple types."""
access = winreg.KEY_READ
data = None
hive = reg_get_hive(hive)
# Set access
if force_32:
access = access | winreg.KEY_WOW64_32KEY
elif force_64:
access = access | winreg.KEY_WOW64_64KEY
# Query value
with winreg.OpenKey(hive, key, access=access) as open_key:
# Returning first part of tuple and ignoreing type
data = winreg.QueryValueEx(open_key, value)[0]
# Done
return data
def reg_write_settings(settings):
"""Set registry values in bulk from a custom data structure.
Data structure should be as follows:
EXAMPLE_SETTINGS = {
# See KNOWN_HIVES for valid hives
'HKLM': {
r'Software\\2Shirt\\WizardKit': (
# Value tuples should be in the form:
# (name, data, data-type, option),
# See KNOWN_DATA_TYPES for valid types
# The option item is optional
('Sample Value #1', 'Sample Data', 'SZ'),
('Sample Value #2', 14, 'DWORD'),
),
# An empty key will be created if no values are specified
r'Software\\2Shirt\\WizardKit\\Empty': (),
r'Software\\2Shirt\\WizardKit\\Test': (
('Sample Value #3', 14000000000000, 'QWORD'),
),
},
'HKCU': {
r'Software\\2Shirt\\WizardKit': (
# The 4th item forces using the 32-bit registry
# See reg_set_value() for valid options
('Sample Value #4', 'Sample Data', 'SZ', '32'),
),
},
}
"""
for hive, keys in settings.items():
hive = reg_get_hive(hive)
for key, values in keys.items():
if not values:
# Create an empty key
winreg.CreateKey(hive, key)
for value in values:
reg_set_value(hive, key, *value)
def reg_set_value(hive, key, name, data, data_type, option=None):
# pylint: disable=too-many-arguments
"""Set value for hive/key."""
access = winreg.KEY_WRITE
data_type = reg_get_data_type(data_type)
hive = reg_get_hive(hive)
option = str(option)
# Safety check
if not name and option in ('32', '64'):
raise NotImplementedError(
'Unable to set default values using alternate registry views',
)
# Set access
if option == '32':
access = access | winreg.KEY_WOW64_32KEY
elif option == '64':
access = access | winreg.KEY_WOW64_64KEY
# Create key
winreg.CreateKeyEx(hive, key, access=access)
# Set value
if name:
with winreg.OpenKey(hive, key, access=access) as open_key:
winreg.SetValueEx(open_key, name, 0, data_type, data)
else:
# Set default value instead
winreg.SetValue(hive, key, data_type, data)
if __name__ == '__main__': if __name__ == '__main__':
print("This file is not meant to be called directly.") print("This file is not meant to be called directly.")

View file

@ -8,17 +8,17 @@ set -o nounset
set -o pipefail set -o pipefail
# Prep # Prep
DATE="$(date +%F)" DATE="$(date +%Y-%m-%d)"
DATETIME="$(date +%F_%H%M)" DATETIME="$(date +%Y-%m-%d_%H%M)"
ROOT_DIR="$(realpath $(dirname "$0")/..)" ROOT_DIR="$(realpath $(dirname "$0")/..)"
BUILD_DIR="$ROOT_DIR/setup/BUILD" BUILD_DIR="$ROOT_DIR/setup/BUILD"
LIVE_DIR="$BUILD_DIR/live"
LOG_DIR="$BUILD_DIR/logs" LOG_DIR="$BUILD_DIR/logs"
OUT_DIR="$ROOT_DIR/setup/OUT" OUT_DIR="$ROOT_DIR/setup/OUT"
PROFILE_DIR="$BUILD_DIR/archiso-profile"
REPO_DIR="$BUILD_DIR/repo" REPO_DIR="$BUILD_DIR/repo"
SKEL_DIR="$LIVE_DIR/airootfs/etc/skel" SKEL_DIR="$PROFILE_DIR/airootfs/etc/skel"
TEMP_DIR="$BUILD_DIR/temp" TEMP_DIR="$BUILD_DIR/temp"
MIRRORLIST_SOURCE='https://www.archlinux.org/mirrorlist/?country=US&protocol=http&protocol=https&ip_version=4&use_mirror_status=on' MIRRORLIST_SOURCE='https://archlinux.org/mirrorlist/?country=US&protocol=http&protocol=https&ip_version=4&use_mirror_status=on'
if command -v nano >/dev/null 2>&1; then if command -v nano >/dev/null 2>&1; then
EDITOR=nano EDITOR=nano
elif command -v vim >/dev/null 2>&1; then elif command -v vim >/dev/null 2>&1; then
@ -42,7 +42,7 @@ function ask() {
} }
function cleanup() { function cleanup() {
for d in "$TEMP_DIR" "$LIVE_DIR"; do for d in "$TEMP_DIR" "$PROFILE_DIR"; do
if [[ -d "$d" ]]; then if [[ -d "$d" ]]; then
if ask "Remove: ${d}?"; then if ask "Remove: ${d}?"; then
rm -Rf "$d" rm -Rf "$d"
@ -74,27 +74,19 @@ function load_settings() {
function copy_live_env() { function copy_live_env() {
echo "Copying Archlinux files..." echo "Copying Archlinux files..."
rsync -aI /usr/share/archiso/configs/releng/ "$LIVE_DIR/" rsync -aI "$ROOT_DIR/setup/linux/profile_base/" "$PROFILE_DIR/"
# Remove items
rm "$LIVE_DIR/airootfs/etc/systemd/scripts/choose-mirror"
rmdir "$LIVE_DIR/airootfs/etc/systemd/scripts" --ignore-fail-on-non-empty
rm "$LIVE_DIR/airootfs/etc/systemd/system/choose-mirror.service"
rm "$LIVE_DIR/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount"
rm "$LIVE_DIR/airootfs/etc/systemd/system/pacman-init.service"
rm "$LIVE_DIR/airootfs/etc/udev/rules.d/81-dhcpcd.rules"
rmdir "$LIVE_DIR/airootfs/etc/udev/rules.d" --ignore-fail-on-non-empty
rmdir "$LIVE_DIR/airootfs/etc/udev" --ignore-fail-on-non-empty
rm "$LIVE_DIR/isolinux"/*.cfg
rm "$LIVE_DIR/syslinux"/*.cfg "$LIVE_DIR/syslinux"/*.png
# Add items # Add items
rsync -aI "$ROOT_DIR/setup/linux/include/" "$LIVE_DIR/"
if [[ "${1:-}" != "--minimal" ]]; then if [[ "${1:-}" != "--minimal" ]]; then
rsync -aI "$ROOT_DIR/setup/linux/include_x/" "$LIVE_DIR/" rsync -aI "$ROOT_DIR/setup/linux/profile_gui/" "$PROFILE_DIR/"
fi fi
mkdir -p "$LIVE_DIR/airootfs/usr/local/bin" mkdir -p "$PROFILE_DIR/airootfs/usr/local/bin"
rsync -aI "$ROOT_DIR/scripts/" "$LIVE_DIR/airootfs/usr/local/bin/" rsync -aI "$ROOT_DIR/scripts/" "$PROFILE_DIR/airootfs/usr/local/bin/"
# Update profiledef.sh to set proper permissions for executable files
for _file in $(find "$PROFILE_DIR/airootfs" -executable -type f | sed "s%$PROFILE_DIR/airootfs%%" | sort); do
sed -i "\$i\ [\"$_file\"]=\"0:0:0755\"" "$PROFILE_DIR/profiledef.sh"
done
} }
function run_elevated() { function run_elevated() {
@ -123,71 +115,67 @@ function update_live_env() {
username="tech" username="tech"
label="${KIT_NAME_SHORT}_LINUX" label="${KIT_NAME_SHORT}_LINUX"
# MOTD
sed -i -r "s/KIT_NAME_SHORT/$KIT_NAME_SHORT/" "$PROFILE_DIR/profiledef.sh"
sed -i -r "s/KIT_NAME_FULL/$KIT_NAME_SHORT/" "$PROFILE_DIR/profiledef.sh"
sed -i -r "s/SUPPORT_URL/$KIT_NAME_SHORT/" "$PROFILE_DIR/profiledef.sh"
# Boot config (legacy) # Boot config (legacy)
mkdir -p "$LIVE_DIR/arch" mkdir -p "$LIVE_DIR/arch"
cp "$ROOT_DIR/images/Pxelinux.jpg" "$LIVE_DIR/arch/pxelinux.jpg" cp "$ROOT_DIR/images/Pxelinux.jpg" "$LIVE_DIR/arch/pxelinux.jpg"
cp "$ROOT_DIR/images/Syslinux.jpg" "$LIVE_DIR/arch/syslinux.jpg" cp "$ROOT_DIR/images/Syslinux.jpg" "$LIVE_DIR/arch/syslinux.jpg"
sed -i -r "s/_+/$KIT_NAME_FULL/" "$LIVE_DIR/syslinux/wk_head.cfg" sed -i -r "s/__+/$KIT_NAME_FULL/" "$PROFILE_DIR/syslinux/syslinux.cfg"
mkdir -p "$TEMP_DIR" 2>/dev/null mkdir -p "$TEMP_DIR" 2>/dev/null
curl -Lo "$TEMP_DIR/wimboot.zip" "http://git.ipxe.org/releases/wimboot/wimboot-latest.zip" curl -Lo "$TEMP_DIR/wimboot.zip" "http://git.ipxe.org/releases/wimboot/wimboot-latest.zip"
7z e -aoa "$TEMP_DIR/wimboot.zip" -o"$LIVE_DIR/arch/boot" 'wimboot*/LICENSE.txt' 'wimboot*/README.txt' 'wimboot*/wimboot' 7z e -aoa "$TEMP_DIR/wimboot.zip" -o"$PROFILE_DIR/arch/boot" 'wimboot*/LICENSE.txt' 'wimboot*/README.txt' 'wimboot*/wimboot'
# Boot config (UEFI) # Boot config (UEFI)
mkdir -p "$LIVE_DIR/EFI/boot" mkdir -p "$PROFILE_DIR/EFI/boot"
cp "/usr/share/refind/refind_x64.efi" "$LIVE_DIR/EFI/boot/bootx64.efi" cp "/usr/share/refind/refind_x64.efi" "$PROFILE_DIR/EFI/boot/bootx64.efi"
cp "$ROOT_DIR/images/rEFInd.png" "$LIVE_DIR/EFI/boot/rEFInd.png" cp "$ROOT_DIR/images/rEFInd.png" "$PROFILE_DIR/EFI/boot/rEFInd.png"
rsync -aI "/usr/share/refind/drivers_x64/" "$LIVE_DIR/EFI/boot/drivers_x64/" rsync -aI "/usr/share/refind/drivers_x64/" "$PROFILE_DIR/EFI/boot/drivers_x64/"
rsync -aI "/usr/share/refind/icons/" "$LIVE_DIR/EFI/boot/icons/" --exclude "/usr/share/refind/icons/svg" rsync -aI "/usr/share/refind/icons/" "$PROFILE_DIR/EFI/boot/icons/" --exclude "/usr/share/refind/icons/svg"
sed -i "s/%ARCHISO_LABEL%/${label}/" "$LIVE_DIR/EFI/boot/refind.conf" sed -i "s/%ARCHISO_LABEL%/${label}/" "$PROFILE_DIR/EFI/boot/refind.conf"
# Customize_airootfs.sh
sed -i -r 's/set -e -u/set -o errexit\nset -o errtrace\nset -o nounset\nset -o pipefail/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
# Memtest86 # Memtest86
mkdir -p "$LIVE_DIR/EFI/memtest86/Benchmark" mkdir -p "$PROFILE_DIR/EFI/memtest86/Benchmark"
mkdir -p "$TEMP_DIR/memtest86" mkdir -p "$TEMP_DIR/memtest86"
curl -Lo "$TEMP_DIR/memtest86/memtest86-usb.zip" "https://www.memtest86.com/downloads/memtest86-usb.zip" curl -Lo "$TEMP_DIR/memtest86/memtest86-usb.zip" "https://www.memtest86.com/downloads/memtest86-usb.zip"
7z e -aoa "$TEMP_DIR/memtest86/memtest86-usb.zip" -o"$TEMP_DIR/memtest86" "memtest86-usb.img" 7z e -aoa "$TEMP_DIR/memtest86/memtest86-usb.zip" -o"$TEMP_DIR/memtest86" "memtest86-usb.img"
7z e -aoa "$TEMP_DIR/memtest86/memtest86-usb.img" -o"$TEMP_DIR/memtest86" "MemTest86.img" 7z e -aoa "$TEMP_DIR/memtest86/memtest86-usb.img" -o"$TEMP_DIR/memtest86" "MemTest86.img"
7z x -aoa "$TEMP_DIR/memtest86/MemTest86.img" -o"$TEMP_DIR/memtest86" 7z x -aoa "$TEMP_DIR/memtest86/MemTest86.img" -o"$TEMP_DIR/memtest86"
rm "$TEMP_DIR/memtest86/EFI/BOOT/BOOTIA32.efi" rm "$TEMP_DIR/memtest86/EFI/BOOT/BOOTIA32.efi"
mv "$TEMP_DIR/memtest86/EFI/BOOT/BOOTX64.efi" "$LIVE_DIR/EFI/memtest86/memtestx64.efi" mv "$TEMP_DIR/memtest86/EFI/BOOT/BOOTX64.efi" "$PROFILE_DIR/EFI/memtest86/memtestx64.efi"
mv "$TEMP_DIR/memtest86/EFI/BOOT"/* "$LIVE_DIR/EFI/memtest86"/ mv "$TEMP_DIR/memtest86/EFI/BOOT"/* "$PROFILE_DIR/EFI/memtest86"/
mv "$TEMP_DIR/memtest86/help"/* "$LIVE_DIR/EFI/memtest86"/ mv "$TEMP_DIR/memtest86/help"/* "$PROFILE_DIR/EFI/memtest86"/
mv "$TEMP_DIR/memtest86/license.rtf" "$LIVE_DIR/EFI/memtest86"/ mv "$TEMP_DIR/memtest86/license.rtf" "$PROFILE_DIR/EFI/memtest86"/
# build.sh # build.sh
if ! grep -iq 'wizardkit additions' "$LIVE_DIR/build.sh"; then #if ! grep -iq 'wizardkit additions' "$PROFILE_DIR/build.sh"; then
sed -i -r 's/^(run_once make_iso)$/# wizardkit additions\n\1/' "$LIVE_DIR/build.sh" # sed -i -r 's/^(run_once make_iso)$/# wizardkit additions\n\1/' "$PROFILE_DIR/build.sh"
sed -i "/# wizardkit additions/r $ROOT_DIR/setup/linux/build_additions.txt" "$LIVE_DIR/build.sh" # sed -i "/# wizardkit additions/r $ROOT_DIR/setup/linux/build_additions.txt" "$PROFILE_DIR/build.sh"
fi #fi
# Hostname # Hostname
echo "$hostname" > "$LIVE_DIR/airootfs/etc/hostname" echo "$hostname" > "$PROFILE_DIR/airootfs/etc/hostname"
echo "127.0.1.1 $hostname.localdomain $hostname" >> "$LIVE_DIR/airootfs/etc/hosts" echo "127.0.1.1 $hostname.localdomain $hostname" >> "$PROFILE_DIR/airootfs/etc/hosts"
# Live packages # Live packages
while read -r p; do cp "$ROOT_DIR/setup/linux/packages/base" "$PROFILE_DIR/packages.x86_64"
sed -i "/$p/d" "$LIVE_DIR/packages.x86_64" if [[ "${1:-}" != "--minimal" ]]; then
done < "$ROOT_DIR/setup/linux/packages/live_remove" cat "$ROOT_DIR/setup/linux/packages/gui" >> "$PROFILE_DIR/packages.x86_64"
cat "$ROOT_DIR/setup/linux/packages/live_add" >> "$LIVE_DIR/packages.x86_64"
if [[ "${1:-}" == "--minimal" ]]; then
cat "$ROOT_DIR/setup/linux/packages/live_add_min" >> "$LIVE_DIR/packages.x86_64"
else
cat "$ROOT_DIR/setup/linux/packages/live_add_x" >> "$LIVE_DIR/packages.x86_64"
fi fi
echo "[custom]" >> "$LIVE_DIR/pacman.conf" echo "[custom]" >> "$PROFILE_DIR/pacman.conf"
echo "SigLevel = Optional TrustAll" >> "$LIVE_DIR/pacman.conf" echo "SigLevel = Optional TrustAll" >> "$PROFILE_DIR/pacman.conf"
echo "Server = file://$REPO_DIR" >> "$LIVE_DIR/pacman.conf" echo "Server = file://$REPO_DIR" >> "$PROFILE_DIR/pacman.conf"
echo "" >> "$LIVE_DIR/pacman.conf"
# Mirrors # Mirrors
sed -i -r 's/^(.*mirrorlist.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh" mkdir -p "$PROFILE_DIR/airootfs/etc/pacman.d"
echo "curl -o '/etc/pacman.d/mirrorlist' '$MIRRORLIST_SOURCE'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" curl -Lo "$PROFILE_DIR/airootfs/etc/pacman.d/mirrorlist" "$MIRRORLIST_SOURCE"
echo "sed -i 's/#Server/Server/g' /etc/pacman.d/mirrorlist" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" sed -i 's/#Server/Server/g' "$PROFILE_DIR/airootfs/etc/pacman.d/mirrorlist"
# MOTD # MOTD
sed -i -r "s/_+/$KIT_NAME_FULL Linux Environment/" "$LIVE_DIR/airootfs/etc/motd" sed -i -r "s/_+/$KIT_NAME_FULL Linux Environment/" "$PROFILE_DIR/airootfs/etc/motd"
# Oh My ZSH # Oh My ZSH
git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$SKEL_DIR/.oh-my-zsh" git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$SKEL_DIR/.oh-my-zsh"
@ -197,55 +185,41 @@ function update_live_env() {
if [[ "${1:-}" != "--minimal" ]]; then if [[ "${1:-}" != "--minimal" ]]; then
# Openbox theme # Openbox theme
git clone --depth=1 https://github.com/addy-dclxvi/Openbox-Theme-Collections.git "$TEMP_DIR/ob-themes" git clone --depth=1 https://github.com/addy-dclxvi/Openbox-Theme-Collections.git "$TEMP_DIR/ob-themes"
mkdir -p "$LIVE_DIR/airootfs/usr/share/themes" mkdir -p "$PROFILE_DIR/airootfs/usr/share/themes"
cp -a "$TEMP_DIR/ob-themes/Triste-Orange" "$LIVE_DIR/airootfs/usr/share/themes/" cp -a "$TEMP_DIR/ob-themes/Triste-Orange" "$PROFILE_DIR/airootfs/usr/share/themes/"
# Rofi
## Probably don't need the exact commit but it'll be fine
mkdir -p "$PROFILE_DIR/airootfs/usr/share/fonts/"
curl -Lo \
"$PROFILE_DIR/airootfs/usr/share/fonts/Fantasque-Sans-Mono-Nerd-Font.ttf" \
"https://github.com/adi1090x/rofi/raw/9c4093c665326bb08d6affc7e16d18d8f25c4452/fonts/Fantasque-Sans-Mono-Nerd-Font.ttf"
curl -Lo \
"$PROFILE_DIR/airootfs/usr/share/fonts/Feather.ttf" \
"https://github.com/adi1090x/rofi/raw/9c4093c665326bb08d6affc7e16d18d8f25c4452/fonts/Feather.ttf"
fi fi
# Services
sed -i -r 's/^(.*pacman-init.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
sed -i -r 's/^(.*choose-mirror.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
# Shutdown stall fix
echo "sed -i -r 's/^.*(DefaultTimeoutStartSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
echo "sed -i -r 's/^.*(DefaultTimeoutStopSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
# SSH # SSH
mkdir -p "$SKEL_DIR/.ssh" mkdir -p "$SKEL_DIR/.ssh"
ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa" ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa"
echo 'rm /root/.ssh/id*' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" if ! grep -qv "^#" "$ROOT_DIR/setup/linux/authorized_keys"; then
echo 'rm /root/.zlogin' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" echo "WARNING: No authorized SSH keys found." 1>&2
sed -i -r '/.*PermitRootLogin.*/d' "$LIVE_DIR/airootfs/root/customize_airootfs.sh" fi
echo "sed -i -r '/.*PermitRootLogin.*/d' /etc/ssh/sshd_config" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
cp "$ROOT_DIR/setup/linux/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys" cp "$ROOT_DIR/setup/linux/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys"
# Root user # Root user
echo "echo 'root:$ROOT_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" echo "root:$(echo "$ROOT_PASSWORD" | openssl passwd -6 -stdin):14871::::::" >> "$PROFILE_DIR/airootfs/etc/shadow"
# Sudo
echo "echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
# Tech user # Tech user
echo "groupadd -r autologin" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" echo "tech:$(echo "$TECH_PASSWORD" | openssl passwd -6 -stdin):14871::::::" >> "$PROFILE_DIR/airootfs/etc/shadow"
echo "useradd -m -s /bin/zsh -G autologin,power,storage,wheel -U $username" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
echo "echo '$username:$TECH_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
# Tech user autologin # Timezonew
mkdir -p "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d" ln -sf "/usr/share/zoneinfo/$LINUX_TIME_ZONE" "$PROFILE_DIR/airootfs/etc/localtime"
echo "[Service]" > "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
echo "ExecStart=" >> "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
echo "ExecStart=-/sbin/agetty --autologin $username --noclear %I 38400 linux" >> "$LIVE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf"
# Timezone
echo "ln -sf '/usr/share/zoneinfo/$LINUX_TIME_ZONE' '/etc/localtime'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
echo 'sed -i "s/#FallbackNTP/NTP/" /etc/systemd/timesyncd.conf' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
# udevil fix
echo "mkdir /media" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
if [[ "${1:-}" != "--minimal" ]]; then if [[ "${1:-}" != "--minimal" ]]; then
# VNC password # VNC password
echo "mkdir '/home/$username/.vnc'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" mkdir "$SKEL_DIR/.vnc"
echo "echo '$TECH_PASSWORD' | vncpasswd -f > '/home/$username/.vnc/passwd'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" echo "$TECH_PASSWORD" | vncpasswd -f > "$SKEL_DIR/.vnc/passwd"
# Wallpaper # Wallpaper
mkdir -p "$LIVE_DIR/airootfs/usr/share/wallpaper" mkdir -p "$LIVE_DIR/airootfs/usr/share/wallpaper"
@ -253,8 +227,9 @@ function update_live_env() {
fi fi
# WiFi # WiFi
cp "$ROOT_DIR/setup/linux/known_networks" "$LIVE_DIR/airootfs/root/known_networks" # TODO
echo "add-known-networks --user=$username" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" #cp "$ROOT_DIR/setup/linux/known_networks" "$PROFILE_DIR/airootfs/root/known_networks"
#echo "add-known-networks --user=$username" >> "$PROFILE_DIR/airootfs/root/customize_airootfs.sh"
} }
function update_repo() { function update_repo() {
@ -268,7 +243,7 @@ function update_repo() {
# Archive current files # Archive current files
if [[ -d "$REPO_DIR" ]]; then if [[ -d "$REPO_DIR" ]]; then
mkdir -p "$BUILD_DIR/Archive" 2>/dev/null mkdir -p "$BUILD_DIR/Archive" 2>/dev/null
archive="$BUILD_DIR/Archive/$(date "+%F_%H%M%S")" archive="$BUILD_DIR/Archive/$(date "+%Y-%m-%d_%H%M%S")"
mv -bv "$REPO_DIR" "$archive" mv -bv "$REPO_DIR" "$archive"
fi fi
sleep 1s sleep 1s
@ -282,15 +257,18 @@ function update_repo() {
curl -LsfO https://aur.archlinux.org/cgit/aur.git/snapshot/$p.tar.gz curl -LsfO https://aur.archlinux.org/cgit/aur.git/snapshot/$p.tar.gz
tar xf $p.tar.gz tar xf $p.tar.gz
pushd $p >/dev/null pushd $p >/dev/null
if [[ "$p" == "hfsprogs" ]]; then
sed -i 's!http://cavan.codon.org.uk/\~mjg59/diskdev_cmds!https://sources.voidlinux.org/hfsprogs-540.1.linux3!' "$TEMP_DIR/hfsprogs/PKGBUILD"
fi
makepkg -d makepkg -d
popd >/dev/null popd >/dev/null
mv -n $p/*xz "$REPO_DIR"/ mv -n $p/*zst "$REPO_DIR"/
done < "$ROOT_DIR/setup/linux/packages/aur" done < "$ROOT_DIR/setup/linux/packages/aur"
popd >/dev/null popd >/dev/null
# Build custom repo database # Build custom repo database
pushd "$REPO_DIR" >/dev/null pushd "$REPO_DIR" >/dev/null
repo-add custom.db.tar.gz *xz repo-add custom.db.tar.gz *zst
popd >/dev/null popd >/dev/null
} }
@ -326,7 +304,7 @@ function build_linux() {
# Rerun script as root to start Archiso build process # Rerun script as root to start Archiso build process
run_elevated "$(realpath "$0")" --build-iso run_elevated "$(realpath "$0")" --build-iso
# Cleanup # Cleanup
mv -nv "$LIVE_DIR" "${LIVE_DIR}.${version}" mv -nv "$PROFILE_DIR" "${PROFILE_DIR}.${version}"
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-${version}-\2/" "$OUT_DIR"/* perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-${version}-\2/" "$OUT_DIR"/*
done done
} }
@ -338,12 +316,6 @@ function build_iso() {
exit 1 exit 1
fi fi
# Set permissions
echo "Setting permissions..."
chown root:root "$LIVE_DIR" -R
chmod 700 "$LIVE_DIR/airootfs/etc/skel/.ssh"
chmod 600 "$LIVE_DIR/airootfs/etc/skel/.ssh/id_rsa"
# Removing cached (and possibly outdated) custom repo packages # Removing cached (and possibly outdated) custom repo packages
for package in $(cat "$ROOT_DIR/setup/linux/packages/aur"); do for package in $(cat "$ROOT_DIR/setup/linux/packages/aur"); do
for p in /var/cache/pacman/pkg/*${package}*; do for p in /var/cache/pacman/pkg/*${package}*; do
@ -356,14 +328,19 @@ function build_iso() {
# Build ISO # Build ISO
prefix="${KIT_NAME_SHORT}-Linux" prefix="${KIT_NAME_SHORT}-Linux"
label="${KIT_NAME_SHORT}_LINUX" label="${KIT_NAME_SHORT}_LINUX"
"$LIVE_DIR/build.sh" -N "$prefix" -V "$DATE" -L "$label" -w "$TEMP_DIR/Linux" -o "$OUT_DIR" -v | tee -a "$LOG_DIR/$DATETIME.log" #mkarchiso -w "$BUILD_DIR/work" -o "$OUT_DIR" -v "$PROFILE_DIR" | tee -a "$LOG_DIR/$DATETIME.log"
mkarchiso -w /tmp/archiso-tmp -o "$OUT_DIR" -v "$PROFILE_DIR" | tee -a "$LOG_DIR/$DATETIME.log"
# Cleanup # Cleanup
echo "Removing temp files..." echo "Removing temp files..."
rm "$TEMP_DIR/Linux" -Rf | tee -a "$LOG_DIR/$DATETIME.log" rm "$TEMP_DIR/Linux" -Rf | tee -a "$LOG_DIR/$DATETIME.log"
#sudo umount -R "$BUILD_DIR/work" || true
#sudo rm -rf "$BUILD_DIR/work"
sudo umount -R /tmp/archiso-tmp || true
sudo rm -rf /tmp/archiso-tmp
echo "Reverting permissions..." echo "Reverting permissions..."
chown $REAL_USER:$REAL_USER "$LIVE_DIR" -R chown $REAL_USER:$REAL_USER "$PROFILE_DIR" -R
chown $REAL_USER:$REAL_USER "$OUT_DIR" -R chown $REAL_USER:$REAL_USER "$OUT_DIR" -R
} }

View file

@ -1 +0,0 @@
wklinux

View file

@ -1,2 +0,0 @@
en_US.UTF-8 UTF-8

View file

@ -1 +0,0 @@
/usr/lib/systemd/system/NetworkManager.service

View file

@ -1,6 +0,0 @@
PATH /%INSTALL_DIR%/boot/syslinux/
DEFAULT loadconfig
LABEL loadconfig
CONFIG /%INSTALL_DIR%/boot/syslinux/wk.cfg
APPEND /%INSTALL_DIR%/

View file

@ -1,5 +0,0 @@
DEFAULT loadconfig
LABEL loadconfig
CONFIG wk.cfg
APPEND ../../

View file

@ -1,14 +0,0 @@
DEFAULT select
LABEL select
COM32 boot/syslinux/whichsys.c32
APPEND -pxe- pxe -sys- sys -iso- iso
LABEL iso
CONFIG boot/syslinux/wk_iso.cfg
LABEL pxe
CONFIG boot/syslinux/wk_pxe.cfg
LABEL sys
CONFIG boot/syslinux/wk_sys.cfg

View file

@ -1,5 +0,0 @@
# http://hdt-project.org/
LABEL hdt
MENU LABEL Hardware Information (HDT)
COM32 boot/syslinux/hdt.c32
APPEND modules_alias=boot/syslinux/hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz

View file

@ -1,6 +0,0 @@
INCLUDE boot/syslinux/wk_head.cfg
INCLUDE boot/syslinux/wk_iso_linux.cfg
#DISABLED_UPSTREAM_BUG#INCLUDE boot/syslinux/wk_hdt.cfg
INCLUDE boot/syslinux/wk_tail.cfg

View file

@ -1,31 +0,0 @@
LABEL wk_iso_linux
TEXT HELP
A live Linux environment
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% loglevel=3
LABEL wk_iso_linux_i3
TEXT HELP
A live Linux environment (i3)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (i3)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% loglevel=3 i3
SYSAPPEND 3
LABEL wk_iso_linux_cli
TEXT HELP
A live Linux environment (CLI)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (CLI)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% loglevel=4 nomodeset nox
SYSAPPEND 3

View file

@ -1,8 +0,0 @@
INCLUDE boot/syslinux/wk_head.cfg
MENU BACKGROUND pxelinux.jpg
INCLUDE boot/syslinux/wk_pxe_linux.cfg
#UFD-WINPE#INCLUDE boot/syslinux/wk_pxe_winpe.cfg
#DISABLED_UPSTREAM_BUG#INCLUDE boot/syslinux/wk_hdt.cfg
INCLUDE boot/syslinux/wk_tail.cfg

View file

@ -1,32 +0,0 @@
LABEL wk_http_linux
TEXT HELP
A live Linux environment
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (PXE)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ loglevel=3
SYSAPPEND 3
LABEL wk_http_linux_i3
TEXT HELP
A live Linux environment (i3)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (PXE) (i3)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ loglevel=3 i3
SYSAPPEND 3
LABEL wk_http_linux_cli
TEXT HELP
A live Linux environment (CLI)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (PXE) (CLI)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ loglevel=4 nomodeset nox
SYSAPPEND 3

View file

@ -1,8 +0,0 @@
LABEL wk_http_winpe
TEXT HELP
A live Windows environment
* Create partition backups, Install Windows, etc
ENDTEXT
MENU LABEL Windows PE (PXE)
COM32 boot/syslinux/linux.c32
APPEND boot/wimboot gui initrdfile=winpe/x86_64/bootmgr,winpe/x86_64/BCD,winpe/x86_64/boot.sdi,winpe/x86_64/boot.wim

View file

@ -1,8 +0,0 @@
INCLUDE boot/syslinux/wk_head.cfg
INCLUDE boot/syslinux/wk_sys_linux.cfg
#UFD-WINPE#INCLUDE boot/syslinux/wk_sys_winpe.cfg
#UFD-HDCLONE#INCLUDE boot/syslinux/1201_hdclone.cfg
#UFD-ESET#INCLUDE boot/syslinux/1201_eset.cfg
#DISABLED_UPSTREAM_BUG#INCLUDE boot/syslinux/wk_hdt.cfg
INCLUDE boot/syslinux/wk_tail.cfg

View file

@ -1,8 +0,0 @@
LABEL wk_winpe
TEXT HELP
A live Windows environment
* Create partition backups, Install Windows, etc
ENDTEXT
MENU LABEL Windows PE
COM32 boot/syslinux/linux.c32
APPEND boot/wimboot gui initrdfile=../sources/bootmgr,../sources/BCD,../sources/boot.sdi,../sources/boot.wim

View file

@ -1,9 +0,0 @@
MENU SEPARATOR
LABEL reboot
MENU LABEL Reboot
COM32 boot/syslinux/reboot.c32
LABEL poweroff
MENU LABEL Power Off
COM32 boot/syslinux/poweroff.c32

View file

@ -1,337 +0,0 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $alt Mod1
set $ctrl Control
set $mod Mod4
# Configure border style <normal|1pixel|pixel xx|none|pixel>
new_window pixel 1
new_float normal
# Hide borders
hide_edge_borders none
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id amixer set Master 5%+ #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master 5%- #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle # mute sound
# alt+tab navi
bindsym $alt+Tab workspace next
bindsym $alt+Shift+Tab workspace prev
# change borders
bindsym $mod+u border none
bindsym $mod+y border pixel 1
bindsym $mod+n border normal
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font Inconsolata:monospace 8
font pango:Noto Sans Mono 10, FontAwesome 10
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
# kill focused window
bindsym $mod+Shift+q kill
bindsym $mod+q kill
bindsym $alt+F4 kill
# start dmenu (a program launcher)
#bindsym $mod+Shift+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
#bindsym $mod+Shift+d exec --no-startup-id i3-dmenu-desktop
bindsym $mod+r exec "rofi -combi-modi window,drun,run -show combi -modi combi"
bindsym $ctrl+$alt+r exec "rofi -combi-modi window,drun,run -show combi -modi combi"
# misc app shortcuts
bindsym $ctrl+$alt+c exec "urxvt -title 'WKClone (ddrescue-tui)' -e ddrescue-tui clone"
bindsym $ctrl+$alt+d exec "urxvt -title 'Hardware Diagnostics' -e hw-diags"
bindsym $ctrl+$alt+f exec "thunar ~"
bindsym $ctrl+$alt+i exec "hardinfo"
bindsym $ctrl+$alt+m exec "urxvt -title 'Mount All Volumes' -e mount-all-volumes gui"
bindsym $ctrl+$alt+s exec "urxvt -title 'Hardware Diagnostics' -e hw-diags --quick"
bindsym $ctrl+$alt+t exec "urxvt"
bindsym $ctrl+$alt+v exec "urxvt -title 'Hardware Sensors' -e hw-sensors"
bindsym $ctrl+$alt+w exec "firefox"
bindsym $mod+c exec "urxvt -title 'WKClone (ddrescue-tui)' -e ddrescue-tui clone"
bindsym $mod+d exec "urxvt -title 'Hardware Diagnostics' -e hw-diags"
bindsym $mod+f exec "thunar ~"
bindsym $mod+i exec "hardinfo"
bindsym $mod+m exec "urxvt -title 'Mount All Volumes' -e mount-all-volumes gui"
bindsym $mod+s exec "urxvt -title 'Hardware Diagnostics' -e hw-diags --quick"
bindsym $mod+t exec "urxvt"
bindsym $mod+v exec "urxvt -title 'Hardware Sensors' -e hw-sensors"
bindsym $mod+w exec "firefox"
focus_follows_mouse no
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# workspace back and forth (with/without active container)
workspace_auto_back_and_forth yes
bindsym $mod+b workspace back_and_forth
bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth
# split orientation
bindsym $mod+Shift+h split h
bindsym $mod+Shift+v split v
# enter fullscreen mode for the focused container
bindsym $mod+Shift+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+Shift+s layout stacking
bindsym $mod+Shift+w layout tabbed
bindsym $mod+Shift+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
#bindsym $mod+a focus parent
# move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
# focus the child container
#bindsym $mod+d focus child
# Workspace names
set $ws1 "一"
set $ws2 "二"
set $ws3 "三"
set $ws4 "四"
set $ws5 "五"
set $ws6 "六"
set $ws7 "七"
set $ws8 "八"
set $ws9 "九"
set $ws10 "十"
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Ctrl+1 move container to workspace $ws1
bindsym $mod+Ctrl+2 move container to workspace $ws2
bindsym $mod+Ctrl+3 move container to workspace $ws3
bindsym $mod+Ctrl+4 move container to workspace $ws4
bindsym $mod+Ctrl+5 move container to workspace $ws5
bindsym $mod+Ctrl+6 move container to workspace $ws6
bindsym $mod+Ctrl+7 move container to workspace $ws7
bindsym $mod+Ctrl+8 move container to workspace $ws8
bindsym $mod+Ctrl+9 move container to workspace $ws9
bindsym $mod+Ctrl+0 move container to workspace $ws10
# move focused container to workspace and follow
bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10; workspace $ws10
# Open specific applications in floating mode
for_window [class="Galculator"] floating enable border normal 5
for_window [class="Nitrogen"] floating enable sticky enable border normal 5
for_window [class="Thunar"] floating enable border normal 5
for_window [class="mpv"] floating enable border normal 5
for_window [title="Event Tester"] floating enable border normal 5
for_window [title="Firefox"] floating enable border normal 5
for_window [title="Hardware Diagnostics"] floating enable
for_window [title="Hardware Sensors"] floating enable
for_window [title="Mount All Volumes"] floating enable border normal 5
for_window [title="Network Connections"] floating enable border normal 5
for_window [title="Screen Layout Editor"] floating enable border normal 5
for_window [title="Slack"] floating enable border normal 5
for_window [title="System Information"] floating enable border normal 5
for_window [title="Volume Control"] floating enable border normal 5
for_window [title="Zenmap"] floating enable border normal 5
# switch to workspace with urgent window automatically
for_window [urgent=latest] focus
# reload the configuration file
#bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
#bindsym $mod+Shift+r restart
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Shift+r mode "resize"
# "System" menu
bindsym $ctrl+$alt+x mode "$mode_system"
bindsym $mod+x mode "$mode_system"
set $mode_system (l)ock, (e)xit, (r)eboot, (s)hutdown, (c)onfig, (i)3
mode "$mode_system" {
bindsym l exec --no-startup-id i3lock, mode "default"
bindsym e exit, mode "default"
bindsym r exec reboot, mode "default"
bindsym s exec poweroff, mode "default"
bindsym c reload, mode "default"
bindsym i restart, mode "default"
# exit system mode: "Enter" or "Escape"
bindsym Return mode "default"
bindsym Escape mode "default"
}
#############################
### settings for i3-gaps: ###
#############################
# Set inner/outer gaps
gaps inner 10
gaps outer 4
# Additionally, you can issue commands with the following syntax. This is useful to bind keys to changing the gap size.
# gaps inner|outer current|all set|plus|minus <px>
# gaps inner all set 10
# gaps outer all plus 5
# Smart gaps (gaps used if only more than one container on the workspace)
smart_gaps on
# Smart borders (draw borders around container only if it is not the only container on this workspace)
# on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0)
smart_borders on
# Press $mod+Shift+g to enter the gap mode. Choose o or i for modifying outer/inner gaps. Press one of + / - (in-/decrement for current workspace) or 0 (remove gaps for current workspace). If you also press Shift with these keys, the change will be global for all workspaces.
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer"
bindsym i mode "$mode_gaps_inner"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_inner" {
bindsym plus gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym 0 gaps inner current set 0
bindsym Shift+plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym Shift+0 gaps inner all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
bindsym plus gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym 0 gaps outer current set 0
bindsym Shift+plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym Shift+0 gaps outer all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
position bottom
separator_symbol " "
status_command i3status
height 26
}
exec urxvt -title "Initializing..." -e /home/tech/.update_x

View file

@ -1,76 +0,0 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 5
}
#order += "disk /"
order += "wireless _first_"
order += "ethernet _first_"
order += "cpu_usage"
order += "battery all"
#order += "volume master"
order += "tztime local"
#order += "tztime utc"
cpu_usage {
format = " %usage"
max_threshold = 90
#format_above_threshold = " %usage"
degraded_threshold = 75
#format_above_degraded_threshold = " %usage"
}
wireless _first_ {
format_up = " (%quality at %essid) %ip"
format_down = " Down"
}
ethernet _first_ {
# if you use %speed, i3status requires root privileges
format_up = " %ip"
format_down = " Down"
}
battery all {
integer_battery_capacity = true
format = "%status %percentage"
format_down = ""
status_chr = ""
status_bat = ""
status_unk = ""
status_full = ""
path = "/sys/class/power_supply/BAT%d/uevent"
low_threshold = 25
threshold_type = percentage
}
volume master {
format = " %volume"
format_muted = " muted"
device = "default"
}
tztime local {
format = "%F %H:%M"
}
tztime utc {
format = "%H:%M"
timezone = "UTC"
}
load {
format = "%1min"
}
disk "/" {
format = "%avail"
}

View file

@ -1,13 +0,0 @@
! rofi theme
rofi.color-enabled: true
! bg border separator
rofi.color-window: argb:d02d3036, #2d3036, #d64937
! bg fg bg-alt hl-bg hl-fg
rofi.color-normal: argb:d02d3036, #d8d8d8, argb:d02d3036, #2d3036, #d64937
rofi.color-active: argb:d0222222, #d64937, argb:d0222222, #d64937, #d8d8d8
rofi.color-urgent: argb:d0888888, #d8d8d8, argb:d0888888, #888888, #d64937
rofi.font: Noto Sans 12
rofi.separator-style: solid
rofi.hide-scrollbar: true

View file

@ -1,23 +0,0 @@
#!/bin/env bash
#
## Start desktop apps based on WM
# Start common apps
picom --backend xrender --xrender-sync --xrender-sync-fence &
sleep 1s
x0vncserver -display :0 -passwordfile $HOME/.vnc/passwd -AlwaysShared &
conky &
nm-applet &
volumeicon &
# Start WM specific apps
if ! [[ "${I3SOCK:-}" == "" ]]; then
# i3
i3-msg restart
else
# openbox
openbox --restart
tint2 &
cbatticon --hide-notification &
fi

View file

@ -1,11 +1,10 @@
aic94xx-firmware aic94xx-firmware
bash-pipes
hfsprogs hfsprogs
i3lock-fancy-git iwgtk
ldmtool ldmtool
macbook12-spi-driver-dkms
mprime mprime
openbox-patched openbox-patched
pipes.sh
smartmontools-svn smartmontools-svn
testdisk-wip testdisk-wip
ttf-font-awesome-4 ttf-font-awesome-4

View file

@ -1,7 +1,8 @@
aic94xx-firmware aic94xx-firmware
alsa-utils alsa-utils
amd-ucode
antiword antiword
bash-pipes base
bc bc
bluez bluez
bluez-utils bluez-utils
@ -16,10 +17,12 @@ diffutils
dmidecode dmidecode
dos2unix dos2unix
e2fsprogs e2fsprogs
edk2-shell
hexedit hexedit
hfsprogs hfsprogs
htop htop
inetutils inetutils
intel-ucode
iwd iwd
jfsutils jfsutils
ldmtool ldmtool
@ -27,6 +30,7 @@ ldns
less less
lha lha
libewf libewf
linux
linux-firmware linux-firmware
lm_sensors lm_sensors
lvm2 lvm2
@ -36,12 +40,15 @@ man-pages
mariadb-clients mariadb-clients
mdadm mdadm
mediainfo mediainfo
memtest86+
mkinitcpio
mkinitcpio-archiso
mprime mprime
nano nano
ncdu ncdu
networkmanager
p7zip p7zip
perl perl
pipes.sh
progsreiserfs progsreiserfs
python python
python-docopt python-docopt
@ -53,13 +60,17 @@ python-requests
reiserfsprogs reiserfsprogs
rfkill rfkill
rng-tools rng-tools
rsync
rxvt-unicode-terminfo rxvt-unicode-terminfo
smartmontools-svn smartmontools-svn
smbclient smbclient
speedtest-cli speedtest-cli
sudo
sysfsutils sysfsutils
syslinux
systemd-sysvcompat systemd-sysvcompat
terminus-font terminus-font
termite-terminfo
testdisk-wip testdisk-wip
texinfo texinfo
tmux tmux

View file

@ -5,8 +5,10 @@ curl
dos2unix dos2unix
git git
gtk-doc gtk-doc
gtk3
hwloc hwloc
imlib2 imlib2
iwd
json-glib json-glib
lhasa lhasa
libbsd libbsd
@ -28,3 +30,4 @@ rsync
startup-notification startup-notification
subversion subversion
syslinux syslinux
tigervnc

View file

@ -13,15 +13,12 @@ gparted
gpicview-gtk3 gpicview-gtk3
gsmartcontrol gsmartcontrol
hardinfo hardinfo
i3-gaps iwgtk
i3lock-fancy-git
i3status
leafpad leafpad
libinput libinput
mesa-demos mesa-demos
mkvtoolnix-cli mkvtoolnix-cli
mpv mpv
network-manager-applet
noto-fonts noto-fonts
noto-fonts-cjk noto-fonts-cjk
openbox-patched openbox-patched
@ -31,16 +28,18 @@ qemu-guest-agent
rofi rofi
rxvt-unicode rxvt-unicode
spice-vdagent spice-vdagent
termite
thunar thunar
tigervnc tigervnc
tint2 tint2
tk tk
ttf-font-awesome-4 ttf-font-awesome-4
ttf-hack
ttf-inconsolata ttf-inconsolata
veracrypt veracrypt
virtualbox-guest-modules-arch
virtualbox-guest-utils virtualbox-guest-utils
volumeicon volumeicon
wmctrl
xarchiver xarchiver
xf86-input-libinput xf86-input-libinput
xf86-video-amdgpu xf86-video-amdgpu

View file

@ -1,2 +0,0 @@
linux-headers
macbook12-spi-driver-dkms

View file

@ -1,21 +0,0 @@
arch-install-scripts
b43-fwcutter
darkhttpd
gpm
grml-zsh-config
grub
irssi
mc
openvpn
ppp
pptpclient
refind-efi
rp-pppoe
smartmontools
speedtouch
testdisk
wpa_actiond
vim-minimal
vpnc
wvdial
xl2tpd

View file

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -22,20 +22,20 @@ menuentry "MemTest86" {
menuentry "Linux" { menuentry "Linux" {
icon /EFI/boot/icons/wk_arch.png icon /EFI/boot/icons/wk_arch.png
loader /arch/boot/x86_64/vmlinuz loader /arch/boot/x86_64/vmlinuz-linux
initrd /arch/boot/intel_ucode.img initrd /arch/boot/intel_ucode.img
initrd /arch/boot/amd_ucode.img initrd /arch/boot/amd_ucode.img
initrd /arch/boot/x86_64/archiso.img initrd /arch/boot/x86_64/initramfs-linux.img
options "archisobasedir=arch archisolabel=%ARCHISO_LABEL% copytoram loglevel=3" options "archisobasedir=arch archisolabel=%ARCHISO_LABEL% copytoram loglevel=3"
submenuentry "Linux (CLI)" { submenuentry "Linux (CLI)" {
add_options "nox" add_options "nox"
} }
#UFD-MINIMAL#submenuentry "Linux (Minimal)" { #UFD-MINIMAL#submenuentry "Linux (Minimal)" {
#UFD-MINIMAL# loader /arch_minimal/vmlinuz #UFD-MINIMAL# loader /arch_minimal/vmlinuz-linux
#UFD-MINIMAL# initrd #UFD-MINIMAL# initrd
#UFD-MINIMAL# initrd /arch/boot/intel_ucode.img #UFD-MINIMAL# initrd /arch/boot/intel_ucode.img
#UFD-MINIMAL# initrd /arch/boot/amd_ucode.img #UFD-MINIMAL# initrd /arch/boot/amd_ucode.img
#UFD-MINIMAL# initrd /arch_minimal/archiso.img #UFD-MINIMAL# initrd /arch_minimal/initramfs-linux.img
#UFD-MINIMAL# options #UFD-MINIMAL# options
#UFD-MINIMAL# options "archisobasedir=arch_minimal archisolabel=%ARCHISO_LABEL% copytoram loglevel=3" #UFD-MINIMAL# options "archisobasedir=arch_minimal archisolabel=%ARCHISO_LABEL% copytoram loglevel=3"
#UFD-MINIMAL#} #UFD-MINIMAL#}
@ -59,10 +59,10 @@ menuentry "Linux" {
#UFD-DGPU#menuentry "Mac dGPU Disable Tool" { #UFD-DGPU#menuentry "Mac dGPU Disable Tool" {
#UFD-DGPU# icon /EFI/boot/icons/dgpu.png #UFD-DGPU# icon /EFI/boot/icons/dgpu.png
#UFD-DGPU# loader /dgpu/vmlinuz #UFD-DGPU# loader /dgpu/vmlinuz-linux
#UFD-DGPU# initrd /arch/boot/intel_ucode.img #UFD-DGPU# initrd /arch/boot/intel_ucode.img
#UFD-DGPU# initrd /arch/boot/amd_ucode.img #UFD-DGPU# initrd /arch/boot/amd_ucode.img
#UFD-DGPU# initrd /dgpu/archiso.img #UFD-DGPU# initrd /dgpu/initramfs-linux.img
#UFD-DGPU# options "archisobasedir=dgpu archisolabel=%ARCHISO_LABEL% nomodeset" #UFD-DGPU# options "archisobasedir=dgpu archisolabel=%ARCHISO_LABEL% nomodeset"
#UFD-DGPU#} #UFD-DGPU#}

View file

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 538 B

View file

Before

Width:  |  Height:  |  Size: 720 B

After

Width:  |  Height:  |  Size: 720 B

View file

@ -0,0 +1,8 @@
root:x:0:root
adm:x:4:tech
wheel:x:10:tech
uucp:x:14:tech
power:x:98:tech
autologin:x:975:tech
storage:x:988:tech
tech:x:1000:

View file

@ -0,0 +1,2 @@
root:!!::root
tech:!!::

View file

@ -0,0 +1,70 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run. Advanced users may wish to specify all system modules
# in this array. For instance:
# MODULES=(piix ide_disk reiserfs)
MODULES=()
# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image. This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()
# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way. This is useful for config files.
FILES=()
# HOOKS
# This is the most important setting in this file. The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
## This setup specifies all modules in the MODULES setting above.
## No raid, lvm2, or encrypted root is needed.
# HOOKS=(base)
#
## This setup will autodetect all modules for your system and should
## work as a sane default
# HOOKS=(base udev autodetect block filesystems)
#
## This setup will generate a 'full' image which supports most systems.
## No autodetection is done.
# HOOKS=(base udev block filesystems)
#
## This setup assembles a pata mdadm array with an encrypted root FS.
## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
# HOOKS=(base udev block mdadm encrypt filesystems)
#
## This setup loads an lvm2 volume group on a usb device.
# HOOKS=(base udev block lvm2 filesystems)
#
## NOTE: If you have /usr on a separate partition, you MUST include the
# usr, fsck and shutdown hooks.
HOOKS=(base udev modconf memdisk archiso_shutdown archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block filesystems keyboard)
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
#COMPRESSION="zstd"
# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()

View file

@ -0,0 +1,11 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
# mkinitcpio preset file for the 'linux' package on archiso
PRESETS=('archiso')
ALL_kver='/boot/vmlinuz-linux'
ALL_config='/etc/mkinitcpio.conf'
archiso_image="/boot/initramfs-linux.img"

View file

@ -0,0 +1,2 @@
root:x:0:0:root:/root:/usr/bin/zsh
tech:x:1000:1000::/home/tech:/usr/bin/zsh

View file

@ -0,0 +1 @@
root::14871::::::

View file

@ -11,6 +11,7 @@ alias du='du -sch --apparent-size'
alias fix-perms='find -type d -exec chmod 755 "{}" \; && find -type f -exec chmod 644 "{}" \;' alias fix-perms='find -type d -exec chmod 755 "{}" \; && find -type f -exec chmod 644 "{}" \;'
alias hexedit='hexedit --color' alias hexedit='hexedit --color'
alias hw-info='sudo hw-info | less -S' alias hw-info='sudo hw-info | less -S'
alias ip='ip -br -c'
alias less='less -S' alias less='less -S'
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias mkdir='mkdir -p' alias mkdir='mkdir -p'

View file

@ -0,0 +1,116 @@
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
PermitEmptyPasswords no
# Change to no to disable s/key passwords
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no # pam does that
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# override default of no subsystems
Subsystem sftp /usr/lib/ssh/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server

View file

@ -0,0 +1 @@
%wheel ALL=(ALL) NOPASSWD: ALL

View file

@ -0,0 +1,5 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Journal]
Storage=volatile

View file

@ -0,0 +1,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Login]
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore

View file

@ -0,0 +1,13 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Match]
Name=en*
Name=eth*
[Network]
DHCP=yes
IPv6PrivacyExtensions=yes
[DHCP]
RouteMetric=512

View file

@ -0,0 +1,13 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Match]
Name=wlp*
Name=wlan*
[Network]
DHCP=yes
IPv6PrivacyExtensions=yes
[DHCP]
RouteMetric=1024

View file

@ -0,0 +1,3 @@
[Manager]
DefaultTimeoutStartSec=15s
DefaultTimeoutStopSec=15s

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/systemd-networkd.service

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/systemd-resolved.service

View file

@ -0,0 +1,11 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Unit]
Description=Temporary /etc/pacman.d/gnupg directory
[Mount]
What=tmpfs
Where=/etc/pacman.d/gnupg
Type=tmpfs
Options=mode=0755

View file

@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin tech --noclear %I 38400 linux

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/iwd.service

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/systemd-networkd.service

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/systemd-resolved.service

View file

@ -0,0 +1,18 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Unit]
Description=Initializes Pacman keyring
Wants=haveged.service
After=haveged.service
Requires=etc-pacman.d-gnupg.mount
After=etc-pacman.d-gnupg.mount
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/pacman-key --init
ExecStart=/usr/bin/pacman-key --populate archlinux
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1 @@
/usr/lib/systemd/system/systemd-networkd.socket

View file

@ -0,0 +1,2 @@
[Time]
NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org

View file

@ -0,0 +1,12 @@
#!/bin/env bash
#
# Warning: customize_airootfs.sh is deprecated! Support for it will be removed in a future archiso version.
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen
locale-gen

View file

@ -0,0 +1,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
title Arch Linux (x86_64, UEFI)
linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux
initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux.img
options archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL%

Some files were not shown because too many files have changed in this diff Show more