]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/nslu2-binary-only/unslung-rootfs/slingover
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / nslu2-binary-only / unslung-rootfs / slingover
1 #!/bin/sh
2
3 usage="Usage: $0 disk1|disk2"
4
5 if [ $# -gt 1 ] ; then
6     echo $usage
7     exit 1
8 fi
9
10 if [ $# -lt 1 ] ; then
11     echo $usage
12     exit 1
13 fi
14
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
21 else
22         echo $usage
23         exit 1
24 fi
25
26 # Check it's a real mount point
27
28 if grep $source /proc/mounts >/dev/null 2>&1 ; then
29     echo "Source disk is $source"
30 else
31     echo "Error: $source is not a mounted disk"
32     exit 1
33 fi
34
35 if grep $target /proc/mounts >/dev/null 2>&1 ; then
36     echo "Target disk is $target"
37 else
38     echo "Error: $target is not a mounted disk"
39     exit 1
40 fi
41
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."
45         rm -f $target/opt
46         mv $target/opt.old $target/opt
47     fi
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
52 fi
53
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
59     fi
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
64 fi
65
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
71 fi
72
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
76 fi
77
78 if [ -f $target/opt/bin/bash ] ; then
79     echo "Replicating /bin/bash symlink."
80     ln -s /opt/bin/bash $target/bin/bash
81 fi
82
83 exit 0