diff --git a/shutils/binpkg.sh b/shutils/binpkg.sh
index 8484e32bb1f..fae005e321b 100644
--- a/shutils/binpkg.sh
+++ b/shutils/binpkg.sh
@@ -110,14 +110,29 @@ xbps_write_metadata_pkg_real()
write_metadata_flist_header $TMPFPLIST
- # First add the regular files.
- for f in $(find -L $destdir -type f); do
+ # Pass 1: add links.
+ for f in $(find $destdir -type l); do
j=$(echo $f|sed -e "$fpattern")
[ "$j" = "" ] && continue
printf "$j\n" >> $TMPFLIST
printf "\n" >> $TMPFPLIST
printf "file\n" >> $TMPFPLIST
printf "$j\n" >> $TMPFPLIST
+ printf "type\n" >> $TMPFPLIST
+ printf "link\n" >> $TMPFPLIST
+ printf "\n" >> $TMPFPLIST
+ done
+
+ # Pass 2: add regular files.
+ for f in $(find $destdir -type f); do
+ j=$(echo $f|sed -e "$fpattern")
+ [ "$j" = "" ] && continue
+ printf "$j\n" >> $TMPFLIST
+ printf "\n" >> $TMPFPLIST
+ printf "file\n" >> $TMPFPLIST
+ printf "$j\n" >> $TMPFPLIST
+ printf "type\n" >> $TMPFPLIST
+ printf "file\n" >> $TMPFPLIST
printf "sha256\n" >> $TMPFPLIST
printf "$(xbps-digest $f)\n" >> $TMPFPLIST
for i in ${conf_files}; do
@@ -130,14 +145,16 @@ xbps_write_metadata_pkg_real()
printf "\n" >> $TMPFPLIST
done
- # Add directories at the end.
- for f in $(find -L $destdir -type d|sort -ur); do
+ # Pass 3: add directories.
+ for f in $(find $destdir -type d|sort -ur); do
j=$(echo $f|sed -e "$fpattern")
[ "$j" = "" ] && continue
printf "$j\n" >> $TMPFLIST
printf "\n" >> $TMPFPLIST
- printf "dir\n" >> $TMPFPLIST
+ printf "file\n" >> $TMPFPLIST
printf "$j\n" >> $TMPFPLIST
+ printf "type\n" >> $TMPFPLIST
+ printf "dir\n" >> $TMPFPLIST
for i in ${keep_dirs}; do
if [ "$j" = "$i" ]; then
printf "keep\n" >> $TMPFPLIST