1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| create_user_tree {
user = $1
mkdir -p /user/$user
#copy over the entire mount tree under /user/$user
mount --rbind / /user/$user
make --make-rslave /user/$user
make --make-rshared /user/$user
cd /user/$user/home/$user
#export my shared exports
mkdir -p my_shared_exports
chown $user my_shared_exports
mount --bind my_shared_exports my_shared_exports
mount --make-private my_shared_exports
mount --make-shared my_shared_exports
mkdir -p /user/share_tree/$user
mount --bind my_shared_exports /user/share_tree/$user
#export my slave exports
mkdir -p my_slave_exports
chown $user my_slave_exports
mount --bind my_slave_exports my_slave_exports
mount --make-private my_slave_exports
mount --make-shared my_slave_exports
mkdir -p /user/slave_tree/$user
mount --bind my_slave_exports /user/slave_tree/$user
cd /user/$user
#import everybody's shared exports
mkdir -p others_shared_exports
mount --rbind /user/share_tree others_shared_exports
#import everybody's slave exports
mkdir -p others_slave_exports
mount --rbind /user/slave_tree others_slave_exports
mount --make-rslave others_slave_exports
#setup a private mount in the user's tree, This is to facilitate
# pivot_mount executed later, during new user-logins.
mkdir -p __my_private_mnt__
mount --bind __my_private_mnt__ __my_private_mnt__
mount --make-private __my_private_mnt__
}
|