diff --git a/silverblue-base/Containerfile b/silverblue-base/Containerfile index fec9c83..02a6fd2 100644 --- a/silverblue-base/Containerfile +++ b/silverblue-base/Containerfile @@ -41,5 +41,18 @@ RUN cd /etc/yum.repos.d/ && curl -LO https://pkgs.tailscale.com/stable/fedora/ta # Add tcpping for convenience ADD files/tcpping /usr/bin/tcpping + +## REMOVE!!! +ADD fix-samsung-usb.sh /usr/bin/fix-samsung-usb.sh +RUN export KERNEL_VERSION="$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" && \ + mkdir -p /var/tmp/dracut /var/roothome && \ + dracut --reproducible -v --add 'ostree' --tmpdir '/var/tmp/dracut' -f --no-hostonly --kver "${KERNEL_VERSION}" && \ + mv -v "/lib/modules/${KERNEL_VERSION}/initramfs.img" "/lib/modules/${KERNEL_VERSION}/initramfs.orig.img" && \ + mv -v /boot/initramfs*.img "/lib/modules/${KERNEL_VERSION}/initramfs.img" && \ + # cleanup and verification stage + rm -vrf /var && \ + ostree container commit +## REMOVE!!! + RUN echo "Defaults timestamp_timeout=1200" > /etc/sudoers.d/timeout && \ chmod 660 /etc/sudoers.d/timeout diff --git a/silverblue-base/fix-samsung-usb.sh b/silverblue-base/fix-samsung-usb.sh new file mode 100755 index 0000000..3ddac84 --- /dev/null +++ b/silverblue-base/fix-samsung-usb.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +echo ------------------------------START------------------------------ + +samsung_drive_name="Samsung Flash Drive FIT" + +set -eou pipefail + +echo ------------------------------lsscsi------------------------------ +lsscsi -v 2>/dev/null || : + +echo ------------------------------grep samsung drive------------------------------ +lsscsi -v 2>/dev/null | grep -A 1 "$samsung_drive_name" || : + +echo ------------------------------awk id------------------------------ +lsscsi -v 2>/dev/null | grep -A 1 "$samsung_drive_name" | awk '/\/sys\/devices/ { print $3 }' || : + + + +echo ------------------------------for------------------------------ +for scsiid in $(lsscsi -v 2>/dev/null | grep -A 1 "$samsung_drive_name" | awk '/\/sys\/devices/ { print $3 }' | tr -d '\[' | tr -d '\]'); do + echo ------------------------------second for [$scsiid]------------------------------ + for file in $(find "$scsiid" -name provisioning_mode); do + echo ------------------------------unmap [$file]------------------------------ + echo "before [$file]: $(cat $file)" + echo unmap > "$file" + echo "Fixed $samsung_drive_name: [$scsiid]... Done." + echo "after [$file]: $(cat $file)" + done +done + +echo ------------------------------END------------------------------ diff --git a/silverblue-zfs-base/files/dracut/fix-samsung-usb.sh b/silverblue-zfs-base/files/dracut/fix-samsung-usb.sh index adb3aaa..3ddac84 100755 --- a/silverblue-zfs-base/files/dracut/fix-samsung-usb.sh +++ b/silverblue-zfs-base/files/dracut/fix-samsung-usb.sh @@ -7,13 +7,13 @@ samsung_drive_name="Samsung Flash Drive FIT" set -eou pipefail echo ------------------------------lsscsi------------------------------ -lsscsi -v 2>/dev/null +lsscsi -v 2>/dev/null || : echo ------------------------------grep samsung drive------------------------------ -lsscsi -v 2>/dev/null | grep -A 1 "$samsung_drive_name" +lsscsi -v 2>/dev/null | grep -A 1 "$samsung_drive_name" || : echo ------------------------------awk id------------------------------ -lsscsi -v 2>/dev/null | grep -A 1 "$samsung_drive_name" | awk '/\/sys\/devices/ { print $3 }' +lsscsi -v 2>/dev/null | grep -A 1 "$samsung_drive_name" | awk '/\/sys\/devices/ { print $3 }' || :