1
1
#! /bin/bash
2
2
3
- VERSION=1.7
3
+ VERSION=1.7.1
4
+ # Version 1.7.1 2017/08/19
5
+ # * Bugfix: did not set SRC_ROOT when using -s option
4
6
# Version 1.7 2017/08/19
5
7
# * For cloning from USB boots, source disk is booted disk from mtab instead
6
8
# of hardwiring mmcblk0. Add -s option to override the auto source disk.
@@ -84,6 +86,7 @@ usage()
84
86
echo " -f - force initialize the destination partitions"
85
87
echo " -s sdS - specify sdS is the booted source disk to clone from."
86
88
echo " Use this if the boot source auto detect from /etc/mtab fails."
89
+ echo " Use with caution, be sure sdS is really the booted disk."
87
90
echo " -c - cross filesystem boundaries (include mounted drives)"
88
91
echo " -x - use set -x for very verbose bash shell script debugging"
89
92
echo " "
@@ -92,7 +95,7 @@ usage()
92
95
echo " The booted disk is automatically determined from /etc/mtab."
93
96
echo " Example: $PGM -s sda sdb"
94
97
echo " Use sda as the booted source disk to clone from."
95
- echo " Use this if the auto detect of the booted sda disk fails"
98
+ echo " Use this if the auto detect of the booted sda disk fails. "
96
99
echo " "
97
100
echo " Clone (rsync) a running Raspberry Pi file system to a destination"
98
101
echo " SD card (in a USB card reader) or USB disk 'sdN' plugged into a"
150
153
-s|--src-disk)
151
154
shift
152
155
SRC_DISK=$1
156
+ if [ " $SRC_DISK " == " mmcblk0" ]
157
+ then
158
+ SRC_ROOT=${SRC_DISK} p2
159
+ else
160
+ SRC_ROOT=${SRC_DISK} 2
161
+ fi
153
162
;;
154
163
-x)
155
164
set -x
172
181
SRC_BOOT_PARTITION_TYPE=` parted /dev/$SRC_DISK -ms p | grep " ^1" | cut -f 5 -d:`
173
182
SRC_ROOT_PARTITION_TYPE=` parted /dev/$SRC_DISK -ms p | grep " ^2" | cut -f 5 -d:`
174
183
175
- # echo $SRC_DISK to $DST_DISK
184
+ # echo $SRC_DISK to $DST_DISK SRC_ROOT: $SRC_ROOT
176
185
# echo $SRC_BOOT_PARTITION_TYPE
177
186
# echo $SRC_ROOT_PARTITION_TYPE
178
187
0 commit comments