View | Details | Raw Unified | Return to bug 205280 | Differences between
and this patch

Collapse All | Expand All

(-)Mk/Scripts/check-stagedir.sh (-4 / +37 lines)
Lines 95-101 Link Here
95
	sed_files_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} \
95
	sed_files_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} \
96
	    ${sed_portdocsexamples} /^share\/licenses/d; \
96
	    ${sed_portdocsexamples} /^share\/licenses/d; \
97
	    \#${LOCALBASE}/lib/debug#d;"
97
	    \#${LOCALBASE}/lib/debug#d;"
98
	sed_dirs_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} s,^,@dir ,; \
98
	sed_dirs_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} s,^([^@]),@dir \1,; \
99
	    ${sed_portdocsexamples} \
99
	    ${sed_portdocsexamples} \
100
	    /^@dir share\/licenses/d;"
100
	    /^@dir share\/licenses/d;"
101
101
Lines 107-112 Link Here
107
107
108
}
108
}
109
109
110
plist_add_creds() {
111
	local dir=$1
112
	local usr_deft=$2
113
	local grp_deft=$3
114
	local usr=$usr_deft
115
	local grp=$grp_deft
116
	while read file; do
117
	  local u=$(stat -f %Su "$dir/$file")
118
	  local g=$(stat -f %Sg "$dir/$file")
119
	  if [ $u != $usr ]; then
120
	    usr=$u
121
	    if [ $usr != $usr_deft ]; then
122
	      echo "@owner $usr"
123
	    else
124
	      echo "@owner"
125
	    fi
126
	  fi
127
	  if [ $g != $grp ]; then
128
	    grp=$g
129
	    if [ $grp != $grp_deft ]; then
130
	      echo "@group $grp"
131
	    else
132
	      echo "@group"
133
	    fi
134
	  fi
135
	  echo $file
136
	done
137
}
138
110
# Generate plist from staged files
139
# Generate plist from staged files
111
generate_plist() {
140
generate_plist() {
112
	: >${WRKDIR}/.staged-plist
141
	: >${WRKDIR}/.staged-plist
Lines 115-121 Link Here
115
	find ${STAGEDIR} -type f -o -type l | sort | \
144
	find ${STAGEDIR} -type f -o -type l | sort | \
116
	    sed -e "s,${STAGEDIR},," >${WRKDIR}/.staged-files
145
	    sed -e "s,${STAGEDIR},," >${WRKDIR}/.staged-files
117
	comm -13 ${WRKDIR}/.plist-files ${WRKDIR}/.staged-files | \
146
	comm -13 ${WRKDIR}/.plist-files ${WRKDIR}/.staged-files | \
118
	    sed -e "${sed_files_gen}" \
147
	    plist_add_creds ${STAGEDIR} root wheel 0660 | \
148
	    sed -e "${sed_files_gen}" | \
149
	    sed -E 's/^(.+\.sample)$/@sample \1/'
119
	     >>${WRKDIR}/.staged-plist || :
150
	     >>${WRKDIR}/.staged-plist || :
120
151
121
	### HANDLE DIRS
152
	### HANDLE DIRS
Lines 131-138 Link Here
131
	awk '{print FNR, $0}' ${WRKDIR}/.staged-dirs-dfs \
162
	awk '{print FNR, $0}' ${WRKDIR}/.staged-dirs-dfs \
132
	    >${WRKDIR}/.staged-dirs-dfs-sorted
163
	    >${WRKDIR}/.staged-dirs-dfs-sorted
133
	# Find all staged dirs and then sort them by depth-first (find -ds)
164
	# Find all staged dirs and then sort them by depth-first (find -ds)
134
	comm -13 ${WRKDIR}/.traced-dirs ${WRKDIR}/.staged-dirs-sorted \
165
	comm -13 ${WRKDIR}/.traced-dirs ${WRKDIR}/.staged-dirs-sorted | \
135
	    | sort_dfs | sed "${sed_dirs_gen}" \
166
	    sort_dfs | \
167
	    plist_add_creds ${STAGEDIR} root wheel 0660 | \
168
	    sed -E "${sed_dirs_gen}" \
136
	    >>${WRKDIR}/.staged-plist || :
169
	    >>${WRKDIR}/.staged-plist || :
137
}
170
}
138
171

Return to bug 205280