3 usage="Usage: $0 disk1|disk2"
10 if [ $# -lt 1 ] ; then
15 if [ "$1" = "disk1" ] ; then
16 source=/share/hdd/conf
17 target=/share/hdd/data
18 elif [ "$1" = "disk2" ] ; then
19 source=/share/flash/conf
20 target=/share/flash/data
26 # Check it's a real mount point
28 if grep $source /proc/mounts >/dev/null 2>&1 ; then
29 echo "Source disk is $source"
31 echo "Error: $source is not a mounted disk"
35 if grep $target /proc/mounts >/dev/null 2>&1 ; then
36 echo "Target disk is $target"
38 echo "Error: $target is not a mounted disk"
42 if [ -d $source/opt ] ; then
43 if [ -d $target/opt.old -a -h $target/opt ] ; then
44 echo "Reverting old /opt symlink on $target."
46 mv $target/opt.old $target/opt
48 echo "Copying /opt directory from $source to $target."
49 ( cd $source ; tar cf - opt ) | ( cd $target ; tar xf - )
50 rm -rf $source/opt.old
51 mv $source/opt $source/opt.old
54 if [ -d $source/usr ] ; then
55 if [ -d $target/usr/lib/ipkg.old -a -h $target/usr/lib/ipkg ] ; then
56 echo "Reverting old /usr/lib/ipkg symlink on $target."
57 rm -f $target/usr/lib/ipkg
58 mv $target/usr/lib/ipkg.old $target/usr/lib/ipkg
60 echo "Copying /usr directory from $source to $target."
61 ( cd $source ; tar cf - usr ) | ( cd $target ; tar xf - )
62 rm -rf $source/usr.old
63 mv $source/usr $source/usr.old
66 if [ -d $source/unslung ] ; then
67 echo "Copying /unslung directory from $source to $target."
68 ( cd $source ; tar cf - unslung ) | ( cd $target ; tar xf - )
69 rm -rf $source/unslung.old
70 mv $source/unslung $source/unslung.old
73 if [ -f $target/opt/bin/perl ] ; then
74 echo "Replicating /usr/bin/perl symlink."
75 ln -s /opt/bin/perl $target/usr/bin/perl
78 if [ -f $target/opt/bin/bash ] ; then
79 echo "Replicating /bin/bash symlink."
80 ln -s /opt/bin/bash $target/bin/bash