main/postmarketos-mkinitfs: execute lddtree without privileges (!1133)

The lddtree script uses the scanelf utility which has some security check that causes a slowdown of the operation, executing it without privileges it's really faster.
This commit is contained in:
Daniele Debernardi 2020-04-07 23:38:15 +02:00 committed by Bart Ribbers
parent 36f15b58f6
commit bd15afc217
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
2 changed files with 3 additions and 4 deletions

View file

@ -26,4 +26,4 @@ package() {
sha512sums="1d49db8a48ad513cc548b8a0ea23cc64518e71c93863155b4e9d2271fb46090506331c03d6955d693c8568c248ecc76b218efe4a6f6bba57c41c5f6d775dc61b init.sh.in
315cc6e8a73f9984e6843395d68734d26ac2fffce34039ec5f229ebcd818bdb353318398d6c824cede5d0b36e13d7589a1f1d3295d8162279b5dc6a2b939da88 init_functions.sh
02b484122ed5345fd84ccea20d62262aa6bffd775e5f424f24dc4de202705a235a9e1950b5ee8c80f039889fdf6864a798c15382867eed311363835e7b31126a mkinitfs.sh"
9a4116832c26e827f5937969ee1ad011e2c45a6e7e74587141cd7de5d192aff0c668913927a5b8bc259ca2c75e429914ef8cb81a05f685944229f07fc48ded18 mkinitfs.sh"

View file

@ -129,7 +129,7 @@ get_binaries()
BINARIES="${BINARIES} ${line}"
done < "$file"
done
lddtree -l $BINARIES | sort -u
sudo -u nobody lddtree -l $BINARIES | sort -u
}
# Collect non-binary files for osk-sdl and its dependencies
@ -156,14 +156,13 @@ get_binaries_extra()
tmp1=$(mktemp /tmp/mkinitfs.XXXXXX)
get_binaries > "$tmp1"
tmp2=$(mktemp /tmp/mkinitfs.XXXXXX)
lddtree -l $BINARIES_EXTRA | sort -u > "$tmp2"
sudo -u nobody lddtree -l $BINARIES_EXTRA | sort -u > "$tmp2"
ret=$(comm -13 "$tmp1" "$tmp2")
rm "$tmp1" "$tmp2"
echo "${ret}"
}
# Copy files to the destination specified
# FIXME: this is a performance bottleneck
# $1: files
# $2: destination
copy_files()