-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path00-nfs.sh
More file actions
41 lines (36 loc) · 1.06 KB
/
00-nfs.sh
File metadata and controls
41 lines (36 loc) · 1.06 KB
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
# devnull@libcrack.so
# lun mar 14 05:30:07 CET 2016
export NFS="/mnt/nfs/${USER}"
export NFS_DIRS=()
nfs-overlay-discover(){
mount | grep -q "${NFS}" || die "Not mounted: ${NFS}"
for i in "${HOME}"/* "${HOME}"/.*; do
if [[ "$i" == "." || "$i" == ".." ]]; then continue; fi
if [[ -h "${i}" && -d "${i}" ]]; then
if [[ "$(realpath "${i}")" =~ "$(dirname "${NFS}")" ]]; then
if [[ ! ${NFS_DIRS[@]} =~ $(basename "${i}") ]]; then
NFS_DIRS="${NFS_DIRS[@]} $(basename "${i}")"
echo "${i}"
fi
fi
fi
done
}
nfs-overlay-enable(){
nfs-overlay-discover
for i in ${NFS_DIRS[@]}; do
if [[ -d "${NFS}/${i}" \
&& ! -e "${HOME}/${i}" ]]; then
ln -s "${NFS}/${i}" "${HOME}/${i}"
fi
done
}
nfs-overlay-disable(){
for i in ${NFS_DIRS[@]}; do
if [[ -h "${i}" && -d "${i}" ]]; then
if [[ "$(realpath "${i}")" =~ "${NFS}" ]]; then
rm "${HOME}/${i}"
fi
fi
done
}