Skip to content

Instantly share code, notes, and snippets.

@alfondotnet
Created March 29, 2021 00:51
Show Gist options
  • Save alfondotnet/d239ad9f2fe2af3b2e2b101ecf2d69af to your computer and use it in GitHub Desktop.
Save alfondotnet/d239ad9f2fe2af3b2e2b101ecf2d69af to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script by @xorinox in Chia's keybcase
pdp="/chia/plots/disk*"
i=1
for dp in $(/usr/bin/find $pdp -maxdepth 0 -type d); do
id=$(basename $dp)
ret=$(/bin/lsblk |/usr/bin/grep "$dp")
if [ $? -ne 0 ]; then
/usr/sbin/findfs LABEL="$id" &>/dev/null
if [ $? -eq 0 ]; then
/bin/mount -L "$id" "$dp"
fi
else
plot_file=$(/usr/bin/find $dp -iname "plot*.plot" |/usr/bin/sort -R |head -1)
if [ -f "$plot_file" ]; then
hex=$((16#$(/usr/bin/xxd -p -l1 -s $RANDOM $plot_file)))
echo $hex
fi
fi
i=$((i+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment