aboutsummaryrefslogtreecommitdiffstats
path: root/cyclone.sh
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-05-16 12:44:09 +0300
committerFilipp Lepalaan <filipp@mac.com>2011-05-16 12:44:09 +0300
commit8e73071f6a1790ded27184f7702f1b4d8b092847 (patch)
treec54f8ccd17cdacd407264257f60f94f68e806794 /cyclone.sh
parent35a2edf8b277206b04528a72ab89fe9dddcd3459 (diff)
downloadmtk-8e73071f6a1790ded27184f7702f1b4d8b092847.tar.gz
mtk-8e73071f6a1790ded27184f7702f1b4d8b092847.tar.bz2
mtk-8e73071f6a1790ded27184f7702f1b4d8b092847.zip
up2date fixed
Diffstat (limited to 'cyclone.sh')
-rwxr-xr-xcyclone.sh20
1 files changed, 10 insertions, 10 deletions
diff --git a/cyclone.sh b/cyclone.sh
index 282904d..8744bc8 100755
--- a/cyclone.sh
+++ b/cyclone.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
-# clone all partitions of a drive
-# and try not to waste space
+# clone all partitions of a drive and try not to waste space
# @author Filipp Lepalaan <filipp@mcare.fi>
+# @package mtk
if [[ $USER != "root" ]]; then
echo "Insufficient privileges!" 2>&1
@@ -27,27 +27,27 @@ TMPFILE="/tmp/$(uuidgen)"
trap "killall dd; rm ${TMPFILE}; echo 'Cleaning up...'; exit 255" SIGINT SIGTERM
# Get size of source
-diskutil info -plist $SOURCE > "${TMPFILE}".plist
+/usr/sbin/diskutil info -plist $SOURCE > "${TMPFILE}".plist
SOURCE_SIZE=`defaults read $TMPFILE TotalSize`
# Get size of destination
-diskutil info -plist $TARGET > $TMPFILE
+/usr/sbin/diskutil info -plist $TARGET > $TMPFILE
TARGET_SIZE=`defaults read $TMPFILE TotalSize`
rm $TMPFILE
if [[ $TARGET_SIZE == $SOURCE_SIZE ]]; then
echo "Sizes are identical, cloning with dd..."
- diskutil quiet unmountDisk $SOURCE
- diskutil quiet unmountDisk $TARGET
- dd bs=16m if="/dev/r${SOURCE}" of="/dev/r${TARGET}" conv=noerror,sync &
+ /usr/sbin/diskutil quiet unmountDisk $SOURCE
+ /usr/sbin/diskutil quiet unmountDisk $TARGET
+ /bin/dd bs=16m if="/dev/r${SOURCE}" of="/dev/r${TARGET}" conv=noerror,sync &
DD_PID=$!
# while dd is running...
while [[ ps -ax | egrep -q -m 1 " ${DD_PID} " ]]; do
sleep 1
- kill -SIGINFO $DD_PID
+ /bin/kill -SIGINFO $DD_PID
done
- diskutil quiet mountDisk $SOURCE
- diskutil quiet mountDisk $TARGET
+ /usr/sbin/diskutil quiet mountDisk $SOURCE
+ /usr/sbin/diskutil quiet mountDisk $TARGET
exit 0
fi