-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix-perms
executable file
·45 lines (30 loc) · 907 Bytes
/
fix-perms
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
#!/bin/bash
# Copyright 2014-2015 Richard Russon (FlatCap)
# Licensed under the GPLv3
PATH="/var/named/bin:/usr/bin:/usr/sbin"
source log.sh
export TZ="UTC"
set -o errexit # set -e
set -o nounset # set -u
renice --priority 19 --pid $$ > /dev/null
ionice --class 3 --pid $$ > /dev/null
shopt -s nullglob
function finish()
{
local RETVAL=$?
[ $RETVAL = 0 ] || log_error "${0##*/} failed: $RETVAL"
}
trap finish EXIT
cd /var/named
[ $# = 0 ] || exit 2
chown --recursive root.named .
[ -d data ] && chown --recursive named.named data
chmod --recursive u+rw,g+rX,o-rwx .
[ -d data ] && chmod --recursive g+w data
[ -d dynamic ] && chmod --recursive g+w dynamic
# .git* may not exist
FILES=(*.git*)
[ -d "$DNSSEC_KEY_DIR" ] && FILES+=("$DNSSEC_KEY_DIR")
[ ${#FILES[@]} -gt 0 ] && chmod --recursive og-rwx bin ${FILES[@]}
chcon --recursive --user system_u --role object_r .
restorecon -r .