prepare a first integration of usody-sanitize
in session with cayo we see this just works for Monday
This commit is contained in:
parent
efe028aea1
commit
9aa156628b
15
Makefile
15
Makefile
|
@ -44,6 +44,21 @@ boot_iso_uefi_secureboot:
|
|||
-drive file=deploy/iso/workbench_debug.iso,cache=none,if=virtio,format=raw,index=0,media=disk \
|
||||
-boot menu=on
|
||||
|
||||
test_usody_sanitize:
|
||||
# TODO adapt settings accordingly for this test
|
||||
# ERASE=y ./deploy-workbench.sh
|
||||
# create 3 disks for testing
|
||||
qemu-img create -f raw test_sanitize_disk1.img 1G
|
||||
qemu-img create -f raw test_sanitize_disk2.img 1G
|
||||
qemu-img create -f raw test_sanitize_disk3.img 1G
|
||||
sudo qemu-system-x86_64 \
|
||||
-enable-kvm -m 2G -vga qxl -netdev user,id=wan -device virtio-net,netdev=wan,id=nic1 \
|
||||
-drive format=raw,file=iso/workbench_debug.iso,cache=none,if=virtio \
|
||||
-drive format=raw,file=test_sanitize_disk1.img,cache=none,if=virtio \
|
||||
-drive format=raw,file=test_sanitize_disk2.img,cache=none,if=virtio \
|
||||
-drive format=raw,file=test_sanitize_disk3.img,cache=none,if=virtio
|
||||
|
||||
|
||||
es_gen_po:
|
||||
cp locale/es/LC_MESSAGES/messages.po locale/es/LC_MESSAGES/messages.pot.bak
|
||||
pygettext3 -p locale/es/LC_MESSAGES/ workbench-script.py
|
||||
|
|
|
@ -264,6 +264,8 @@ prepare_app() {
|
|||
|
||||
# startup script execution
|
||||
cat > "${ISO_PATH}/chroot/root/.profile" <<END
|
||||
# pipx path for usody-sanitize
|
||||
PATH="${PATH}:/root/.local/bin"
|
||||
if [ -f /tmp/workbench_lock ]; then
|
||||
return 0
|
||||
else
|
||||
|
@ -304,14 +306,16 @@ echo 'Install requirements'
|
|||
apt-get install -y --no-install-recommends \
|
||||
sudo locales \
|
||||
python-is-python3 python3 python3-dev python3-pip pipenv \
|
||||
dmidecode smartmontools hwinfo pciutils lshw nfs-common < /dev/null
|
||||
dmidecode smartmontools hwinfo pciutils lshw nfs-common pipx < /dev/null
|
||||
|
||||
pipx install usody-sanitize
|
||||
|
||||
# Install lshw B02.19 utility using backports (DEPRECATED in Debian 12)
|
||||
#apt install -y -t ${VERSION_CODENAME}-backports lshw < /dev/null
|
||||
|
||||
echo 'Install sanitize requirements'
|
||||
echo 'Install usody-sanitize requirements'
|
||||
|
||||
# Install sanitize debian requirements
|
||||
# Install usody-sanitize debian requirements
|
||||
apt-get install -y --no-install-recommends \
|
||||
hdparm nvme-cli < /dev/null
|
||||
|
||||
|
|
|
@ -75,6 +75,14 @@ SNAPSHOT_BASE = {
|
|||
|
||||
## Command Functions ##
|
||||
|
||||
@logs
|
||||
def get_disks():
|
||||
disks = json.loads(
|
||||
exec_cmd('lsblk -Jdo NAME,TYPE,MOUNTPOINTS,ROTA,TRAN')
|
||||
)
|
||||
return disks.get('blockdevices', [])
|
||||
|
||||
|
||||
@logs
|
||||
def gen_erase(type_erase, user_disk=None):
|
||||
if user_disk:
|
||||
|
@ -280,12 +288,13 @@ def main():
|
|||
if os.geteuid() != 0:
|
||||
logger.warning(_("This script must be run as root. Collected data will be incomplete or unusable"))
|
||||
|
||||
all_disks = get_disks()
|
||||
snapshot = gen_snapshot(all_disks)
|
||||
|
||||
if config.get("legacy")
|
||||
if config.get("legacy"):
|
||||
convert_to_legacy_snapshot(snapshot)
|
||||
else:
|
||||
snapshot['erase'] = gen_erase(config['erase'].upper(), user_disk=config['device'])
|
||||
snapshot['erase'] = gen_erase(config['erase'], user_disk=config['device'])
|
||||
|
||||
save_snapshot_in_disk(snapshot, config['path'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue