[PATCH] Clean up invocation of upd-instroot from buildinstall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use named options when passing things to upd-instroot so that it's more
clear as to what's going on.  Explicitly pass the arch we're building
for rather than trying to derive it based on the anaconda-runtime package
---
 scripts/buildinstall |    2 +-
 scripts/upd-instroot |  104 +++++++++++++++++++++++--------------------------
 2 files changed, 50 insertions(+), 56 deletions(-)

diff --git a/scripts/buildinstall b/scripts/buildinstall
index eb5d7fc..9ff8755 100755
--- a/scripts/buildinstall
+++ b/scripts/buildinstall
@@ -135,7 +135,7 @@ MK_STAMP=$BUILDINSTDIR/makestamp.py
 BUILDINSTALL=$BUILDINSTDIR/buildinstall
 
 echo "Building images..."
-$UPD_INSTROOT $DEBUGSTR $NOGRSTR $PKGDIR $TREEDIR/minstg2 $TREEDIR/stage2 $DIR
+$UPD_INSTROOT $DEBUGSTR $NOGRSTR --arch $BUILDARCH --mindir $TREEDIR/minstg2 --stg2dir $TREEDIR/stage2 $DIR
 
 echo "Writing .treeinfo file..."
 $MK_TREEINFO --family="$PRODUCTSTR" ${VARIANT:+--variant="$VARIANT"} --version=$VERSION --arch=$BUILDARCH --outfile=$DIR/.treeinfo
diff --git a/scripts/upd-instroot b/scripts/upd-instroot
index a61c2d7..99e38a6 100755
--- a/scripts/upd-instroot
+++ b/scripts/upd-instroot
@@ -21,40 +21,64 @@
 ORIGDIR=`pwd`
 DEBUG=""
 NEEDGR=yes
+ARCH=`uname -m`
+
+while [ $# -gt 0 ]; do
+    case $1 in
+	--nogr)
+	    NEEDGR=""
+	    shift
+	    ;;
+	--debug)
+	    DEBUG="--debug"
+	    shift
+	    ;;
+
+	--arch)
+	    ARCH=$2
+	    shift; shift
+	    ;;
+
+	--mindir)
+	    DEST=$2
+	    shift; shift
+	    ;;
+
+	--stg2dir)
+	    DESTGR=$2
+	    shift; shift
+	    ;;
+
+	*)
+	    TOPDIR=$1
+	    shift
+	    ;;
+    esac
+done
 
-if [ "$1" == "--debug" ]; then
-    DEBUG="--debug"
-    shift
-fi
-
-if [ "$1" == "--nogr" ]; then
-    NEEDGR=""
-    shift
-fi
-
-if [ -z "$1" ]; then
+if [ -z "$TOPDIR" ]; then
 	echo "upd-instroot: updates instimage from a Red Hat RPMS directory"
-	echo "usage:        $0 <packagedir> [templatedir] [instroot]"
+	echo "usage:        $0 [--nogr] [--debug] [--arch arch] <packagedir> [templatedir] [instroot]"
 	exit 1
 fi
 
-if [ ! -d $1 ]; then
-	if [ -z "$ARCH" ]; then
-		echo "ARCH must be set" >&2
-		exit 1
-	fi
+if [ $ARCH = x86_64 -o $ARCH = s390x -o $ARCH = ppc64 ]; then
+    LIBDIR=lib64
+else
+    LIBDIR=lib
 fi
 
-PACKAGEDIR=$1
+if [ -z "$DEST" ]; then
+    DEST=`mktemp -d ${TMPDIR:-/tmp}/dest.XXXXXX`
+fi
 
-if [ -z "$ARCH" ]; then
-	ARCH=`rpm --nodigest --nosignature -qp --qf "%{ARCH}" $PACKAGEDIR/anaconda-runtime*.rpm`
+if [ -z "$DESTGR" ]; then
+    DESTGR=`mktemp -d ${TMPDIR:-/tmp}/destgr.XXXXXX`
 fi
 
-if [ $ARCH = x86_64 -o $ARCH = s390x -o $ARCH = ppc64 ]; then
-    LIBDIR=lib64
-else
-    LIBDIR=lib
+if [ ! -d $TOPDIR/repodata ]; then
+    echo "Unable to find repodata!"
+    exit 1
 fi
 
 . $(dirname $0)/buildinstall.functions
@@ -111,36 +135,6 @@ die () {
     exit 1
 }
 
-if [ -z "$2" ]; then
-    DEST=${TMPDIR:-/tmp}/upd-instroot
-else
-    DEST=$2
-fi
-
-if [ -z "$3" ]; then
-    DESTGR=${TMPDIR:-/tmp}/upd-instroot
-else
-    DESTGR=$3
-fi
-
-if [ -n "$4" ]; then
-    TOPDIR=$4
-elif [ -d $PACKAGEDIR/repodata ]; then
-    TOPDIR=$PACKAGEDIR
-elif [ -d $PACKAGEDIR/../repodata ]; then
-    TOPDIR=$PACKAGEDIR/..
-elif [ -d $PACKAGEDIR/../../repodata ]; then
-    TOPDIR=$PACKAGEDIR/../..
-else
-    echo "Unable to find repodata!"
-    exit 1
-fi
-
-
-rm -rf $DEST $DESTGR
-mkdir -p $DEST
-mkdir -p $DESTGR
-
 PACKAGES="glibc-common setup python newt slang libselinux
 	 libsepol libtermcap zlib ash e2fsprogs util-linux-ng raidtools popt
 	 procps rpm rpm-libs Xconfigurator anaconda tzdata python-libs
-- 
1.5.4.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux