~ubuntu-branches/ubuntu/quantal/aufs/quantal

« back to all changes in this revision

Viewing changes to sample/unionctl

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2008-04-01 18:26:37 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080401182637-ujuqq47eiggw4y5w
Tags: 0+20080401-1
* New upstream snapshot
  - Remove bashisms in script (Closes: #471288)
* debian/conf.mk, linux-patch-aufs.kpatches.sysfs_get_dentry:
  - Remove support for this patch, no longer used
* debian/conf.mk:
  - Add hacks for arm to armel (Closes: #473767)
* debian/control:
  - Add Dm-Upload-Allowed
* debian/copyright:
  - Use http://wiki.debian.org/Proposals/CopyrightFormat
* debian/linux-patch-aufs.kpatches.{splice,put_filp}:
  - Add support for Kernel 2.6.24 (and 2.6.25)
* debian/patches:
  - 01_vserver_apparmor: Update patch
  - 06_rt: Add patch for realtime kernel
  - 07_splice_hack: Add hack to support splice operations (Closes: #473430)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 
19
 
# $Id: unionctl,v 1.1 2007/06/04 02:18:19 sfjro Exp $
 
19
# $Id: unionctl,v 1.2 2008/03/31 07:44:10 sfjro Exp $
20
20
 
21
21
# simple script for controling aufs.
22
22
# compatible with unionctl(8) in unionfs(5).
73
73
 
74
74
test $# -lt 2 && eecho "${me}: bad arg $@" && exit 1
75
75
f=/proc/mounts
76
 
#f=/sys/fs/aufs/brs
77
76
test ! -f $f && eecho "${me}: $f is necessary" && exit 1
78
77
 
79
78
set -e
86
85
action="$2"
87
86
shift 2
88
87
 
89
 
brs=/sys/fs/aufs/brs
90
 
if [ -r $brs ]
91
 
then
92
 
dev=`grep " $e_mntpnt " $brs | tail -n 1 | cut -f1 -d' '`
93
 
test ! "$dev" && eecho "illegal mount-point $mntpnt" && exit 1
94
 
br=`grep " $e_mntpnt " $brs | tail -n 1 | cut -f4 -d' '`
95
 
test -w $brs && >> $brs
96
 
test ! "$br" && eecho "illegal branches $br" && exit 1
97
 
echo "$br" | cut -f2- -d: | tr ':=' '\n ' > $tmp
98
 
else
99
88
tgt=`grep " $e_mntpnt aufs" $f | tail -n 1 | rev | cut -f3- -d' ' | rev`
100
89
test "$tgt" = "" && eecho "${me}: no such mntpnt $mntpnt" && exit 1
101
90
dev=`echo "$tgt" | sed -e 's: '"$mntpnt aufs"' .*$::'`
102
 
branches > $tmp
 
91
 
 
92
sbi=/sys/fs/aufs/sbi
 
93
sbi_dir=
 
94
if [ -r $sbi ]
 
95
then
 
96
        # pay attention to the order in $sbi
 
97
        for id in $(cat $sbi)
 
98
        do
 
99
                d=/sys/fs/aufs/sbi_$id
 
100
                grep -q "^${e_mntpnt}$" $d/mntpnt1 &&
 
101
                sbi_dir=$d &&
 
102
                break
 
103
        done
103
104
fi
 
105
if [ "$sbi_dir" -a -r $sbi_dir/br0 ]
 
106
then
 
107
        cd $sbi_dir
 
108
        ls -1 br* |
 
109
        cut -c3- |
 
110
        sort -n |
 
111
        sed -e 's/^/br/' |
 
112
        while read i
 
113
        do
 
114
                # interpret the escaped characters
 
115
                i=`cat $i`
 
116
                echo $i
 
117
        done |
 
118
        sed -e 's/=/ /'
 
119
        cd $OLDPWD
 
120
else
 
121
        branches
 
122
fi > $tmp
104
123
#cat $tmp | while read i; do echo "$i"; done; #exit
105
124
 
106
125
find_bindex() # dir