From db775e408e259af7228b6b0f5b1eeddb87e60b46 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 16 Jun 2019 17:22:43 -0400 Subject: ob-buildopk: Use ${HAVE_TOUCH_NODEREF} --- diff --git a/src/ob-buildopk.sh b/src/ob-buildopk.sh index 9c318a3..1bf53a2 100644 --- a/src/ob-buildopk.sh +++ b/src/ob-buildopk.sh @@ -27,14 +27,27 @@ build_opk() local plat="${4}" local date="${5}" shift 5 + local find_not_link= + local touch_noderef= ob_info "$(ob_get_msg 'build_opk')" \ "${binary}_${version}_${arch}_${plat}.opk" - find "${binary}.control" "${binary}.data" | xargs ${TOUCH} -d "${date}" + # Don't dereference symbolic links. They might be absolute paths, and + # we don't want to attempt to affect the system on which we're building. + # Also, we want to set the mtimes of the links themselves, if possible. + if ${HAVE_TOUCH_NODEREF}; then + find_not_link='' touch_noderef='-h' + else + find_not_link='! -type l' touch_noderef='' + fi + find "${binary}.control" "${binary}.data" ${find_not_link} | xargs \ + ${TOUCH} ${touch_noderef} -d "${date}" + # This utility runs with (fake) privileges, so we can chown what we're # about to tar. find "${binary}.control" "${binary}.data" | xargs chown 0:0 + (cd -- "${binary}.control" && find '.' \! -type d | LC_ALL=C sort | \ tar -czf '../control.tar.gz' -T -) (cd -- "${binary}.data" && find '.' \! -type d | LC_ALL=C sort | \ -- cgit v0.9.1