mockspec: Allow changing chroot with $OS
authorMartin Pitt <martin@piware.de>
Fri, 26 Oct 2018 07:05:25 +0000 (09:05 +0200)
committerMartin Pitt <martin@piware.de>
Fri, 26 Oct 2018 07:05:25 +0000 (09:05 +0200)
mockspec

index 1e1831b8870d2d9c98d9e50bc61563fa9e6d5301..1a32eee9f5c7e11a27754f5fa153345365023db0 100755 (executable)
--- a/mockspec
+++ b/mockspec
@@ -1,7 +1,8 @@
 #!/bin/sh
 # start mock session with build deps from given .spec file
+OS="${OS:-default}"
 set -eu
-[ -d "$(mock --print-root-path)" ] ||  mock --init
+[ -d "$(mock -r $OS --print-root-path)" ] ||  mock --init
 specfile="$1"
 shift
-mock -i $(sed -n '/^BuildRequires:/ {s/^.*: //; s/>=.*$//; s/%{.*}//; p}' "$specfile") $@
+mock -r $OS -i $(sed -n '/^BuildRequires:/ {s/^.*: //; s/>=.*$//; s/%{.*}//; p}' "$specfile") $@