Advertisement
kmisterk

Serial Number Modification

Nov 6th, 2020
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. function modify_serial () {
  2. if ! SERIAL_NUMBER=$($VPD_BIN -f $FIRMWARE_FILE -g serial_number >> $LOGDIR/log.txt 2>&1) ; then
  3. die "Unable to capture the Serial Number. Please review the log, then reseat the clip and try again"
  4. fi
  5.  
  6. if ! SERIAL_NUMBER=$(cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w ${#SERIAL_NUMBER} | head -n 1 >> $LOGDIR/log.txt 2>&1) ; then
  7. die "Unable to create new serial. Please review the log and try again."
  8. fi
  9.  
  10. if ! $VPD_BIN -f $FIRMWARE_FILE -s serial_number=$SERIAL_NUMBER >> $LOGDIR/log.txt 2>&1 ; then
  11. die "Serial number failed to write to firmware file. Please review the log and try again."
  12.  
  13. fi
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement