Lines 148-153
Link Here
|
148 |
return 1; |
148 |
return 1; |
149 |
fi |
149 |
fi |
150 |
|
150 |
|
|
|
151 |
case ${EBUILD_PHASE} in |
152 |
unpack|compile|test|install) |
153 |
eerror "docert cannot be called in ${EBUILD_PHASE}" |
154 |
return 1 ;; |
155 |
esac |
156 |
|
151 |
# Initialize configuration |
157 |
# Initialize configuration |
152 |
gen_cnf || return 1 |
158 |
gen_cnf || return 1 |
153 |
echo |
159 |
echo |
Lines 160-176
Link Here
|
160 |
|
166 |
|
161 |
local count=0 |
167 |
local count=0 |
162 |
for cert in "$@" ; do |
168 |
for cert in "$@" ; do |
163 |
# Sanitize and check the requested certificate |
169 |
# Check the requested certificate |
164 |
cert="`/usr/bin/basename "${cert}"`" |
170 |
if [ -z "${cert##*/}" ] ; then |
165 |
if [ -z "${cert}" ] ; then |
|
|
166 |
ewarn "Invalid certification requested, skipping" |
171 |
ewarn "Invalid certification requested, skipping" |
167 |
continue |
172 |
continue |
168 |
fi |
173 |
fi |
169 |
|
174 |
|
170 |
# Check for previous existence of generated files |
175 |
# Check for previous existence of generated files |
171 |
for type in key crt pem ; do |
176 |
for type in key crt pem ; do |
172 |
if [ -e "${D}${INSDESTTREE}/${cert}.${type}" ] ; then |
177 |
if [ -e "${ROOT}${cert}.${type}" ] ; then |
173 |
ewarn "${D}${INSDESTTREE}/${cert}.${type}: exists, skipping" |
178 |
ewarn "${ROOT}${cert}.${type}: exists, skipping" |
174 |
continue 2 |
179 |
continue 2 |
175 |
fi |
180 |
fi |
176 |
done |
181 |
done |
Lines 184-197
Link Here
|
184 |
|
189 |
|
185 |
# Install the generated files and set sane permissions |
190 |
# Install the generated files and set sane permissions |
186 |
local base=`get_base` |
191 |
local base=`get_base` |
187 |
newins "${base}.key" "${cert}.key" |
192 |
install -d "${ROOT}${cert%/*}" |
188 |
fperms 0400 "${INSDESTTREE}/${cert}.key" |
193 |
install -m0400 "${base}.key" "${ROOT}${cert}.key" |
189 |
newins "${base}.csr" "${cert}.csr" |
194 |
install -m0444 "${base}.csr" "${ROOT}${cert}.csr" |
190 |
fperms 0444 "${INSDESTTREE}/${cert}.csr" |
195 |
install -m0444 "${base}.crt" "${ROOT}${cert}.crt" |
191 |
newins "${base}.crt" "${cert}.crt" |
196 |
install -m0400 "${base}.pem" "${ROOT}${cert}.pem" |
192 |
fperms 0444 "${INSDESTTREE}/${cert}.crt" |
|
|
193 |
newins "${base}.pem" "${cert}.pem" |
194 |
fperms 0400 "${INSDESTTREE}/${cert}.pem" |
195 |
count=$((${count}+1)) |
197 |
count=$((${count}+1)) |
196 |
done |
198 |
done |
197 |
|
199 |
|