-
Notifications
You must be signed in to change notification settings - Fork 0
/
efs
executable file
·73 lines (59 loc) · 1.14 KB
/
efs
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
# Load common functions
file=`realpath $0`
dir=`dirname $file`
source $dir/ecryptfs.sh
# Btrfs commands
help()
{
name=`basename $0`
echo -e "Using ecryptfs over any filesystem"
echo -e "$name ((create|mount|umount) <volpath> | list <path>)"
echo -e "\t create <volpath>:\tcreate new encrypted volume at <volpath>"
echo -e "\t mount <volpath>:\tmount encrypted volume located at <volpath>"
echo -e "\t umount <volpath>:\tumount encrypted volume located at <volpath>"
echo -e "\t list <path>:\tlist encrypted volumes in path"
exit -1
}
create() {
name=`realpath $1`
volume=`getVolume $name`
safe mkdir -p "$volume"
debug "Volume $volume created"
ecryptfs_init $name $volume
}
home() {
arg=$1
name=`realpath $arg`
volume=`getVolume $name`
safe sudo mkdir -p "$volume"
debug "Volume $volume created"
safe sudo chown -R $USER:$USER $volume
ecryptfs_init $name $volume
ecryptfs_home $arg
}
list() {
find $1 -name "*.ecryptfs"
}
cmd=$1
shift
case "$cmd" in
"create")
create $1
;;
"home")
home $1
;;
"mount")
ecryptfs_mount $1
;;
"umount")
ecryptfs_umount $1
;;
"list")
list $1
;;
*)
help
;;
esac