fix INSTALLURL detection

reported by Alexey Proschenko
> There is unsafe use of "cat /etc/installurl" in PKG_PATH composition code
> because of man INSTALLURL(5):
> "Empty lines and lines beginning with ‘#’ in the file are ignored."

the current code was looking for the first line not starting with #
which was wrong in case the line was empty.
This commit is contained in:
Solene Rapenne 2021-08-29 12:19:06 +02:00
parent 1bd66adc4a
commit c13f3d30dc
1 changed files with 1 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
INSTALLURL=$(grep -v ^# /etc/installurl | head -n 1)
INSTALLURL=$(awk '/^./ && ! /^#/ { print ; exit }' /etc/installurl)
export PKG_PATH="${INSTALLURL}/$(uname -r)/packages-stable/$(machine)/"
CACHE_DIR=/var/cache/pkgupdate/