Advertisement
teknoraver

submit_nvme

Aug 25th, 2018
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.55 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. which nvme 2>/dev/null >/dev/null ||
  4.     exec echo 'nvme binary not found, do you have the nvme-cli package?'
  5.  
  6. [ "$USER" = root ] || exec echo "unfortunately $0 needs root privileges to run"
  7.  
  8. # be nice with the database, avoid duplicates please
  9. id=$(sha1sum /etc/machine-id |cut -c4-35)
  10.  
  11. for n in /dev/nvme?; do
  12.     nvme id-ctrl --raw-binary $n 2>/dev/null >/tmp/id-ctrl-$$ &&
  13.         curl -F type=nvme \
  14.             -F "machine_id=$id" \
  15.             -F file=@/tmp/id-ctrl-$$ \
  16.             https://staging.fwupd.org/lvfs/upload_hwinfo
  17.     echo
  18. done
  19.  
  20. rm -f /tmp/id-ctrl-$$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement