-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathdefault-permissions
executable file
·53 lines (43 loc) · 1.6 KB
/
default-permissions
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
#!/usr/bin/env bash
#
# set-def-perms v1.0
#
# Set default permission bits on all filesystem entries within the project
#
# Written By: Derek Callaway [decal {AT} sdf {D0T} org]
# Tested On: Kali GNU/Linux Rolling
# Last Modified: Thu Oct 27 00:44:53 EDT 2016
#
# configurable settings that probably shouldn't be changed
readonly WRDLS_MDRDM='README.md'
readonly WRDLS_COLOR='scripts/colors'
readonly WRDLS_COUNT=4
readonly WRDLS_OWNER=( [ $USER ] && $USER || $LOGNAME )
readonly WRDLS_GROUP=staff
# descend the tree until the werdlists project README.md file is recognized
until [ -f $WRDLS_MDRDM ]
do set n=$(( n + 1 ))
if [[ $n -ge $WRDLS_COUNT ]]
then (echo "${redf}$0${reset}${boldon}:${reset} ${yellowf}Unable to find file .. ${reset}${blackf}${yellowb}${WRDLS_MDRDM}${reset}" 1>&2) &<1-
exit 1
else
cd ..
fi
done
[ -f $WRDLS_COLOR ] && source -- $WRDLS_COLOR
echo -ne "\n${invon}"
chown -Rv ${WRDLS_OWNER}:${WRDLS_GROUP} ./*
echo -e "${reset}\n"
# avoid the hidden ".git" repository directory
echo -ne "\n${redf}"
nice find . -type d -not -iname '.*' -exec chmod -v =0750 {} \;
echo -ne "\n${reset}${white}"
nice find . -type f \( -iname '*.txt' -o -iname '*.csv' -o -iname '*.xml' -o -iname '*.xz' -o -iname '*.yml' -o -iname '*.html' -o -iname '*.htm' -o -iname '*.md' \) -exec chmod -v =0640 {} \;
echo -ne "\n${reset}${greenf}"
nice find . -type f -iname '*.bin' -exec chmod -v =0440 {} \;
echo -ne "\n${reset}${cyanf}"
nice find . -type f -iname '*.lst' -exec chmod -v =0640 {} \;
echo -ne "\n${reset}${greenf}"
nice find scripts -type f -exec chmod -v =0750 {} \;
echo -e "${reset}"
exit 0