-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·41 lines (31 loc) · 998 Bytes
/
entrypoint.sh
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
#!/bin/bash
set -o nounset
export passwd=$(echo "${1}" | sha256sum | cut -f 1 -d '-' | awk '{gsub(/^ +| +$/,"")} {print $0}')
echo ${passwd} > /etc/default/cryfs_passwd
_setup() {
! [ -d /.exports ] && mkdir -p /.exports
! [ -d /exports ] && mkdir -p /exports
! [ -d /run/sendsigs.omit.d/rpcbind ] && mkdir -p /run/sendsigs.omit.d/rpcbind
useradd cryfs -M
echo "samba123" | tee - | smbpasswd -s -a cryfs
}
cryfs_new() {
yes y | cryfs /.exports /exports --extpass "cat /etc/default/cryfs_passwd" -- -o allow_other
}
cryfs_mount() {
cryfs /.exports /exports --extpass "cat /etc/default/cryfs_passwd" -- -o allow_other
}
_nfs() {
. /etc/default/nfs-kernel-server
. /etc/default/nfs-common
service rpcbind start
service nfs-kernel-server start
}
_cifs() {
service smbd start
}
_setup
! [ -r /.exports/cryfs.config ] && cryfs_new || cryfs_mount
_nfs
_cifs
exec inotifywait --timefmt "%d.%M.%Y %H:%M:%S" --format "[%T] - %w%f [%:e]" -rm /exports