File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,24 @@ dir_not_empty() {
7878 [ -d " $1 " ] && [ " $( ls -A " $1 " 2> /dev/null) " ]
7979}
8080
81+ set_perm () {
82+ chown " $2 :$3 " " $1 " || return 1
83+ chmod " $4 " " $1 " || return 1
84+ local CON=" $5 "
85+ [ -z " $CON " ] && CON=" u:object_r:system_file:s0"
86+ chcon " $CON " " $1 " || return 1
87+ }
88+
89+ set_perm_recursive () {
90+ find " $1 " -type d -print0 2> /dev/null | while IFS= read -r -d ' ' dir; do
91+ set_perm " $dir " " $2 " " $3 " " $4 " " $6 "
92+ done
93+
94+ find " $1 " \( -type f -o -type l \) -print0 2> /dev/null | while IFS= read -r -d ' ' file; do
95+ set_perm " $file " " $2 " " $3 " " $5 " " $6 "
96+ done
97+ }
98+
8199# ###############################################################################
82100# 核心函数
83101# ###############################################################################
464482 ui_print " 并在 GitHub Issues 反馈"
465483 ui_print " "
466484 exit 1
467- fi
485+ fi
You can’t perform that action at this time.
0 commit comments