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

This commit is contained in:
2Shirt 2023-03-26 23:22:34 -07:00
commit 9953f3978c
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
40 changed files with 144 additions and 280 deletions

6
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,6 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.257'
hooks:
- id: ruff

View file

@ -1,8 +1,2 @@
# WizardKit: Scripts #
## pylint ##
These scripts use two spaces per indent instead of the default four. As such you will need to update your pylintrc file or run like this:
`pylint --indent-after-paren=2 --indent-string=' ' wk`

View file

@ -1,18 +1,12 @@
"""WizardKit: Auto Repair Tool"""
# vim: sts=2 sw=2 ts=2
import os
import sys
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
import wk # pylint: disable=wrong-import-position
import wk
# Classes
REBOOT_STR = wk.std.color_string('Reboot', 'YELLOW')
class MenuEntry():
# pylint: disable=too-few-public-methods
"""Simple class to allow cleaner code below."""
def __init__(self, name, function=None, selected=True, **kwargs):
self.name = name
@ -184,5 +178,5 @@ if __name__ == '__main__':
wk.std.abort()
except SystemExit:
raise
except: #pylint: disable=bare-except
except: # noqa: E722
wk.std.major_exception()

View file

@ -1,17 +1,11 @@
"""WizardKit: Auto System Setup Tool"""
# vim: sts=2 sw=2 ts=2
import os
import sys
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
import wk # pylint: disable=wrong-import-position
import wk
# Classes
class MenuEntry():
# pylint: disable=too-few-public-methods
"""Simple class to allow cleaner code below."""
def __init__(self, name, function=None, selected=True, **kwargs):
self.name = name
@ -170,5 +164,5 @@ if __name__ == '__main__':
wk.std.abort()
except SystemExit:
raise
except: #pylint: disable=bare-except
except: # noqa: E722
wk.std.major_exception()

View file

@ -1,12 +1,7 @@
"""WizardKit: Build Kit (Windows)."""
# vim: sts=2 sw=2 ts=2
import os
import sys
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
import wk # pylint: disable=wrong-import-position
import wk
if __name__ == '__main__':
@ -16,5 +11,5 @@ if __name__ == '__main__':
wk.std.abort()
except SystemExit:
raise
except: #pylint: disable=bare-except
except: # noqa: E722
wk.std.major_exception()

View file

@ -1,6 +1,5 @@
#!/usr/bin/env python3
"""WizardKit: ddrescue TUI"""
# pylint: disable=invalid-name
# vim: sts=2 sw=2 ts=2
from docopt import docopt
@ -20,5 +19,5 @@ if __name__ == '__main__':
wk.clone.ddrescue.main()
except SystemExit:
raise
except: #pylint: disable=bare-except
except: # noqa: E722
wk.std.major_exception()

View file

@ -5,12 +5,9 @@ python.exe -i embedded_python_env.py
"""
# vim: sts=2 sw=2 ts=2
import os
import sys
import wk
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
import wk # pylint: disable=wrong-import-position
wk.std.print_colored(
(wk.cfg.main.KIT_NAME_FULL, ': ', 'Debug Console'),
('GREEN', None, 'YELLOW'),

View file

@ -1,11 +1,6 @@
"""WizardKit: Export Bitlocker Tool"""
# vim: sts=2 sw=2 ts=2
import os
import sys
import wk
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
import wk # pylint: disable=wrong-import-position
wk.os.win.export_bitlocker_info()
wk.os.win.export_bitlocker_info()

View file

@ -1,6 +1,5 @@
#!/usr/bin/env python3
"""WizardKit: Hardware Diagnostics"""
# pylint: disable=invalid-name
# vim: sts=2 sw=2 ts=2
from docopt import docopt
@ -20,5 +19,5 @@ if __name__ == '__main__':
wk.hw.diags.main()
except SystemExit:
raise
except: #pylint: disable=bare-except
except: # noqa: E722
wk.std.major_exception()

View file

@ -1,13 +1,9 @@
"""WizardKit: Launch Snappy Driver Installer Origin"""
# vim: sts=2 sw=2 ts=2
import os
import sys
import wk
from wk.cfg.net import SDIO_SERVER
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
import wk # pylint: disable=wrong-import-position
from wk.cfg.net import SDIO_SERVER # pylint: disable=wrong-import-position
# STATIC VARIABLES
MOUNT_EXCEPTIONS = (
@ -70,7 +66,9 @@ def use_network_sdio():
if __name__ == '__main__':
wk.std.set_title(f'{wk.cfg.main.KIT_NAME_FULL}: Snappy Driver Installer Origin Launcher')
wk.std.set_title(
f'{wk.cfg.main.KIT_NAME_FULL}: Snappy Driver Installer Origin Launcher',
)
log_dir = wk.log.format_log_path(tool=True).parent
USE_NETWORK = False

View file

@ -1,6 +1,5 @@
#!/usr/bin/env python3
"""WizardKit: Mount Backup Shares"""
# pylint: disable=invalid-name
# vim: sts=2 sw=2 ts=2
import wk

View file

@ -1,150 +0,0 @@
#!/bin/bash
#
## sort photorec results into something usefull
## Set paths
recup_dir="${1%/}"
[ -n "$recup_dir" ] || recup_dir="."
recup_dir="$(realpath "$recup_dir")"
out_dir="$recup_dir/Recovered"
bad_dir="$recup_dir/Corrupt"
## Test path before starting (using current dir if not specified)
for d in $recup_dir/recup*; do
### Source: http://stackoverflow.com/a/6364244
## Check if the glob gets expanded to existing files.
## If not, f here will be exactly the pattern above
## and the exists test will evaluate to false.
[ -e "$d" ] && echo "Found recup folder(s)" || {
echo "ERROR: No recup folders found"
echo "Usage: $0 recup_dir"
exit 1
}
## This is all we needed to know, so we can break after the first iteration
break
done
# Hard link files into folders by type
for d in $recup_dir/recup*; do
if [ -d "$d" ]; then
echo "Linking $d"
pushd $d >/dev/null
find -type f | while read k; do
file="$(basename "$k")"
src="$(realpath "$k")"
ext="$(echo "${file##*.}" | tr '[:upper:]' '[:lower:]')"
ext_dir="$out_dir/$ext"
if [ "${file##*.}" = "$file" ]; then
ext_dir="$out_dir/_MISC_"
elif [ "$ext" = "jpg" ] && [ "${file:0:1}" = "t" ]; then
ext_dir="$out_dir/jpg-thumbnail"
fi
#echo " $file -> $ext_dir"
[ -d "$ext_dir" ] || mkdir -p "$ext_dir"
ln "$src" "$ext_dir"
done
popd >/dev/null
else
echo "ERROR: '$d' not a directory"
fi
done
## Check the files output by photorec for corruption
pushd "$out_dir" >/dev/null
# Check archives with 7-Zip
#for d in 7z bz2 gz lzh lzo rar tar xz zip; do
# if [ -d "$d" ]; then
# echo "Checking $d files"
# pushd "$d" >/dev/null
# for f in *; do
# if ! 7z t "$f" >/dev/null 2>&1; then
# #echo " BAD: $f"
# [ -d "$bad_dir/$d" ] || mkdir -p "$bad_dir/$d"
# mv -n "$f" "$bad_dir/$d/$f"
# fi
# done
# popd >/dev/null
# fi
#done
# Check Audio/Video files with ffprobe
for d in avi flac flv m4a m4p m4v mkv mid mov mp2 mp3 mp4 mpg mpg2 ogg ts vob wav; do
if [ -d "$d" ]; then
echo "Checking $d files"
pushd "$d" >/dev/null
for f in *; do
if ! ffprobe "$f" >/dev/null 2>&1; then
#echo " BAD: $f"
[ -d "$bad_dir/$d" ] || mkdir -p "$bad_dir/$d"
mv -n "$f" "$bad_dir/$d/$f"
fi
done
popd >/dev/null
fi
done
# Check .doc files with antiword
if [ -d "doc" ]; then
echo "Checking doc files"
pushd "doc" >/dev/null
for f in *doc; do
if ! antiword "$f" >/dev/null 2>&1; then
#echo " BAD: $f"
[ -d "$bad_dir/doc" ] || mkdir -p "$bad_dir/doc"
mv -n "$f" "$bad_dir/doc/$f"
fi
done
popd >/dev/null
fi
# Check .docx files with 7z and grep
if [ -d "docx" ]; then
echo "Checking docx files"
pushd "docx" >/dev/null
for f in *docx; do
if ! 7z l "$f" | grep -q -s "word/document.xml"; then
#echo " BAD: $f"
[ -d "$bad_dir/docx" ] || mkdir -p "$bad_dir/docx"
mv -n "$f" "$bad_dir/docx/$f"
fi
done
popd >/dev/null
fi
# Sort pictures by date (only for common camera formats)
for d in jpg mrw orf raf raw rw2 tif x3f; do
if [ -d "$d" ]; then
echo "Sorting $d files by date"
pushd "$d" >/dev/null
for f in *; do
date_dir="$(date -d "$(stat -c %y "$f")" +"%F")"
[ -d "$date_dir" ] || mkdir "$date_dir"
mv -n "$f" "$date_dir/"
done
popd >/dev/null
fi
done
# Sort mov files by encoded date
if [ -d "mov" ]; then
echo "Sorting mov files by date"
pushd "mov" >/dev/null
for f in *mov; do
enc_date="$(mediainfo "$f" | grep -i "Encoded date" | head -1 | sed -r 's/.*: //')"
date_dir="$(date -d "$enc_date" +"%F")"
echo "$date_dir" | grep -E -q -s '^[0-9]{4}-[0-9]{2}-[0-9]{2}$' || date_dir="Unknown Date"
[ -d "$date_dir" ] || mkdir "$date_dir"
mv -n "$f" "$date_dir/"
done
popd >/dev/null
fi
## sort audio files by tags
## sort matroska files by metadata
## return to original dir
popd >/dev/null

18
scripts/pyproject.toml Normal file
View file

@ -0,0 +1,18 @@
[tool.ruff.per-file-ignores]
# Init files
"wk/__init__.py" = ["F401"]
"wk/cfg/__init__.py" = ["F401"]
"wk/clone/__init__.py" = ["F401"]
"wk/hw/__init__.py" = ["F401"]
"wk/kit/__init__.py" = ["F401"]
"wk/os/__init__.py" = ["F401"]
"wk/repairs/__init__.py" = ["F401"]
"wk/setup/__init__.py" = ["F401"]
# Long lines
"wk/borrowed/acpi.py" = ["E501", "F841"]
"wk/cfg/ddrescue.py" = ["E501"]
"wk/cfg/hw.py" = ["E501"]
"wk/cfg/launchers.py" = ["E501"]
"wk/cfg/setup.py" = ["E501"]
"wk/cfg/sources.py" = ["E501"]

View file

@ -1,5 +1,4 @@
"""WizardKit: Config - ddrescue"""
# pylint: disable=line-too-long
# vim: sts=2 sw=2 ts=2
from collections import OrderedDict

View file

@ -1,5 +1,4 @@
"""WizardKit: Config - Hardware"""
# pylint: disable=line-too-long
# vim: sts=2 sw=2 ts=2
import re

View file

@ -1,5 +1,4 @@
"""WizardKit: Config - Launchers (Windows)"""
# pylint: disable=line-too-long
# vim: sts=2 sw=2 ts=2
LAUNCHERS = {

View file

@ -1,5 +1,4 @@
"""WizardKit: Config - Setup"""
# pylint: disable=line-too-long
# vim: sts=2 sw=2 ts=2
@ -47,8 +46,11 @@ REG_ESET_NOD32_SETTINGS = {
},
}
REG_WINDOWS_EXPLORER = {
# pylint: disable=line-too-long
'HKLM': {
# Allow password sign-in for MS accounts
r'Software\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device': (
('DevicePasswordLessBuildVersion', 0, 'DWORD'),
),
# Disable Location Tracking
r'Software\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}': (
('SensorPermissionState', 0, 'DWORD'),

View file

@ -1,5 +1,4 @@
"""WizardKit: Config - Tool Sources"""
# pylint: disable=line-too-long
# vim: sts=2 sw=2 ts=2

View file

@ -1,5 +1,4 @@
"""WizardKit: ddrescue TUI"""
# pylint: disable=too-many-lines
# vim: sts=2 sw=2 ts=2
import atexit
@ -129,7 +128,6 @@ TIMEZONE = pytz.timezone(cfg.main.LINUX_TIME_ZONE)
# Classes
class BlockPair():
"""Object for tracking source to dest recovery data."""
# pylint: disable=too-many-instance-attributes
def __init__(self, source, destination, model, working_dir):
"""Initialize BlockPair()
@ -357,7 +355,6 @@ class BlockPair():
class State():
# pylint: disable=too-many-instance-attributes,too-many-public-methods
"""Object for tracking hardware diagnostic data."""
def __init__(self):
self.block_pairs = []
@ -727,7 +724,6 @@ class State():
return sum(pair.size for pair in self.block_pairs)
def init_recovery(self, docopt_args):
# pylint: disable=too-many-branches,too-many-statements
"""Select source/dest and set env."""
std.clear_screen()
source_parts = []
@ -2022,7 +2018,6 @@ def source_or_destination_changed(state):
def main():
# pylint: disable=too-many-branches
"""Main function for ddrescue TUI."""
args = docopt(DOCSTRING)
log.update_log_path(dest_name='ddrescue-TUI', timestamp=True)
@ -2179,7 +2174,6 @@ def mount_raw_image_macos(path):
def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True):
# pylint: disable=too-many-statements
"""Run ddrescue using passed settings."""
cmd = build_ddrescue_cmd(block_pair, pass_name, settings)
poweroff_source_after_idle = True
@ -2327,7 +2321,6 @@ def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True):
def run_recovery(state, main_menu, settings_menu, dry_run=True):
# pylint: disable=too-many-branches
"""Run recovery passes."""
atexit.register(state.save_debug_reports)
attempted_recovery = False

View file

@ -1,11 +1,9 @@
"""WizardKit: Debug Functions"""
# pylint: disable=invalid-name
# vim: sts=2 sw=2 ts=2
# Classes
class Debug():
# pylint: disable=too-few-public-methods
"""Object used when dumping debug data."""
def method(self):
"""Dummy method used to identify functions vs data."""

View file

@ -21,7 +21,6 @@ LOG = logging.getLogger(__name__)
# Classes
class NonBlockingStreamReader():
"""Class to allow non-blocking reads from a stream."""
# pylint: disable=too-few-public-methods
# Credits:
## https://gist.github.com/EyalAr/7915597
## https://stackoverflow.com/a/4896288
@ -204,7 +203,6 @@ def popen_program(cmd, minimized=False, pipe=False, shell=False, **kwargs):
shell=shell,
**kwargs)
try:
# pylint: disable=consider-using-with
proc = subprocess.Popen(**cmd_kwargs)
except FileNotFoundError:
LOG.error('Command not found: %s', cmd)
@ -216,7 +214,6 @@ def popen_program(cmd, minimized=False, pipe=False, shell=False, **kwargs):
def run_program(cmd, check=True, pipe=True, shell=False, **kwargs):
# pylint: disable=subprocess-run-check
"""Run program and return a subprocess.CompletedProcess object."""
LOG.debug(
'cmd: %s, check: %s, pipe: %s, shell: %s',

View file

@ -371,7 +371,6 @@ class State():
# Functions
def build_menu(cli_mode=False, quick_mode=False) -> std.Menu:
# pylint: disable=too-many-branches
"""Build main menu, returns wk.std.Menu."""
menu = std.Menu(title=None)
@ -427,7 +426,6 @@ def build_menu(cli_mode=False, quick_mode=False) -> std.Menu:
def cpu_stress_tests(state, test_objects, test_mode=False) -> None:
# pylint: disable=too-many-statements
"""CPU & cooling check using Prime95 and Sysbench."""
LOG.info('CPU Test (Prime95)')
aborted = False
@ -568,7 +566,6 @@ def cpu_stress_tests(state, test_objects, test_mode=False) -> None:
def disk_attribute_check(state, test_objects, test_mode=False) -> None:
# pylint: disable=unused-argument
"""Disk attribute check."""
LOG.info('Disk Attribute Check')
for test in test_objects:
@ -654,7 +651,6 @@ def disk_io_benchmark(
def disk_self_test(state, test_objects, test_mode=False) -> None:
# pylint: disable=unused-argument
"""Disk self-test if available."""
LOG.info('Disk Self-Test(s)')
aborted = False
@ -827,7 +823,6 @@ def disk_volume_utilization(state, test_objects, test_mode=False) -> None:
def main() -> None:
# pylint: disable=too-many-branches
"""Main function for hardware diagnostics."""
args = docopt(DOCSTRING)
log.update_log_path(dest_name='Hardware-Diagnostics', timestamp=True)

View file

@ -33,7 +33,6 @@ WK_LABEL_REGEX = re.compile(
# Classes
@dataclass(**DATACLASS_DECORATOR_KWARGS)
class Disk:
# pylint: disable=too-many-instance-attributes
"""Object for tracking disk specific data."""
attributes: dict[Any, dict] = field(init=False, default_factory=dict)
bus: str = field(init=False)

View file

@ -121,7 +121,6 @@ class Sensors():
self, out_path, alt_max=None,
exit_on_thermal_limit=True, temp_labels=None,
thermal_action=None) -> None:
# pylint: disable=too-many-arguments
"""Write report to path every second until stopped.
thermal_action is a cmd to run if ThermalLimitReachedError is caught.
@ -182,7 +181,6 @@ class Sensors():
self, out_path, alt_max=None,
exit_on_thermal_limit=True, temp_labels=None,
thermal_action=None) -> None:
# pylint: disable=too-many-arguments
"""Start background thread to save report to file.
thermal_action is a cmd to run if ThermalLimitReachedError is caught.
@ -315,7 +313,11 @@ def get_sensor_data_linux() -> dict[Any, Any]:
## current temp is labeled xxxx_input
for source, labels in sources.items():
for label, temp in labels.items():
if label.startswith('fan') or label.startswith('in') or label.startswith('curr'):
if (
label.startswith('fan')
or label.startswith('in')
or label.startswith('curr')
):
# Skip fan RPMs and voltages
continue
if 'input' in label:

View file

@ -8,7 +8,6 @@ from wk.cfg.python import DATACLASS_DECORATOR_KWARGS
@dataclass(**DATACLASS_DECORATOR_KWARGS)
class Test:
# pylint: disable=too-many-instance-attributes
"""Object for tracking test specific data."""
dev: Any
label: str

View file

@ -228,7 +228,11 @@ def download_fastcopy():
def download_furmark():
"""Download FurMark."""
installer = download_to_temp('FurMark_Setup.exe', SOURCES['FurMark'], referer=SOURCES['FurMark'])
installer = download_to_temp(
'FurMark_Setup.exe',
SOURCES['FurMark'],
referer=SOURCES['FurMark'],
)
out_path = BIN_DIR.joinpath('FurMark')
tmp_path = TMP_DIR.joinpath('FurMarkInstall')
run_program([installer, f'/DIR={tmp_path}', '/SILENT'])

View file

@ -55,13 +55,23 @@ def download_file(out_path, source_url, as_new=False, overwrite=False, referer=N
# Request download
with requests.Session() as session:
try:
response = session.get(source_url, allow_redirects=True, headers=headers, stream=True)
except requests.RequestException as _err:
response = session.get(
source_url,
allow_redirects=True,
headers=headers,
stream=True,
)
except requests.RequestException:
try:
sleep(1)
response = session.get(source_url, allow_redirects=True, headers=headers, stream=True)
except requests.RequestException as _err2:
download_failed = _err2
response = session.get(
source_url,
allow_redirects=True,
headers=headers,
stream=True,
)
except requests.RequestException as _err:
download_failed = _err
else:
if not response.ok:
download_failed = response

View file

@ -90,7 +90,6 @@ def apply_image(part_path, image_path, hide_macos_boot=True):
def build_ufd():
# pylint: disable=too-many-statements
"""Build UFD using selected sources."""
args = docopt(DOCSTRING)
if args['--debug']:

View file

@ -41,7 +41,6 @@ def enable_debug_mode():
def format_log_path(
log_dir=None, log_name=None, timestamp=False,
kit=False, tool=False, append=False):
# pylint: disable=too-many-arguments
"""Format path based on args passed, returns pathlib.Path obj."""
log_path = pathlib.Path(
f'{log_dir if log_dir else DEFAULT_LOG_DIR}/'

View file

@ -178,7 +178,6 @@ def mount(source, mount_point=None, read_write=False):
def mount_volumes(device_path=None, read_write=False, scan_corestorage=False):
# pylint: disable=too-many-branches
"""Mount all detected volumes.
NOTE: If device_path is specified then only volumes

View file

@ -6,6 +6,7 @@ import logging
import os
import pathlib
import platform
import re
from contextlib import suppress
import psutil
@ -73,6 +74,9 @@ KNOWN_HIVE_NAMES = {
RAM_OK = 5.5 * 1024**3 # ~6 GiB assuming a bit of shared memory
RAM_WARNING = 3.5 * 1024**3 # ~4 GiB assuming a bit of shared memory
REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer'
REGEX_4K_ALIGNMENT = re.compile(
r'^(?P<description>.*?)\s+(?P<size>\d+)\s+(?P<offset>\d+)',
)
SLMGR = pathlib.Path(f'{os.environ.get("SYSTEMROOT")}/System32/slmgr.vbs')
SYSTEMDRIVE = os.environ.get('SYSTEMDRIVE')
@ -165,19 +169,41 @@ def set_timezone(zone):
# Info Functions
def check_4k_alignment(show_alert=False):
"""Check if all partitions are 4K aligned, returns book."""
cmd = ['WMIC', 'partition', 'get', 'StartingOffset']
cmd = ['WMIC', 'partition', 'get', 'Caption,Size,StartingOffset']
report = []
show_alert = False
# Check offsets
proc = run_program(cmd)
for offset in proc.stdout.splitlines():
offset = offset.strip()
if not offset.isnumeric():
for line in proc.stdout.splitlines():
line = line.strip()
if not line or not line.startswith('Disk'):
continue
if int(offset) % 4096 != 0:
# Not aligned
if show_alert:
show_alert_box('One or more partitions are not 4K aligned')
raise GenericError('One or more partitions are not 4K aligned')
match = REGEX_4K_ALIGNMENT.match(line)
if not match:
LOG.error('Failed to parse partition info for: %s', line)
continue
if int(match.group('offset')) % 4096 == 0:
report.append(
color_string(
f'{match.group("description")}'
f' ({bytes_to_string(match.group("size"), decimals=1)})'
,
'RED'
)
)
# Show alert
if show_alert:
show_alert_box('One or more partitions not 4K aligned')
# Done
if report:
report.insert(
0,
color_string('One or more partitions not 4K aligned', 'YELLOW'),
)
return report
def defender_is_disabled():
@ -411,7 +437,6 @@ def show_alert_box(message, title=None):
# Registry Functions
def reg_delete_key(hive, key, recurse=False):
# pylint: disable=raise-missing-from
"""Delete a key from the registry.
NOTE: If recurse is False then it will only work on empty keys.
@ -575,7 +600,6 @@ def reg_write_settings(settings):
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)
@ -759,7 +783,7 @@ def start_service(service_name):
run_program(cmd, check=False)
# Verify service was started
if not get_service_status(service_name) in ('running', 'start_pending'):
if get_service_status(service_name) not in ('running', 'start_pending'):
raise GenericError(f'Failed to start service {service_name}')

View file

@ -1,5 +1,4 @@
"""WizardKit: Repairs - Windows"""
# pylint: disable=too-many-lines
# vim: sts=2 sw=2 ts=2
import atexit
@ -564,7 +563,12 @@ def set_log_path():
# Ignore and use default values
update_log_path(dest_name='Auto Repairs', timestamp=True)
else:
update_log_path(dest_name=log_path, keep_history=False, timestamp=False, append=True)
update_log_path(
dest_name=log_path,
keep_history=False,
timestamp=False,
append=True,
)
def show_main_menu(base_menus, menus, presets, title):

View file

@ -1,5 +1,4 @@
"""WizardKit: Setup - Windows"""
# pylint: disable=too-many-lines
# vim: sts=2 sw=2 ts=2
import configparser

View file

@ -1,5 +1,4 @@
"""WizardKit: Standard Functions"""
# pylint: disable=too-many-lines
# vim: sts=2 sw=2 ts=2
import inspect
@ -134,7 +133,6 @@ class Menu():
def _get_display_name(
self, name, details,
index=None, no_checkboxes=True, setting_item=False):
# pylint: disable=too-many-arguments
"""Format display name based on details and args, returns str."""
disabled = details.get('Disabled', False)
if setting_item and not details['Selected']:
@ -400,7 +398,6 @@ class Menu():
class TryAndPrint():
# pylint: disable=too-many-instance-attributes
"""Object used to standardize running functions and returning the result.
The errors and warning attributes are used to allow fine-tuned results
@ -521,7 +518,6 @@ class TryAndPrint():
def run(
self, message, function, *args,
catch_all=None, msg_good=None, verbose=None, **kwargs):
# pylint: disable=catching-non-exception
"""Run a function and print the results, returns results as dict.
If catch_all is True then (nearly) all exceptions will be caught.

View file

@ -203,7 +203,6 @@ def prep_file(path):
def resize_pane(pane_id=None, width=None, height=None, **kwargs):
# pylint: disable=unused-argument
"""Resize current or target pane.
NOTE: kwargs is only here to make calling this function easier

View file

@ -1,16 +1,11 @@
#!/usr/bin/env python3
"""WizardKit: Debug Launcher"""
# pylint: disable=invalid-name
# vim: sts=2 sw=2 ts=2
import os
import pathlib
import pickle
import sys
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
import wk # pylint: disable=wrong-import-position
import wk
# STATIC VARIABLES

View file

@ -118,12 +118,11 @@ function update_live_env() {
sed -i -r "s/SUPPORT_URL/$KIT_NAME_SHORT/" "$PROFILE_DIR/profiledef.sh"
# Boot config (legacy)
mkdir -p "$PROFILE_DIR/syslinux/wimboot"
mkdir -p "$TEMP_DIR" 2>/dev/null
git clone --depth=1 https://github.com/ipxe/wimboot "$TEMP_DIR/wimboot"
rsync -aI "$TEMP_DIR/wimboot"/{LICENSE.txt,README.md,wimboot} "$PROFILE_DIR/syslinux/wimboot/"
cp "$ROOT_DIR/images/Syslinux.jpg" "$PROFILE_DIR/syslinux/syslinux.jpg"
sed -i -r "s/__+/$KIT_NAME_FULL/" "$PROFILE_DIR/syslinux/syslinux.cfg"
mkdir -p "$TEMP_DIR" 2>/dev/null
curl -Lo "$TEMP_DIR/wimboot.zip" "http://git.ipxe.org/releases/wimboot/wimboot-latest.zip"
7z e -aoa "$TEMP_DIR/wimboot.zip" -o"$PROFILE_DIR/syslinux/wimboot" 'wimboot*/LICENSE.txt' 'wimboot*/README.txt' 'wimboot*/wimboot'
# Boot config (UEFI)
curl -Lo "$TEMP_DIR/refind.zip" "https://sourceforge.net/projects/refind/files/latest/download"
@ -134,7 +133,14 @@ function update_live_env() {
rsync -aI "$TEMP_DIR/refind"/refind*/refind/icons/ "$PROFILE_DIR/EFI/boot/icons/"
sed -i "s/%ARCHISO_LABEL%/${label}/" "$PROFILE_DIR/EFI/boot/refind.conf"
# Memtest86
# Memtest86+ (Open Source)
mkdir -p "$PROFILE_DIR/EFI/memtest86+"
mkdir -p "$TEMP_DIR/memtest86+"
curl -Lo "$TEMP_DIR/memtest86+/memtest86-binaries.zip" "https://memtest.org/download/v6.10/mt86plus_6.10.binaries.zip"
7z e "$TEMP_DIR/memtest86+/memtest86-binaries.zip" -o"$TEMP_DIR/memtest86+" "memtest64.efi"
mv "$TEMP_DIR/memtest86+/memtest64.efi" "$PROFILE_DIR/EFI/memtest86+/bootx64.efi"
# Memtest86 (Passmark)
mkdir -p "$PROFILE_DIR/EFI/memtest86/Benchmark"
mkdir -p "$TEMP_DIR/memtest86"
curl -Lo "$TEMP_DIR/memtest86/memtest86-usb.zip" "https://www.memtest86.com/downloads/memtest86-usb.zip"
@ -142,7 +148,7 @@ function update_live_env() {
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"
rm "$TEMP_DIR/memtest86/EFI/BOOT/BOOTIA32.efi"
mv "$TEMP_DIR/memtest86/EFI/BOOT/BOOTX64.efi" "$PROFILE_DIR/EFI/memtest86/memtestx64.efi"
mv "$TEMP_DIR/memtest86/EFI/BOOT/BOOTX64.efi" "$PROFILE_DIR/EFI/memtest86/bootx64.efi"
mv "$TEMP_DIR/memtest86/EFI/BOOT"/* "$PROFILE_DIR/EFI/memtest86"/
mv "$TEMP_DIR/memtest86/help"/* "$PROFILE_DIR/EFI/memtest86"/
mv "$TEMP_DIR/memtest86/license.rtf" "$PROFILE_DIR/EFI/memtest86"/

View file

@ -3,7 +3,7 @@
timeout 0
scanfor manual
showtools firmware,reboot,shutdown
default_selection MemTest86
default_selection Linux
csr_values 10,77
#use_graphics_for osx,linux,windows
@ -15,11 +15,6 @@ selection_small selection_small.png
hideui arrows,badges
# Entries
menuentry "MemTest86" {
icon /EFI/boot/icons/wk_memtest.png
loader /EFI/memtest86/bootx64.efi
}
menuentry "Linux" {
icon /EFI/boot/icons/wk_arch.png
loader /arch/boot/x86_64/vmlinuz-linux
@ -32,6 +27,19 @@ menuentry "Linux" {
}
}
menuentry "MemTest86+" {
icon /EFI/boot/icons/wk_memtest.png
options "nobigstatus nopause"
loader /EFI/memtest86+/bootx64.efi
submenuentry "Memtest86+ (Open Source)" {
loader /EFI/memtest86+/bootx64.efi
}
submenuentry "Memtest86 (Passmark)" {
loader /EFI/memtest86/bootx64.efi
options
}
}
#UFD-MACOS-10.11#menuentry "macOS (El Capitan)" {
#UFD-MACOS-10.11# icon /EFI/boot/icons/wk_mac_10.11.png
#UFD-MACOS-10.11# volume "PARTUUID"

View file

@ -35,11 +35,11 @@ MENU SEPARATOR
MENU CLEAR
DEFAULT memtest
DEFAULT wk_linux
TIMEOUT 0
INCLUDE memtest.cfg
INCLUDE linux.cfg
INCLUDE memtest.cfg
#UFD-WINPE#INCLUDE winpe.cfg
#UFD-ESET#INCLUDE eset.cfg

View file

@ -190,6 +190,9 @@ if ($MyInvocation.InvocationName -ne ".") {
}
Remove-Item "$Temp\python*.zip"
Remove-Item "$Temp\*.whl"
foreach ($File in Get-ChildItem "$Bin\Python\*\*._pth") {
Add-Content "$File" "`n#WizardKit`n..\..\Scripts"
}
## Done ##
Pop-Location