keyboards/zorne/flash.fish

31 lines
625 B
Fish
Raw Normal View History

2021-04-12 16:24:12 -05:00
#!/usr/bin/env fish
test (whoami) != root && begin
echo must be root
exit 1
end
2021-11-08 23:20:01 -06:00
set flash_target /dev/disk/by-label/NICENANO
set firmware_file $argv[1]
2021-04-12 16:24:12 -05:00
mkdir -p /tmp/flashmnt
2021-11-08 23:20:01 -06:00
while not test -L $flash_target
echo Waiting for mountable device $flash_target to become available...
echo " This usually means you need to plugin the board and reset it."
sleep 1
end
echo Mounting $flash_target to /tmp/flashmnt...
mount $flash_target /tmp/flashmnt
echo Copying $firmware_file to /tmp/flashmnt...
cp $firmware_file /tmp/flashmnt
2021-04-12 16:24:12 -05:00
echo Syncing...
sync
2021-11-08 23:20:01 -06:00
2021-04-12 16:24:12 -05:00
echo Unmounting /tmp/flashmnt...
2021-04-12 21:58:25 -05:00
umount -R /tmp/flashmnt
2021-11-08 23:20:01 -06:00
2021-04-12 16:24:12 -05:00
echo Done!