Last active
December 27, 2015 20:29
-
-
Save packz/7384674 to your computer and use it in GitHub Desktop.
Do you backup your freepto?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTION=="add", SUBSYSTEM=="block", ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="xxxx", ENV{UDISKS_AUTO}="0", OWNER="packz", SYMLINK+="freepto%n", RUN+="/sbin/freepto.sh %k %n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# I don't know if it is a workaround, but I can't found a udev's rule to | |
# match the main device but not the partitions, so in the programm launched | |
# by udev (i.e. this) I check the partition number and if not empty then we | |
# exit from it | |
DEVNAME="$1" | |
NUM="$2" | |
if [ ! -z "$2" ];then exit;fi | |
SIZE=$(/sbin/blockdev --getsz /dev/$DEVNAME) | |
SIZE=$((${SIZE}*512)) | |
DATE=$(date --iso) | |
BACKUP_FILE=backup-$DATE.img | |
DISPLAY=:0.0 su packz -c "xterm -e \"dd if=/dev/$DEVNAME | pv --size $SIZE | dd of=/2HD/${BACKUP_FILE};echo -en '\n\tcalcolo MD5\n\n';md5sum /2HD/${BACKUP_FILE} /dev/$DEVNAME;echo -n premi un tasto per chiudere;read miao\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment