summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ob-buildopk.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/ob-buildopk.sh b/src/ob-buildopk.sh
index dc630d1..1e661cc 100644
--- a/src/ob-buildopk.sh
+++ b/src/ob-buildopk.sh
@@ -29,6 +29,7 @@ build_opk()
shift 5
local find_not_link=
local touch_noderef=
+ local sort_r=
ob_info "$(ob_get_msg 'build_opk')" \
"${binary}_${version}_${arch}_${plat}.opk"
@@ -41,6 +42,19 @@ build_opk()
else
find_not_link='! -type l' touch_noderef=''
fi
+
+ # Detect whether BusyBox tar inserts files listed with -T in reverse
+ # order.
+ mkdir -p '.opkbuild'
+ touch '.opkbuild/a' '.opkbuild/b'
+ if [ x"$(printf '.opkbuild/a\n.opkbuild/b\n' | ${TAR} -c -T - | \
+ ${TAR} -t | head -n 1)" = x'b' ]; then
+ sort_r='-r'
+ else
+ sort_r=''
+ fi
+ rm -f '.opkbuild/a' '.opkbuild/b'
+
find "${binary}.control" "${binary}.data" ${find_not_link} | xargs \
${TOUCH} ${touch_noderef} -t "${date}"
@@ -48,9 +62,9 @@ build_opk()
# about to tar.
find "${binary}.control" "${binary}.data" | xargs chown -h 0:0
- (cd -- "${binary}.control" && find '.' | LC_ALL=C sort | \
+ (cd -- "${binary}.control" && find '.' | LC_ALL=C sort ${sort_r} | \
${TAR} -cf '../control.tar' --no-recursion -T -)
- (cd -- "${binary}.data" && find '.' | LC_ALL=C sort | \
+ (cd -- "${binary}.data" && find '.' | LC_ALL=C sort ${sort_r} | \
${TAR} -cf '../data.tar' --no-recursion -T -)
${TOUCH} -t "${date}" 'control.tar' 'data.tar'
${GZIP} 'control.tar' 'data.tar'