aboutsummaryrefslogtreecommitdiffstats
path: root/init-sh/file_perm.sh
blob: be834b7747975e2cb2d7118c78013fe23dd3771f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

IFS="
"

echo -n "Setting files permissions : "

for line in `cat /$1`; do
	file=`echo ${line} | awk '{print $1}'`
	owner=`echo ${line} | awk '{print $2}'`
	perm=`echo ${line} | awk '{print $3}'` 
	
	if [ -a "${file}" ]; then
		if [ ${owner} != "current" ]; then
			chown ${owner} ${file}
		fi
		chmod ${perm} ${file}
	fi
done

echo "done."