summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McQuah <jmcquah@disroot.org>2022-06-10 12:46:47 +0200
committerJuergen Daubert <jue@jue.li>2022-06-10 12:46:47 +0200
commit14a9bb0a738e1830a487347ce05fb5944340a413 (patch)
tree28f4ab34aa91bdb6576800d5fbd690be80ee287e
parentdfdfb427c30b1b342a7aedb3a47db0c529c94430 (diff)
downloadprt-utils-14a9bb0a738e1830a487347ce05fb5944340a413.tar.gz
prt-utils-14a9bb0a738e1830a487347ce05fb5944340a413.tar.xz
prtsweep: fix compression mode evaluation
-rw-r--r--prtsweep19
1 files changed, 12 insertions, 7 deletions
diff --git a/prtsweep b/prtsweep
index 5c72a1e..aa68300 100644
--- a/prtsweep
+++ b/prtsweep
@@ -233,6 +233,9 @@ usage() {
}
do_sweep() {
+ PKGGLOB=$(echo "$PKGGLOB" | sed 's/PortName/$name/')
+ BLTGLOB='$name#$version-$release.pkg.tar.$COMPRESSION_MODE'
+
if [ -z "$ports" -a "$auto" = "1" ]; then
for portdir in $collections; do
echo $portdir
@@ -274,23 +277,25 @@ trap "interrupted" SIGHUP SIGINT SIGQUIT SIGTERM
getoptions $@
# First determine the directories that have been configured for downloads and built packages.
+# Replace any references to $name so an unset shell variable won't cause information loss.
if [ -f /etc/pkgmk.conf ]; then
- SRCGLOB=$(grep PKGMK_SOURCE_DIR /etc/pkgmk.conf | sed "s/[\t w]*#.*//; s/.*=//")
- PKGGLOB=$(grep PKGMK_PACKAGE_DIR /etc/pkgmk.conf | sed "s/[\t w]*#.*//; s/.*=//")
- COMPRESSION_MODE=$(grep COMPRESSION_MODE /etc/pkgmk.conf | sed "s/[\t w]*#.*//; s/.*=//")
+ eval $(grep PKGMK_SOURCE_DIR /etc/pkgmk.conf | tail -n 1 | \
+ sed 's/PKGMK_SOURCE_DIR/SRCGLOB/; s/\$name/PortName/')
+ eval $(grep PKGMK_PACKAGE_DIR /etc/pkgmk.conf | tail -n 1 | \
+ sed 's/PKGMK_PACKAGE_DIR/PKGGLOB/; s/\$name/PortName/')
+ eval $(grep COMPRESSION_MODE /etc/pkgmk.conf | tail -n 1 | \
+ sed 's/PKGMK_//')
fi
# No custom setting for compression mode means that pkgmk falls back to the default, gzip.
[ -n "$COMPRESSION_MODE" ] || COMPRESSION_MODE="gz"
-BLTGLOB='$name#$version-$release.pkg.tar.$COMPRESSION_MODE'
-
# Layouts 1 and 2: If all ports share a common directory (either for the sources or for
# the built packages), then this script might need to be supplemented by further cleaning.
# Suppress the warning if option -q (quiet mode) was given.
collections=`getportdirs`
if [ "$quiet" != "1" ]; then
- if [ -n "$SRCGLOB" ] && echo "${SRCGLOB}" | grep -q -v '\$name'; then
+ if [ -n "$SRCGLOB" ] && echo "${SRCGLOB}" | grep -q -v 'PortName'; then
if [ -n "$ports" ]; then
info_portsgiven
elif [ "$auto" = 1 ]; then
@@ -298,7 +303,7 @@ if [ "$quiet" != "1" ]; then
fi
do_sweep
fi
- if [ -n "$PKGGLOB" ] && echo "${PKGGLOB}" | grep -q -v '\$name'; then
+ if [ -n "$PKGGLOB" ] && echo "${PKGGLOB}" | grep -q -v 'PortName'; then
if [ -n "$ports" ]; then
info_portsgiven
elif [ "$auto" = 1 ]; then

Generated by cgit