Cleanup: move path filtering into pkg_scan_dir

Instead of prefixing the search path with $PKGDEPLOYDIR and then
stripping the prefix off again every single time, do that inside
the pkg_scan_dir function.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2020-04-12 17:05:02 +02:00
parent 2dc8bd9cd6
commit 21342dee8e
7 changed files with 17 additions and 19 deletions

View File

@ -12,8 +12,7 @@ deploy() {
cp -r ${SOURCE}/boot/* "$PKGDEPLOYDIR/" cp -r ${SOURCE}/boot/* "$PKGDEPLOYDIR/"
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR" cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
pkg_scan_dir "$PKGDEPLOYDIR/overlays" |\ pkg_scan_dir "overlays" >> "$PKGDEPLOYDIR/boot-rpi-dtbo.files"
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/boot-rpi-dtbo.files"
} }
check_update() { check_update() {

View File

@ -67,9 +67,7 @@ deploy() {
echo "dir lib 0755 0 0" > "$PKGDEPLOYDIR/linux-modules.files" echo "dir lib 0755 0 0" > "$PKGDEPLOYDIR/linux-modules.files"
pkg_scan_dir "$PKGDEPLOYDIR/lib" | \ pkg_scan_dir "lib" >> "$PKGDEPLOYDIR/linux-modules.files"
sed "s#$PKGDEPLOYDIR/##g" \
>> "$PKGDEPLOYDIR/linux-modules.files"
;; ;;
esac esac
done done

View File

@ -20,6 +20,5 @@ deploy() {
echo "dir include 0755 0 0" > "$PKGDEPLOYDIR/linux-dev.files" echo "dir include 0755 0 0" > "$PKGDEPLOYDIR/linux-dev.files"
pkg_scan_dir "$PKGDEPLOYDIR/include" |\ pkg_scan_dir "include" >> "$PKGDEPLOYDIR/linux-dev.files"
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/linux-dev.files"
} }

View File

@ -60,8 +60,7 @@ deploy() {
cp libssp_nonshared.a "$PKGDEPLOYDIR/lib" cp libssp_nonshared.a "$PKGDEPLOYDIR/lib"
cp "$SCRIPTDIR/pkg/$PKGNAME/libc-dev.files" "$PKGDEPLOYDIR" cp "$SCRIPTDIR/pkg/$PKGNAME/libc-dev.files" "$PKGDEPLOYDIR"
pkg_scan_dir "$PKGDEPLOYDIR/include" |\ pkg_scan_dir "include" >> "$PKGDEPLOYDIR/libc-dev.files"
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/libc-dev.files"
if [ "x$TC_HARDENING" = "xyes" ]; then if [ "x$TC_HARDENING" = "xyes" ]; then
echo "requires libc linux-dev fortify-headers" > \ echo "requires libc linux-dev fortify-headers" > \

View File

@ -80,8 +80,7 @@ deploy() {
echo "dir srv 0755 0 0" >> "$PKGDEPLOYDIR/nginx.files" echo "dir srv 0755 0 0" >> "$PKGDEPLOYDIR/nginx.files"
echo "dir srv/www 0755 0 0" >> "$PKGDEPLOYDIR/nginx.files" echo "dir srv/www 0755 0 0" >> "$PKGDEPLOYDIR/nginx.files"
pkg_scan_dir "$PKGDEPLOYDIR/srv/www" |\ pkg_scan_dir "srv/www" >> "$PKGDEPLOYDIR/nginx.files"
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/nginx.files"
fi fi
cat_file_override "nginx.conf" > "$PKGDEPLOYDIR/etc/nginx/nginx.conf" cat_file_override "nginx.conf" > "$PKGDEPLOYDIR/etc/nginx/nginx.conf"

View File

@ -21,11 +21,8 @@ deploy() {
sed -i 's@/usr@@g' "$PKGDEPLOYDIR/bin/tzselect" sed -i 's@/usr@@g' "$PKGDEPLOYDIR/bin/tzselect"
pkg_scan_dir "$PKGDEPLOYDIR/share/zoneinfo" | \ pkg_scan_dir "share/zoneinfo" >> "$PKGDEPLOYDIR/tzdata.files"
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/tzdata.files" pkg_scan_dir "share/zoneinfo-leaps" >> "$PKGDEPLOYDIR/tzdata.files"
pkg_scan_dir "$PKGDEPLOYDIR/share/zoneinfo-leaps" | \
sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/tzdata.files"
} }
check_update() { check_update() {

View File

@ -9,9 +9,16 @@ apply_patches() {
} }
pkg_scan_dir() { pkg_scan_dir() {
find -H "$1" -type d -printf "dir \"%p\" 0%m 0 0\\n" | tail -n +2 local sp="$PKGDEPLOYDIR/$1"
find -H "$1" -type l -printf "slink \"%p\" 0%m 0 0 %l\\n"
find -H "$1" -type f -printf "file \"%p\" 0%m 0 0\\n" find -H "$sp" -type d -printf "dir \"%p\" 0%m 0 0\\n" | tail -n +2 |\
sed "s#$PKGDEPLOYDIR/##g"
find -H "$sp" -type l -printf "slink \"%p\" 0%m 0 0 %l\\n" |\
sed "s#$PKGDEPLOYDIR/##g"
find -H "$sp" -type f -printf "file \"%p\" 0%m 0 0\\n" |\
sed "s#$PKGDEPLOYDIR/##g"
} }
fetch_package() { fetch_package() {