inkstitch/bin/embroider-remote

28 wiersze
802 B
Bash
Executable File

#!/bin/bash
# This tool converts a .CSV file to a .PES file and uploads it to my embroidery
# machine, which is connected to my home server. This way, I can embroider from my
# laptop over my wifi without having to connect the sewing machine to my laptop every
# time.
# /etc/fstab entry: /dev/disk/by-id/usb-B-EMB_USB_RAM_Disk_INST_0-0:0-part1 /mnt/embroidery vfat user,uid=1000,gid=1000,nobootwait,noauto 0 0
HOST=myhomeserver.local
set -e
if [[ "$1" == *.csv ]]; then
pes=$(mktemp /tmp/XXXXXXXXXXX.pes)
libembroidery-convert "$1" "$pes"
file="$pes"
else
file="$1"
fi
cat "$file" | ssh $HOST "
mount /mnt/embroidery &&
rm -f /mnt/embroidery/* &&
cat > /mnt/embroidery/embroidery.pes &&
umount /mnt/embroidery" \
|| echo 'failed to upload embroidery :('