blob: 24fe2b5965153b2392119b7c2565299fb0bd87c8 [file] [log] [blame]
Tomáš Levoraf0c81b02018-12-20 09:45:02 +01001#!/bin/bash
2
3# COPYRIGHT NOTICE STARTS HERE
4#
5# Copyright 2018 © Samsung Electronics Co., Ltd.
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18#
19# COPYRIGHT NOTICE ENDS HERE
20
21
22usage () {
23 echo "Usage:"
24 echo " ./$(basename $0) node1_ip node2_ip ... nodeN_ip"
25 exit 1
26}
27
28if [ "$#" -lt 1 ]; then
29 echo "Missing NFS slave nodes"
30 usage
31fi
32
33#Install NFS kernel
34#sudo apt-get update
35#sudo apt-get install -y nfs-kernel-server
36
37#Create /dockerdata-nfs and set permissions
38sudo mkdir -p /dockerdata-nfs
39sudo chmod 777 -R /dockerdata-nfs
40sudo chown nobody:nobody /dockerdata-nfs/
41
42#Update the /etc/exports
43NFS_EXP=""
44for i in $@; do
45 NFS_EXP+="$i(rw,sync,no_root_squash,no_subtree_check) "
46done
47echo "/dockerdata-nfs "$NFS_EXP | sudo tee -a /etc/exports
48
49#Restart the NFS service
50sudo exportfs -a
51sudo systemctl restart nfs-server