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

This commit is contained in:
2Shirt 2020-01-13 17:35:26 -07:00
commit 47b4ab6636
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
12 changed files with 1317 additions and 1271 deletions

View file

@ -83,17 +83,17 @@ if ($MyInvocation.InvocationName -ne ".") {
DownloadFile -Path $Path -Name "7z-extra.7z" -Url "https://www.7-zip.org/a/7z1900-extra.7z"
# ConEmu
$Url = "https://github.com/Maximus5/ConEmu/releases/download/v19.06.23/ConEmuPack.190623.7z"
$Url = "https://github.com/Maximus5/ConEmu/releases/download/v19.03.10/ConEmuPack.190310.7z"
DownloadFile -Path $Path -Name "ConEmuPack.7z" -Url $Url
# Notepad++
$Url = "https://notepad-plus-plus.org/repository/7.x/7.7.1/npp.7.7.1.bin.minimalist.7z"
$Url = "https://notepad-plus-plus.org/repository/7.x/7.6.4/npp.7.6.4.bin.minimalist.7z"
DownloadFile -Path $Path -Name "npp.7z" -Url $Url
# Python
$Url = "https://www.python.org/ftp/python/3.7.4/python-3.7.4-embed-win32.zip"
$Url = "https://www.python.org/ftp/python/3.7.2/python-3.7.2.post1-embed-win32.zip"
DownloadFile -Path $Path -Name "python32.zip" -Url $Url
$Url = "https://www.python.org/ftp/python/3.7.4/python-3.7.4-embed-amd64.zip"
$Url = "https://www.python.org/ftp/python/3.7.2/python-3.7.2.post1-embed-amd64.zip"
DownloadFile -Path $Path -Name "python64.zip" -Url $Url
# Python: psutil

View file

@ -641,7 +641,7 @@ def check_self_test_results(test_obj, aborted=False):
# known progress instead of just "was aborted buy host"
test_details = test_obj.dev.get_smart_self_test_details()
test_result = test_details.get('status', {}).get('string', 'Unknown')
test_obj.report.append(f' {test_result}')
test_obj.report.append(f' {test_result.capitalize()}')
if aborted and not (test_obj.passed or test_obj.failed):
test_obj.report.append(std.color_string(' Aborted', 'YELLOW'))
test_obj.set_status('Aborted')

View file

@ -163,6 +163,11 @@ class Disk(BaseObj):
self.get_details()
self.enable_smart()
self.update_smart_details()
if self.details['bus'] == 'USB' and not self.attributes:
# Try using SAT
LOG.warning('Using SAT for smartctl for %s', self.path)
self.enable_smart(use_sat=True)
self.update_smart_details(use_sat=True)
if not self.is_4k_aligned():
self.add_note('One or more partitions are not 4K aligned', 'YELLOW')
@ -218,11 +223,12 @@ class Disk(BaseObj):
test.set_status('Denied')
test.disabled = True
def enable_smart(self):
def enable_smart(self, use_sat=False):
"""Try enabling SMART for this disk."""
cmd = [
'sudo',
'smartctl',
f'--device={"sat,auto" if use_sat else "auto"}',
'--tolerance=permissive',
'--smart=on',
self.path,
@ -500,12 +506,23 @@ class Disk(BaseObj):
# Done
return result
def update_smart_details(self):
def update_smart_details(self, use_sat=False):
"""Update SMART details via smartctl."""
self.attributes = {}
# Check if SAT is needed
if not use_sat:
# use_sat not set, check previous run (if possible)
for arg in self.smartctl.get('smartctl', {}).get('argv', []):
if arg == '--device=sat,auto':
use_sat = True
break
# Get SMART data
cmd = [
'sudo',
'smartctl',
f'--device={"sat,auto" if use_sat else "auto"}',
'--tolerance=verypermissive',
'--all',
'--json',

View file

@ -15,6 +15,7 @@ from wk import io, log, std
from wk.cfg.main import KIT_NAME_FULL, KIT_NAME_SHORT
from wk.cfg.ufd import BOOT_ENTRIES, BOOT_FILES, ITEMS, ITEMS_HIDDEN, SOURCES
from wk.exe import run_program
from wk.hw.obj import Disk
from wk.os import linux
@ -395,6 +396,8 @@ def show_selections(args, sources, ufd_dev, ufd_sources):
def update_boot_entries():
"""Update boot files for UFD usage"""
configs = []
ufd = Disk('/mnt/UFD')
uuid = ufd.details.get('uuid')
# Find config files
for c_path, c_ext in BOOT_FILES.items():
@ -403,12 +406,12 @@ def update_boot_entries():
if item.name.lower().endswith(c_ext.lower()):
configs.append(item.path)
# Update Linux labels
# Use UUID instead of label
cmd = [
'sed',
'--in-place',
'--regexp-extended',
f's/(eSysRescueLiveCD|{ISO_LABEL})/{UFD_LABEL}/',
f's#archisolabel={ISO_LABEL}#archisodevice=/dev/disk/by-uuid/{uuid}#',
*configs,
]
run_program(cmd)

View file

@ -333,6 +333,39 @@ function install_deps() {
run_elevated pacman -Syu --needed --noconfirm $packages
}
function build_all() {
if [[ "$EUID" -ne 0 ]]; then
echo "This section is meant to be run as root."
echo "Aborted."
exit 1
fi
# Prep for build
cleanup
fix_kit_permissions
install_deps
load_settings --edit
update_repo
# Build (full)
copy_live_env
update_live_env
# Rerun script as root to start Archiso build process
run_elevated "$(realpath "$0")" --build-iso
# Cleanup
mv -nv "$LIVE_DIR" "${LIVE_DIR}.full"
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Full-\2/" "$OUT_DIR"/*
# Build (minimal)
copy_live_env --minimal
update_live_env --minimal
# Rerun script as root to start Archiso build process
run_elevated "$(realpath "$0")" --build-iso
# Cleanup
mv -nv "$LIVE_DIR" "${LIVE_DIR}.minimal"
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Minimal-\2/" "$OUT_DIR"/*
}
function build_iso() {
if [[ "$EUID" -ne 0 ]]; then
echo "This section is meant to be run as root."
@ -369,37 +402,6 @@ function build_iso() {
chown $REAL_USER:$REAL_USER "$OUT_DIR" -R
}
function build_all() {
if [[ "$EUID" -eq 0 ]]; then
echo "This section not meant to be run as root."
echo "Aborted."
exit 1
fi
# Prep for build (full)
cleanup
fix_kit_permissions
install_deps
load_settings --edit
update_repo
copy_live_env
update_live_env
# Rerun script as root to start Archiso build process
run_elevated "$(realpath "$0")" --build-iso
# Cleanup
mv -nv "$LIVE_DIR" "${LIVE_DIR}.full"
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Full-\2/" "$OUT_DIR"/*
# Prep for build (minimal)
copy_live_env --minimal
update_live_env --minimal
# Rerun script as root to start Archiso build process
run_elevated "$(realpath "$0")" --build-iso
# Cleanup
mv -nv "$LIVE_DIR" "${LIVE_DIR}.minimal"
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Minimal-\2/" "$OUT_DIR"/*
}
function build_full() {
if [[ "$EUID" -eq 0 ]]; then
echo "This section not meant to be run as root."
@ -417,6 +419,29 @@ function build_full() {
update_live_env
# Rerun script as root to start Archiso build process
run_elevated "$(realpath "$0")" --build-iso
# Cleanup
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Full-\2/" "$OUT_DIR"/*
}
function build_minimal() {
if [[ "$EUID" -eq 0 ]]; then
echo "This section not meant to be run as root."
echo "Aborted."
exit 1
fi
# Prep for build
cleanup
fix_kit_permissions
install_deps
load_settings --edit
update_repo
copy_live_env --minimal
update_live_env --minimal
# Rerun script as root to start Archiso build process
run_elevated "$(realpath "$0")" --build-iso
# Cleanup
perl-rename -v "s/(${KIT_NAME_SHORT}-Linux)-(${DATE}.*)/\1-Minimal-\2/" "$OUT_DIR"/*
}
# Check input
@ -472,12 +497,13 @@ case ${1:-} in
echo "Options:"
echo " -a --build-all Perform all tasks to build all isos"
echo " -b --build-full Perform all tasks to build the full iso"
echo " -m --build-minimal Perform all tasks to build the minimal iso"
echo " -h --help Show usage"
echo ""
echo "Advanced options:"
echo " -f --fix-perms Fix folder permissions"
echo " -i --install-deps Install build dependencies"
echo " -m --prep-minimal-env Prep live & airootfs folders (minimal packages)"
echo " -n --prep-minimal-env Prep live & airootfs folders (minimal packages)"
echo " -o --build-iso Build ISO (using current setup)"
echo " -p --prep-live-env Prep live & airootfs folders"
echo " -u --update-repo Update custom pacman repo"