#!/bin/bash
# GNU LGPL3 by celeste:crystalfaery 2012-06-11 22:45:20+00:00
# http://www.crystalfaeries.net/posix/bin/ingest
# ingest a CD or DVD and spray its contents into our Downloads folder
# with K3B sitting open in a window, it will show the contents of an audio or video disk,
# so initial implementation is only designed to ingest data formats
pushd ~/Downloads || exit 1
sudo mount -t ext2 /dev/sr0 /media/cdrom \
|| sudo mount -t udf /dev/sr0 /media/cdrom \
|| sudo mount -t ext2 /dev/sr0 /media/cdrom \
cp -r /media/cdrom/* ~/Downloads
normalize # CDs and DVDs often have read-only permissions
rsync -auvzH /media/cdrom/* ~/Downloads
sudo eject /dev/sr0
normalize # CDs and DVDs often have read-only permissions
/usr/local/bin/alert # politely summon the human to change the disk for us :-)
syntax highlighted by Code2HTML, v. 0.9.1