summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajiv M Ranganath <rajiv.ranganath@nokia.com>2011-11-21 17:35:16 -0800
committerRajiv M Ranganath <rajiv.ranganath@nokia.com>2011-11-21 17:35:16 -0800
commit104b100dd892a51071705fffc97d15f7d1a4f386 (patch)
tree9a77f42a0e31b64c534a8789db21128a3e3f7909
Initial commit
-rwxr-xr-xhome/bin/cleanOutSysrootPackages.sh84
-rwxr-xr-xhome/bin/gen-rpm-changelog32
-rwxr-xr-xhome/bin/gitInstallSource175
-rwxr-xr-xhome/bin/goChroot.sh45
-rwxr-xr-xhome/bin/mkFedoraChroot.sh102
-rwxr-xr-xhome/bin/rebindChroot.sh44
-rwxr-xr-xhome/bin/rpm-noarch158
-rwxr-xr-xhome/bin/rpmbuild-noarch105
-rwxr-xr-xhome/bin/setupBaseSYSROOT_armv5tel.sh138
-rwxr-xr-xhome/bin/setupBaseSYSROOT_armv7hl.sh111
-rwxr-xr-xhome/bin/setupDeveloper.sh193
-rwxr-xr-xhome/bin/unbindChroot.sh42
-rwxr-xr-xhome/bin/uploadRPMS.sh62
-rwxr-xr-xhome/bin/zypper-build-dep64
-rwxr-xr-xhome/bin/zypper-download88
-rwxr-xr-xhome/bin/zypper-noarch66
16 files changed, 1509 insertions, 0 deletions
diff --git a/home/bin/cleanOutSysrootPackages.sh b/home/bin/cleanOutSysrootPackages.sh
new file mode 100755
index 0000000..2197520
--- /dev/null
+++ b/home/bin/cleanOutSysrootPackages.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+ARCH=armv5tel
+
+# since some of the naming conventions in rpms are a bit unpredictable,
+# this script will mv the rpmbuild-$ARCH/SOURCES/foo-version to
+# rpmbuild-$ARCH/SOURCES/DONE and the local src rpm to
+# ./DONE once we have processed it.
+
+zypper-${ARCH} refresh
+
+## first we grab the starting set of sysroot packages so we know what we want to start from
+# this is ok, but kept growing over time
+#BASE_SYSROOT_PACKAGES=`rpm-${ARCH} -qa `
+BASE_SYSROOT_PACKAGES="libgcc-4.5.1-4.fc14.armv5tel \
+tzdata-2010k-1.fc14.noarch \
+basesystem-10.0-3.noarch \
+nss-softokn-freebl-3.12.10-1.fc14.armv5tel \
+bash-4.1.7-1.fc14.armv5tel \
+coreutils-libs-8.5-7.fc14.armv5tel \
+glibc-headers-2.13-2.1.armv5tel \
+kernel-headers-2.6.35.6-45.fc14.armv5tel \
+glibc-devel-2.13-2.1.armv5tel \
+libstdc++-devel-4.5.1-4.fc14.armv5tel \
+ncurses-base-5.7-8.20100703.fc14.armv5tel \
+setup-2.8.23-1.fc14.noarch \
+filesystem-2.4.35-1.fc14.armv5tel \
+glibc-2.13-2.1.armv5tel \
+ncurses-libs-5.7-8.20100703.fc14.armv5tel \
+glibc-common-2.13-2.1.armv5tel \
+coreutils-8.5-7.fc14.armv5tel \
+zlib-1.2.5-2.fc14.armv5tel \
+info-4.13a-10.fc14.armv5tel \
+libstdc++-4.5.1-4.fc14.armv5tel"
+
+# removes the offending rpm if its not in the base set
+function cleanToBase(){
+ RPM=$1
+ for k in $BASE_SYSROOT_PACKAGES; do
+ if [ $RPM = $k ]; then
+ return 0
+ fi
+ done
+ echo "cleaning out $RPM"
+ zypper-${ARCH} -n remove $RPM
+
+}
+
+function revertSysroot(){
+ CURRENT_SYSROOT_PACKAGES=`rpm-${ARCH} -qa `
+ for j in $CURRENT_SYSROOT_PACKAGES; do
+ echo "checking $j"
+ cleanToBase $j
+ done
+# for j in $BASE_SYSROOT_PACKAGES; do
+# echo "readding $j"
+# #zypper-${ARCH} -n install --no-recommends $j
+# done
+}
+
+revertSysroot
+
diff --git a/home/bin/gen-rpm-changelog b/home/bin/gen-rpm-changelog
new file mode 100755
index 0000000..1ff1986
--- /dev/null
+++ b/home/bin/gen-rpm-changelog
@@ -0,0 +1,32 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+if [ ! -d tmp ]; then
+ mkdir tmp
+fi
+
+git log --since="2 weeks ago" --date-order --format='* %cd <%ce> %h%n- %s' > tmp/changelog.orig
+cat tmp/changelog.orig | gawk '$1 ~/^*/ {$5="" ; $7="" ; print} ; $1 !~/^*/ {print}' | sed -e 's/ / /g' > changelog
+rm tmp/changelog.orig
+
diff --git a/home/bin/gitInstallSource b/home/bin/gitInstallSource
new file mode 100755
index 0000000..13f67a8
--- /dev/null
+++ b/home/bin/gitInstallSource
@@ -0,0 +1,175 @@
+#!/usr/bin/python
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+import os, sys
+import subprocess
+import re
+import glob
+import posixpath
+from optparse import OptionParser
+
+tagpattern='(.*)'
+pkgname=''
+exclude_patterns=[]
+
+homedir=os.environ['HOME']
+rpmsourcedir=('%s/rpmbuild/SOURCES' % homedir)
+rpmreposdir=('%s/rpmbuild/REPOS' % homedir)
+
+repodir=''
+
+def obsBuild():
+ specfiles=options.spec
+ specfile=options.spec
+ branch='master'
+ print 'specfile=', specfile
+ proc = subprocess.Popen(['grep', 'Name:', specfile],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()
+ pkgname=proc[0]
+ m = re.match("Name:[ \t\n]+(.*)[ \t\n]*", pkgname)
+ if m:
+ pkgname = m.group(1)
+ print pkgname
+ proc = subprocess.Popen(['grep', '_git', specfile],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()
+ sourcelines=proc[0].split('\n')
+ for sourceline in sourcelines:
+ m = re.match("%define[ \t\n]+_gituri[ \t\n]+(.*)[ \t\n]*", sourceline)
+ if m:
+ source = m.group(1)
+ m = re.match("%define[ \t\n]+_gitbranch[ \t\n]+(.*)[ \t\n]*", sourceline)
+ if m:
+ branch = m.group(1)
+
+ repodir = ('%s/%s' % (rpmreposdir, pkgname))
+
+ print 'source', source
+ print 'branch', branch
+ print 'repodir', repodir
+ if not posixpath.exists(repodir):
+ subprocess.Popen(['git', 'clone', source, repodir],
+ stdout=subprocess.PIPE).communicate()
+ os.chdir(repodir)
+ proc = subprocess.Popen(['git', 'tag', '-l'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()
+ ret = proc[0].strip('\n').split('\n')
+ matches=[]
+ tags=[]
+ if len(proc[0]):
+ for t in ret:
+ m = re.match(tagpattern, t)
+ if m:
+ tags.append(t)
+ matches.append(m)
+ lastmatch = matches[-1]
+ tagversion = lastmatch.group(1)
+ tag=tags[-1]
+ else:
+ tag=''
+ if len(tags) > 0:
+ print 'running git cherry'
+ proc = subprocess.Popen(['git', 'cherry', tag],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()
+ ret = proc[0].strip('\n').split('\n')
+ micro = len(ret)
+ if (micro > 0):
+ lastcommit = ret[-1].replace(' ', '')[0:12]
+ else:
+ lastcommit = ''
+ else:
+ proc = subprocess.Popen(['git', 'log'],
+ stdout=subprocess.PIPE).communicate()
+ commits=[]
+ for line in proc[0].split('\n'):
+ if line:
+ m = re.match('^commit[ \t](.*)', line)
+ if m:
+ commits.append(m.group(1))
+ tagversion = 0
+ micro = len(commits)
+ lastcommit=commits[0][0:12]
+
+ version=('%s+%d+git%s' % (tagversion, micro, lastcommit))
+
+ print 'version', version
+
+ ## clean old files
+ sourcedir=('%s/%s-%s' % (rpmsourcedir, pkgname,version))
+ print 'sourcedir', sourcedir
+ os.system('rm -fr %s' % sourcedir)
+ os.system('mkdir -p %s' % sourcedir)
+
+ if options.branch:
+ branch=options.branch
+
+ bindings = {'sourcedir': sourcedir, 'pkgname': pkgname, 'version': version, 'branch': branch}
+ os.system('git archive --format tar --prefix %(pkgname)s-%(version)s/ --output %(sourcedir)s/%(pkgname)s-%(version)s.tar.gz %(branch)s' % bindings)
+
+ script_path = os.path.dirname(os.path.realpath(__file__))
+ os.system('%s/gen-rpm-changelog; mv changelog %s/%s.changelog;' % (script_path, sourcedir, pkgname))
+ gitspecfile=('%s/%s.spec' % (repodir, pkgname))
+
+ files = glob.glob('%s/*' % posixpath.dirname(specfile))
+ for f in files:
+ if re.match('.*~', f):
+ continue
+ if re.match('.spec', f):
+ continue
+ os.system('cp -v %s %s' % (f, sourcedir))
+
+ if posixpath.exists(gitspecfile):
+ os.system('cp -v %s %s' % (gitspecfile, sourcedir))
+ else:
+ os.system('cp -v %s %s' % (specfile, sourcedir))
+
+ os.system("sed -i 's/^Version:.*/Version: %(version)s/' %(sourcedir)s/%(pkgname)s.spec" % bindings)
+ os.system("sed -i 's/^Source:.*/Source: %(pkgname)s-%(version)s.tar.gz/' %(sourcedir)s/%(pkgname)s.spec" % bindings)
+ os.system("sed -i 's/^Release:.*/Release: 1/' %(sourcedir)s/%(pkgname)s.spec" % bindings)
+
+
+parser = OptionParser()
+parser.add_option("-B", "--branch", dest="branch",
+ help="Git branch to use")
+parser.add_option("-e", "--exclude", dest="exclude", action="append",
+ help="File patterns to exclude")
+parser.add_option("-r", "--rpmbuilddir", dest="rpmbuilddir",
+ help="Defaults to ~/rpmbbuild")
+parser.add_option("-s", "--spec", dest="spec",
+ help="Spec file to use")
+parser.add_option("-t", "--tag", dest="tagpattern",
+ help="Prefix of version tag")
+(options, args) = parser.parse_args()
+if options.rpmbuilddir:
+ rpmbuilddir = options.rpmbuilddir
+ rpmsourcedir = rpmbuilddir + "/SOURCES"
+ rpmrepodir = rpmbuilddir + "/REPOS"
+if options.exclude:
+ exclude_patterns = options.exclude_patterns
+if options.tagpattern:
+ tagpattern=options.tagpattern
+obsBuild()
diff --git a/home/bin/goChroot.sh b/home/bin/goChroot.sh
new file mode 100755
index 0000000..27b35cb
--- /dev/null
+++ b/home/bin/goChroot.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+if [ "$1" == "" ]; then
+ echo "Usage: $(basename $0) PATH-TO-CHROOT"
+ exit 1
+fi
+
+CHROOT_DIR=$(readlink -e $1)
+
+# Should fix up the bind mounts if they don't already exist
+if ! mount | egrep ${CHROOT_DIR}/proc; then
+ echo "not mounted, rebinding"
+ rebindChroot.sh ${CHROOT_DIR}
+fi
+
+# so you can run X from w/in the chroot over ssh.
+if [ -e ~/.Xauthority ] ; then
+ cp -f ~/.Xauthority ${CHROOT_DIR}/home/`whoami`
+fi
+
+sudo chroot ${CHROOT_DIR} sudo su - `whoami`
+
+
diff --git a/home/bin/mkFedoraChroot.sh b/home/bin/mkFedoraChroot.sh
new file mode 100755
index 0000000..c90c05b
--- /dev/null
+++ b/home/bin/mkFedoraChroot.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+if [ "$1" == "" ]; then
+ echo "Usage: $(basename $0) PATH-TO-CHROOT"
+ exit 1
+fi
+
+CHROOT_DIR=$(readlink -m $1)
+
+if [ -d ${CHROOT_DIR} ]; then
+ echo "chroot dir exists, try again"
+ exit 1
+fi
+
+FORCE_DEB=""
+# debian/ubuntu want you to really tell it to use rpm
+if uname -a | egrep -i ubuntu ; then
+ echo setting up Ubuntu
+ FORCE_DEB="--force-debian"
+ sudo apt-get install yum rpm m2crypto psmisc
+fi
+
+function sadExit
+{
+ echo $1;
+ exit -1;
+}
+
+sudo mkdir -p ${CHROOT_DIR}/var/lib/rpm
+sudo rpm --root ${CHROOT_DIR} --initdb
+rm -f fedora-rel*rpm
+# ubuntu doesnt support yum-utils so it doesnt have
+# yumdownloader...
+#yumdownloader fedora-release | head -1 | awk '{print $1}'
+wget http://mt-fedora.nrcc.noklab.com/repos/f14-mirror/all/fedora-release-14-1.noarch.rpm || sadExit "failed to wget fedora release 14"
+
+echo "FD= $FORCE_DEB"
+sudo rpm --root ${CHROOT_DIR} -ivh $FORCE_DEB fedora-rel*rpm
+
+if [ "$FORCE_DEB" != "" ]; then
+ sudo mkdir -p /etc/pki/rpm-gpg/
+ sudo rsync -av ${CHROOT_DIR}/etc/pki/rpm-gpg/ /etc/pki/rpm-gpg/
+fi
+
+sudo yum -y --installroot=${CHROOT_DIR} install bash || sadExit "yum install bash failed :("
+sudo yum -y --installroot=${CHROOT_DIR} install util-linux-ng || sadExit "yum install util=linux-ng failed :("
+sudo yum -y --installroot=${CHROOT_DIR} install rpm yum yum-utils git-core || sadExit "yum install git failed :("
+sudo yum -y --installroot=${CHROOT_DIR} install sudo wget || sadExit "yum install wget :("
+
+# set up the bind mounts
+sudo mkdir -p ${CHROOT_DIR}/dev/pts
+sudo mkdir -p ${CHROOT_DIR}/sys
+sudo mkdir -p ${CHROOT_DIR}/tmp
+sudo mount -o bind /proc/ ${CHROOT_DIR}/proc
+sudo mount -o bind /dev/pts ${CHROOT_DIR}/dev/pts
+sudo mount -o bind /dev ${CHROOT_DIR}/dev/
+sudo mount -o bind /sys ${CHROOT_DIR}/sys/
+sudo mount -o bind /tmp ${CHROOT_DIR}/tmp
+
+# for dns
+sudo cp /etc/resolv.conf ${CHROOT_DIR}/etc/
+# so we can sudo
+sudo cp /etc/sudoers ${CHROOT_DIR}/etc
+
+
+# for convenience....
+MUSER=`whoami`
+MUID=`id -u ${USER}`
+MGID=`id -g ${USER}`
+
+sudo chroot ${CHROOT_DIR} groupadd -g $MGID $MUSER
+sudo chroot ${CHROOT_DIR} useradd -u $MUID -g $MGID -G wheel $MUSER
+
+sudo rsync -av ~/.ssh ${CHROOT_DIR}/home/${MUSER}
+# so you can run X from w/in the chroot over ssh.
+cp -f ~/.Xauthority ${CHROOT_DIR}/home/`whoami`
+
+echo 'export PS1="\\[\\033[01;31m\\]chroot\\[\\033[0m\\]-\\[\\033[01;32m\\]\\u@\\h\\[\\033[0m\\]:\\[\\033[01;34m\\]\\w\\[\\033[0m\\]$ "' | sudo tee -a ${CHROOT_DIR}/home/${MUSER}/.bashrc
+
+
diff --git a/home/bin/rebindChroot.sh b/home/bin/rebindChroot.sh
new file mode 100755
index 0000000..2f62ced
--- /dev/null
+++ b/home/bin/rebindChroot.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+# reset up the bind mounts
+
+
+if [ "$1" == "" ]; then
+ echo "need abs path of chroot"
+ exit 1
+fi
+
+CHROOT_DIR=$1
+
+# set up the bind mounts
+sudo mkdir -p ${CHROOT_DIR}/sys
+sudo mount -o bind /proc/ ${CHROOT_DIR}/proc
+sudo mount -o bind /dev/pts ${CHROOT_DIR}/dev/pts
+sudo mount -o bind /dev ${CHROOT_DIR}/dev/
+sudo mount -o bind /sys ${CHROOT_DIR}/sys/
+sudo mount -o bind /tmp ${CHROOT_DIR}/tmp
+
+# for dns
+sudo cp /etc/resolv.conf ${CHROOT_DIR}/etc/
diff --git a/home/bin/rpm-noarch b/home/bin/rpm-noarch
new file mode 100755
index 0000000..652ccde
--- /dev/null
+++ b/home/bin/rpm-noarch
@@ -0,0 +1,158 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+#
+# Usage:
+#
+# rpm-noarch ARCH ARGS...
+# OR
+# rpm-armv5tel ARGS...
+#
+# The architecture is derived from the name of the shell script, or by
+# running the generic script and passing the architecture as the first argument.
+# This allows us to create a softlink to the shell script for each possible architecture.
+#
+# E.g.: ln -s rpm-noarch rpm-armv5tel
+#
+#export ARCH=armv5tel
+
+BASENAME=$(basename $0)
+ARCH=${BASENAME#*-}
+if [ "$ARCH" = "noarch" ] ; then
+ ARCH=$1
+ shift
+fi
+
+export ARCH
+export PP_ARCH=-${ARCH}
+export SYSROOT=/usr/${ARCH}-redhat-linux-gnueabi/sys-root
+export CROSS_COMPILE=arm-none-linux-gnueabi-
+export PKG_CONFIG_PATH=${SYSROOT}/usr/lib/pkgconfig
+export TARGET=${ARCH}-linux-gnueabi
+DIDINSTALL=""
+EXTRA_ARGS="--root=${SYSROOT}"
+
+fixinstall() {
+ EXTRA_ARGS="$EXTRA_ARGS --ignorearch --noscripts"
+ DIDINSTALL="yes"
+}
+
+fixerase() {
+ EXTRA_ARGS="$EXTRA_ARGS --noscripts"
+}
+
+fixverbose() {
+ VERBOSE="yes"
+}
+
+srpm="\.src\.rpm$"
+brpm="\.rpm$"
+
+ARGS=""
+RPMS=""
+SRPMS=""
+
+addarg() {
+ ARGS="$ARGS $1"
+}
+addrpm() {
+ echo "Adding rpm $@ $*"
+ RPMS="$RPMS $*"
+ echo $RPMS
+}
+addsrpm() {
+ SRPMS="$SRPMS $1"
+}
+
+for arg in "$@" ; do
+ if [[ $arg =~ ^-- ]] ; then
+ case $arg in
+ --install) fixinstall;;
+ --upgrade*) fixinstall;;
+ --erase*) fixerase;;
+ --verbose) fixverbose;;
+ esac
+ addarg $arg
+ elif [[ $arg =~ ^- ]] ; then # Single character arguments
+ for i in $(seq 2 ${#arg}) ; do
+ char=$(expr substr "$arg" $i 1)
+ case $char in
+ i) fixinstall;;
+ U) fixinstall;;
+ e) fixerase;;
+ v) fixverbose;;
+ esac
+ done
+ addarg $arg
+ elif [[ $arg =~ $srpm ]] ; then
+ addsrpm $arg
+ elif [[ $arg =~ $brpm ]] ; then
+ addrpm $arg
+ else
+ echo "What is $arg doing here?"
+ addarg $arg
+ fi
+done
+
+if [ $VERBOSE ] ; then
+ echo "#### Calling sudo RPM with $EXTRA_ARGS $ARGS $RPMS"
+ echo "#### Calling RPM with $EXTRA_ARGS $ARGS $SRPMS"
+ echo "#### ARGS=$ARGS"
+ echo "#### RPMS=$RPMS"
+ echo "#### SRPMS=$SRPMS"
+fi
+
+if [ -z "$RPMS" ] || [ "$SRPMS" ] ; then
+ if [ $VERBOSE ] ; then
+ echo rpm $ARGS $EXTRA_ARGS $SRPMS
+ fi
+ rpm $ARGS $EXTRA_ARGS $SRPMS
+fi
+
+if [ "$RPMS" ] ; then
+ if [ $VERBOSE ] ; then
+ echo sudo rpm $ARGS $EXTRA_ARGS $RPMS
+ fi
+ sudo rpm $ARGS $EXTRA_ARGS $RPMS
+fi
+
+
+if [ "" != "$DIDINSTALL" ]; then
+# in case anything we installed added a pkgconfig file, we need to "fix" it to be sysroot friendly
+# echo "FIXING pcs"
+ if [ -d ${PKG_CONFIG_PATH} ]; then
+ for i in ${PKG_CONFIG_PATH}/*.pc ; do
+ if [ -f "$i" ]; then
+ if ! grep ${SYSROOT} $i >> /dev/null ; then
+ echo Fixing "$i";
+ sudo cp $i $i.orig
+ sudo sed -i -e "s:=/usr:=${SYSROOT}/usr:" $i
+ sudo sed -i -e "s:=/lib:=${SYSROOT}/lib:" $i
+ sudo sed -i -e "s:-I/usr/include:-I${SYSROOT}/usr/include:" $i
+ sudo sed -i -e "s:-L/usr/lib:-L${SYSROOT}/usr/lib:" $i;
+ sudo sed -i -e "s:=/opt/mt:=${SYSROOT}/opt/mt:" $i
+ fi
+ fi
+ done
+ fi
+fi
diff --git a/home/bin/rpmbuild-noarch b/home/bin/rpmbuild-noarch
new file mode 100755
index 0000000..a5f7c81
--- /dev/null
+++ b/home/bin/rpmbuild-noarch
@@ -0,0 +1,105 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+#
+# Usage:
+#
+# rpmbuild-noarch ARCH ARGS...
+# OR
+# rpmbuild-armv5tel ARGS...
+#
+# The architecture is derived from the name of the shell script, or by
+# running the generic script and passing the architecture as the first argument.
+# This allows us to create a softlink to the shell script for each possible architecture.
+#
+# E.g.: ln -s rpmbuild-noarch rpmbuild-armv5tel
+#
+#export ARCH=armv5tel
+
+BASENAME=$(basename $0)
+ARCH=${BASENAME#*-}
+if [ "$ARCH" = "noarch" ] ; then
+ ARCH=$1
+ shift
+fi
+
+if [ $# -lt 2 ] ; then
+ echo "Need to specify a build option and a spec file"
+ exit 1
+fi
+
+export ARCH
+export PP_ARCH=-${ARCH}
+export SYSROOT=/usr/${ARCH}-redhat-linux-gnueabi/sys-root
+export CROSS_COMPILE=arm-none-linux-gnueabi-
+export PKG_CONFIG_PATH=${SYSROOT}/usr/lib/pkgconfig
+export TARGET=${ARCH}-linux-gnueabi
+export ZYPP_CONF=$SYSROOT/etc/zypp/zypp.conf
+export BUILDROOT=$HOME/rpmbuild-${ARCH}/INSTALLROOT
+
+terminate() {
+ echo "${BASENAME} does not support $1"
+ exit 1
+}
+# we used to set up the generic arm links in ~/bin with the setupDeveloper script.
+# Now that we are actively supporting 2 DIFFERENT architectures,
+# we need to set them up on the fly. If you run
+# rpmbuild-armv5tel and rpmbuild-armv7hl on 2 diff
+# xterms at the same time u r :(
+echo "Making ARM links"
+pushd ~/bin
+base_name=$ARCH-redhat
+for newprefix in arm arm-none ; do
+ for i in /usr/bin/${base_name}*; do
+ oldname=$(basename $i)
+ linkname=${newprefix}${oldname#${base_name}}
+ echo Redirecting to $i from ${linkname}
+ ln -sf $i ${linkname}
+ done
+done
+popd
+
+
+# We assume that the list argument is the target file
+# rpmbuild seems to work better if we insert our extra
+# arguments BEFORE the target file, but AFTER all of the
+# other arguments that were passed on the command line.
+
+TARGETFILE=${!#}
+length=$(($#-1))
+
+for arg in "$@" ; do
+ case $arg in
+# -tp|-tc|-ti|-ta|-tb|-ts) terminate $arg;;
+# --rebuild|--recompile|--short-circuit) terminate $arg;;
+ -v|--verbose) VERBOSE="yes";;
+ esac
+done
+
+EXTRA_ARGS="--rebuild --buildroot=${BUILDROOT} --root=${SYSROOT} --dbpath ${SYSROOT}/var/lib/rpm --target=${TARGET}"
+
+if [ $VERBOSE ] ; then
+ echo "#### Calling RPMBUILD with ${@:1:$length} $EXTRA_ARGS $TARGETFILE"
+fi
+
+rpmbuild ${@:1:$length} $EXTRA_ARGS $TARGETFILE
diff --git a/home/bin/setupBaseSYSROOT_armv5tel.sh b/home/bin/setupBaseSYSROOT_armv5tel.sh
new file mode 100755
index 0000000..7708759
--- /dev/null
+++ b/home/bin/setupBaseSYSROOT_armv5tel.sh
@@ -0,0 +1,138 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+if [ ! -d "$1"/sysroot ]; then
+ echo "need dir of mt-cross-tools"
+ exit 1
+fi
+
+MT_CROSS_TOOLS=$1
+
+TOOLCHAIN_ROOT=/usr/armv5tel-redhat-linux-gnueabi
+SYSROOT=${TOOLCHAIN_ROOT}/sys-root
+ARCH=armv5tel
+# we can add this back in l8r if we need it.
+# this armv7l is a softfp version of armv7
+# so it is compatible with the fedora 14 armv5tel
+# since we are now targetting armv7hl (hard fp)
+# this just confuses things
+#EXTRA_ARCHES="armv7l"
+EXTRA_ARCHES=""
+
+echo "#### Setting up XXX-${ARCH} commands for the sys-root"
+mkdir -p $HOME/bin
+cd $HOME/bin
+for t_arch in $ARCH $EXTRA_ARCHES; do
+ for cmdhead in rpm-noarch rpmbuild-noarch zypper-noarch zypper-download zypper-build-dep ; do
+ CMD=$(which ${cmdhead})
+ if [ ! -e "$CMD" ] ; then
+ echo "Unable to find ${CMD}. Did you run setupDeveloper.sh and put ~/bin in your path?"
+ exit 1
+ fi
+ ln -s ${CMD} ${cmdhead%-noarch}-${t_arch}
+ done
+done
+
+echo "#### Setting up sysroot $SYSROOT"
+sudo mkdir -p $SYSROOT
+sudo rsync -av $MT_CROSS_TOOLS/sysroot/$ARCH/* $SYSROOT/
+# make a pkgconfig dir, which we will eventually need.
+# and put a dummy file in
+sudo mkdir -p ${SYSROOT}/usr/lib/pkgconfig
+echo $SYSROOT >> /tmp/faux-nrcc.pc
+sudo mv /tmp/faux-nrcc.pc ${SYSROOT}/usr/lib/pkgconfig/faux-nrcc.pc
+
+echo "#### Installing base files into $SYSROOT"
+# install a base filesystem
+zypper-noarch ${ARCH} refresh
+zypper-noarch ${ARCH} lr
+zypper-noarch ${ARCH} -n install -n setup glibc
+
+# some things we need will fail due to scriptlets, so we'll force it
+echo "#### Current packages #####"
+rpm-noarch ${ARCH} -qa
+
+for i in coreutils glibc-headers ; do
+ echo "#### Forcing $i into sysroot"
+ # zypper-noarch ${ARCH} search $i
+ zypper-noarch ${ARCH} -n install -d -n $i
+ rpm=`find $SYSROOT/var/cache/zypp -name "$i*.rpm"`
+ echo "##### RPM=$rpm"
+ rpm-noarch ${ARCH} -i --nodeps ${rpm}
+ sudo rm -fv $rpm
+done
+
+echo "#### Installing setup and base filesystem"
+zypper-noarch ${ARCH} -n install -n setup basesystem filesystem
+
+# this is a workaround for the fact that my target skeleton (phone and qemu)
+# and the filesystem rpm clash
+#cd /tmp
+#wget http://mt-fedora.nrcc.noklab.com/fedora/nrcc/14/armv5tel/filesystem-2.4.35-2.fc14.nrcc.1.armv5tel.rpm
+#forceRpmRoot.sh /tmp/filesystem-2.4.35-2.fc14.nrcc.1.armv5tel.rpm
+#wget http://mt-fedora.nrcc.noklab.com/fedora/nrcc/14/armv5tel/basesystem-10.0-3.noarch.rpm
+#forceRpmRoot.sh /tmp/basesystem-10.0-3.noarch.rpm
+
+sudo mkdir -p ${SYSROOT}/${HOME}
+group=$GROUPS
+sudo chown $USER.$GROUP $SYSROOT/$HOME
+for t_arch in $ARCH $EXTRA_ARCHES; do
+ echo "#### Linking $HOME/rpmbuild$-{t_arch} to the sysroot"
+# link your rpmbuild to the one the sysroot sees.
+ mkdir -p $HOME/rpmbuild-${t_arch}
+ cd $SYSROOT/$HOME
+ ln -s $HOME/rpmbuild-${t_arch} rpmbuild-${t_arch}
+ sudo ln -s $HOME/rpmbuild-${t_arch} $SYSROOT/root/rpmbuild-${t_arch}
+
+done
+
+
+#link the rpm db so it is consistent in and out of the sysroot
+# i know this is weird.
+
+sudo mkdir -p $SYSROOT/$SYSROOT/var/lib
+cd $SYSROOT/$SYSROOT/var/lib
+sudo ln -s $SYSROOT/var/lib/rpm rpm
+
+# even wierder, we need the link for all the extra arches.
+# this is partly from bad planning early on. the arch in the toolchain
+# name is misleading since the arm 4.5.1 cross is happy to compile for
+# armv3,4,5,6,7
+for t_arch in $EXTRA_ARCHES; do
+ extra_toochainroot_dir=`echo $TOOLCHAIN_ROOT | sed -e "s/${ARCH}/${t_arch}/g"`
+ sudo ln -s $TOOLCHAIN_ROOT $extra_toochainroot_dir
+ extra_rpmtop_dir=`echo $SYSROOT/var/lib | sed -e "s/${ARCH}/${t_arch}/g"`
+ extra_rpm_dir=`echo $SYSROOT/$SYSROOT/var/lib | sed -e "s/${ARCH}/${t_arch}/g"`
+
+ sudo mkdir -p $extra_rpm_dir
+ cd $extra_rpm_dir
+ sudo ln -s $extra_rpmtop_dir/rpm rpm
+done
+
+
+
+echo "#### Installing glibc into $SYSROOT"
+# install the glibc we need as well as coreutils and bash
+zypper-noarch ${ARCH} -n install -n glibc glibc-common glibc-devel glibc-headers bash coreutils kernel-headers libstdc++-devel
+
diff --git a/home/bin/setupBaseSYSROOT_armv7hl.sh b/home/bin/setupBaseSYSROOT_armv7hl.sh
new file mode 100755
index 0000000..797c157
--- /dev/null
+++ b/home/bin/setupBaseSYSROOT_armv7hl.sh
@@ -0,0 +1,111 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+if [ ! -d "$1"/sysroot ]; then
+ echo "need dir of mt-cross-tools"
+ exit 1
+fi
+
+MT_CROSS_TOOLS=$1
+
+TOOLCHAIN_ROOT=/usr/armv7hl-redhat-linux-gnueabi
+SYSROOT=${TOOLCHAIN_ROOT}/sys-root
+ARCH=armv7hl
+EXTRA_ARCHES=""
+
+echo "#### Setting up XXX-${ARCH} commands for the sys-root"
+mkdir -p $HOME/bin
+cd $HOME/bin
+for t_arch in $ARCH $EXTRA_ARCHES; do
+ for cmdhead in rpm-noarch rpmbuild-noarch zypper-noarch zypper-download zypper-build-dep ; do
+ CMD=$(which ${cmdhead})
+ if [ ! -e "$CMD" ] ; then
+ echo "Unable to find ${CMD}. Did you run setupDeveloper.sh and put ~/bin in your path?"
+ exit 1
+ fi
+ ln -s ${CMD} ${cmdhead%-noarch}-${t_arch}
+ done
+done
+
+echo "#### Setting up sysroot $SYSROOT"
+sudo mkdir -p $SYSROOT
+sudo rsync -av $MT_CROSS_TOOLS/sysroot/$ARCH/* $SYSROOT/
+# make a pkgconfig dir, which we will eventually need.
+# and put a dummy file in
+sudo mkdir -p ${SYSROOT}/usr/lib/pkgconfig
+echo $SYSROOT >> /tmp/faux-nrcc.pc
+sudo mv /tmp/faux-nrcc.pc ${SYSROOT}/usr/lib/pkgconfig/faux-nrcc.pc
+
+# add the certificate for the private repo on mt-fedora
+curl http://mt-fedora.nrcc.noklab.com/mt-fedora.nrcc.noklab.com.ssl.crt | sudo tee -a /etc/pki/tls/certs/ca-bundle.crt
+
+
+# install a base filesystem
+zypper-noarch ${ARCH} refresh
+zypper-noarch ${ARCH} lr
+
+
+sudo mkdir -p ${SYSROOT}/${HOME}
+group=$GROUPS
+sudo chown $USER.$GROUP $SYSROOT/$HOME
+for t_arch in $ARCH $EXTRA_ARCHES; do
+ echo "#### Linking $HOME/rpmbuild$-{t_arch} to the sysroot"
+# link your rpmbuild to the one the sysroot sees.
+ mkdir -p $HOME/rpmbuild-${t_arch}
+ cd $SYSROOT/$HOME
+ ln -s $HOME/rpmbuild-${t_arch} rpmbuild-${t_arch}
+ sudo ln -s $HOME/rpmbuild-${t_arch} $SYSROOT/root/rpmbuild-${t_arch}
+
+done
+
+
+#link the rpm db so it is consistent in and out of the sysroot
+# i know this is weird.
+
+sudo mkdir -p $SYSROOT/$SYSROOT/var/lib
+cd $SYSROOT/$SYSROOT/var/lib
+sudo ln -s $SYSROOT/var/lib/rpm rpm
+
+# even wierder, we need the link for all the extra arches.
+# this is partly from bad planning early on. the arch in the toolchain
+# name is misleading since the arm 4.5.1 cross is happy to compile for
+# armv3,4,5,6,7
+for t_arch in $EXTRA_ARCHES; do
+ extra_toochainroot_dir=`echo $TOOLCHAIN_ROOT | sed -e "s/${ARCH}/${t_arch}/g"`
+ sudo ln -s $TOOLCHAIN_ROOT $extra_toochainroot_dir
+ extra_rpmtop_dir=`echo $SYSROOT/var/lib | sed -e "s/${ARCH}/${t_arch}/g"`
+ extra_rpm_dir=`echo $SYSROOT/$SYSROOT/var/lib | sed -e "s/${ARCH}/${t_arch}/g"`
+
+ sudo mkdir -p $extra_rpm_dir
+ cd $extra_rpm_dir
+ sudo ln -s $extra_rpmtop_dir/rpm rpm
+done
+
+
+
+echo "#### Installing glibc into $SYSROOT"
+# install the glibc we need as well as coreutils and bash
+#libstdc++-devel
+zypper-noarch ${ARCH} -n install -n setup glibc glibc-common glibc-devel glibc-headers kernel-headers
+
diff --git a/home/bin/setupDeveloper.sh b/home/bin/setupDeveloper.sh
new file mode 100755
index 0000000..061b15c
--- /dev/null
+++ b/home/bin/setupDeveloper.sh
@@ -0,0 +1,193 @@
+#!/bin/sh
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+RPM_SERVER=mt-fedora.nrcc.noklab.com
+RPM_CROSS_REPO=repos/f14-cross/
+VERSIONLOCK_FILE=/etc/yum/pluginconf.d/versionlock.list
+FRELEASEVER=" --releasever 14"
+
+# some of these are for documentation, some are because configure is hardcoded to /usr/include.
+# sigh.
+# needed for docs:
+# xmlto
+# docbook2ps
+# needed to build wayland:
+# libffi-devel
+# expat-devel
+
+#
+# the rest are needed for cross env/rpmbuild
+
+# note, tcl is *only* needed if you want to build tcl for arm
+YUMLIST_NRCC="zypper \
+cross-rpm-config \
+redhat-rpm-config \
+armv5tel-redhat-linux-gnueabi-binutils \
+armv5tel-redhat-linux-gnueabi-cpp \
+armv5tel-redhat-linux-gnueabi-gcc \
+armv5tel-redhat-linux-gnueabi-gcc-c++ \
+armv5tel-redhat-linux-gnueabi-libgcc \
+armv5tel-redhat-linux-gnueabi-libgomp \
+armv5tel-redhat-linux-gnueabi-libmudflap \
+armv5tel-redhat-linux-gnueabi-libmudflap-devel \
+armv5tel-redhat-linux-gnueabi-libstdc++ \
+armv5tel-redhat-linux-gnueabi-libstdc++-devel \
+armv7hl-redhat-linux-gnueabi-binutils \
+armv7hl-redhat-linux-gnueabi-gcc \
+xmlto \
+docbook2ps \
+rpmdevtools \
+libffi-devel \
+docbook-utils-pdf \
+chrpath \
+glib2-devel \
+gtk-doc \
+compat-flex \
+linuxdoc-tools \
+w3m \
+docbook-style-xsl \
+docbook-dtds \
+tcl \
+asciidoc \
+sharutils \
+fdupes \
+expat-devel"
+
+
+RPMLIST_NRCC="redhat-rpm-config-9.1.0-5.fc14.nrcc.2 \
+rpm-build-4.8.1-5.fc14.nrcc.9 \
+rpm-4.8.1-5.fc14.nrcc.9 \
+rpm-apidocs-4.8.1-5.fc14.nrcc.9 \
+rpm-python-4.8.1-5.fc14.nrcc.9 \
+rpm-cron-4.8.1-5.fc14.nrcc.9 \
+rpm-libs-4.8.1-5.fc14.nrcc.9 "
+
+
+if [ ! -d "$1"/sysroot ]; then
+ echo "need dir of mt-cross-tools"
+ exit 1
+fi
+
+## add in the private repo certificate so zypper will play nice with it.
+## this goes in the host machine certs, not the sysroots
+curl http://mt-fedora/mt-fedora.nrcc.noklab.com.ssl.crt | sudo tee -a /etc/pki/tls/certs/ca-bundle.crt
+
+
+SPHONE_DIR=$1
+
+mkdir -p ~/bin
+rsync -av $SPHONE_DIR/home/.rpm* ~/
+
+cd ~/bin
+for i in $SPHONE_DIR/home/bin/* ; do
+ echo "linking $i to $(basename $i) in `pwd`"
+ ln -sf $i $(basename $i)
+done
+
+
+
+#force in basic needed packages
+echo "Installing Development Tools"
+sudo yum ${FRELEASEVER} -y groupinstall "Development Tools"
+rpm -q wget || (echo "Installing wget"; sudo yum -y install wget)
+
+# yum-plugin-versionlock allows pinning for yum
+sudo yum -y install yum-plugin-versionlock
+
+# the doofy plugin doesnt make an empty one nor does it work w/o one
+sudo touch $VERSIONLOCK_FILE
+sudo chmod 644 $VERSIONLOCK_FILE
+
+echo "Installing /etc/yum.repos.d/f14-cross.repo"
+# grab the nrcc repo
+if [ ! -e /etc/yum.repos.d/f14-cross.repo ]; then
+ cd /tmp
+ rm -f f14-cross.repo
+ wget http://$RPM_SERVER/f14-cross.repo
+ if [ -e /tmp/f14-cross.repo ]; then
+ sudo mv f14-cross.repo /etc/yum.repos.d/f14-cross.repo
+ else
+ echo "Couldnt retrieve the nrcc repo file"
+ echo "baggin out"
+ exit 1
+ fi
+fi
+
+for i in $YUMLIST_NRCC; do
+ rpm -q $i || (echo YUMMING $i; sudo yum -y install $i)
+done
+
+
+
+
+echo "Installing and Pinning NRCC Versions"
+# we are making a manifest file so dependencies are all resolved at once
+RPM_MANIFEST=/tmp/`mktemp RPM_MANIFEST_XXXXX`
+for i in $RPMLIST_NRCC; do
+ cd /tmp
+ #check for our file in versionlock
+ BASE_NAME=`echo $i | sed -e 's/-[0-9]/ /' | cut -f1 -d ' '`
+ BASE_NAME_VERSIONED=`echo $i | sed -e 's/-[0-9]/& /' | cut -f1 -d ' '`
+ if sudo yum versionlock list | egrep $BASE_NAME_VERSIONED ; then
+ # remove it from the version lock. so we can grab the one we want.
+ VENTRY=`sudo yum versionlock list | egrep $BASE_NAME_VERSIONED`
+ sudo yum versionlock delete $VENTRY
+ fi
+ # the doofy plugin *sometimes* reverts the permissions to 600 instead of 644
+ sudo chmod 644 $VERSIONLOCK_FILE
+ # using yumdownloader meand we get i686 or x86_64 whichever is correct
+ yumdownloader --disablerepo=* --enablerepo=f14-cross $BASE_NAME
+ echo "$i*rpm" >> $RPM_MANIFEST
+ sudo yum versionlock $i
+done
+
+# the doofy plugin *sometimes* reverts the permissions to 600 instead of 644
+sudo chmod 644 $VERSIONLOCK_FILE
+sudo rpm -Uv --force $RPM_MANIFEST
+rm -f $RPM_MANIFEST
+rm -rf /tmp/*rpm
+
+echo "Making ARM links"
+cd ~/bin
+for base_name in armv5tel-redhat armv7hl-redhat; do
+ for newprefix in arm arm-none ; do
+ for i in /usr/bin/${base_name}*; do
+ oldname=$(basename $i)
+ linkname=${newprefix}${oldname#${base_name}}
+ echo Redirecting to $i from ${linkname}
+ ln -sf $i ${linkname}
+ done
+ done
+done
+NUM_CPUS=`grep processor /proc/cpuinfo | tail -1 | cut -f2 -d ':'`
+
+if [ "$NUM_CPUS" == "0" ]; then
+echo "# %_smp_mflags -j${NUM_CPUS}" >> ~/.rpmmacros
+else
+echo "%_smp_mflags -j${NUM_CPUS}" >> ~/.rpmmacros
+fi
+
+
+
+
diff --git a/home/bin/unbindChroot.sh b/home/bin/unbindChroot.sh
new file mode 100755
index 0000000..6064004
--- /dev/null
+++ b/home/bin/unbindChroot.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+# unset up the bind mounts
+
+if [ "$1" == "" ]; then
+ echo "need abs path of chroot"
+ exit 1
+fi
+
+CHROOT_DIR=$1
+
+sudo fuser -k ${CHROOT_DIR}
+
+sudo umount ${CHROOT_DIR}/proc
+sudo umount ${CHROOT_DIR}/dev/pts
+sudo umount ${CHROOT_DIR}/dev/
+sudo umount ${CHROOT_DIR}/dev/pts
+sudo umount ${CHROOT_DIR}/sys
+sudo umount ${CHROOT_DIR}/tmp
+
diff --git a/home/bin/uploadRPMS.sh b/home/bin/uploadRPMS.sh
new file mode 100755
index 0000000..1859447
--- /dev/null
+++ b/home/bin/uploadRPMS.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+REPO_SERVER=mt-fedora.nrcc.noklab.com
+REPO_PATH=/srv/www/repos/f14-
+
+
+USAGE="Usage: $0 [shared|sysroot|platform|private] rpm1 rpm2 rpm3 rpmN"
+
+if [ "$#" == "0" ]; then
+ echo "$USAGE"
+ exit 1
+fi
+
+
+
+DEST=$1
+shift
+
+if [ "$DEST" != "shared" -a "$DEST" != "platform" -a "$DEST" != "sysroot" -a "$DEST" != "private" ]; then
+ echo "$USAGE"
+ exit 1
+fi
+REPO_PATH="${REPO_PATH}${DEST}/incoming/"
+
+# copy over the rpms
+while (( "$#" )); do
+ echo "working on $1"
+ if [ ! -e "$1" ]; then
+ echo "can't find file $1 to upload"
+ exit
+ fi;
+ rsync -av $1 $REPO_SERVER:$REPO_PATH
+ shift
+done
+
+
+# and make them available
+#ssh $REPO_SERVER "sudo /root/bin/make.repos.incoming" >>/dev/null &
+# better to know when it is done...
+ssh $REPO_SERVER "sudo /root/bin/make.repos.incoming" \ No newline at end of file
diff --git a/home/bin/zypper-build-dep b/home/bin/zypper-build-dep
new file mode 100755
index 0000000..43f5dd8
--- /dev/null
+++ b/home/bin/zypper-build-dep
@@ -0,0 +1,64 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+BASENAME=$(basename $0)
+ARCH=${BASENAME##*-}
+filetype="package"
+usage="$(basename $0) [-a ARCH] [-n] SPEC_FILE+"
+
+NON_INTERACTIVE=""
+QUIET=""
+while getopts "a:hqn" opt ; do
+ case $opt in
+ a) ARCH="$OPTARG";;
+ h) echo $usage; exit 0;;
+ n) NON_INTERACTIVE="--non-interactive";;
+ q) QUIET="--quiet";;
+ \?) echo "Bad option"; exit 1;;
+ esac
+done
+shift $(($OPTIND-1))
+
+VARCACHE="/var/cache/zypp/packages"
+ZYPP_CONF="/etc/zypp/zypp.conf"
+ZYPPER="zypper"
+
+if [ "$ARCH" != "build-dep" ] ; then
+ SYSROOT=/usr/${ARCH}-redhat-linux-gnueabi/sys-root
+ ZYPP_CONF="${SYSROOT}${ZYPP_CONF}"
+ VARCACHE="${SYSROOT}${VARCACHE}"
+ ZYPPER="ZYPP_CONF=${ZYPP_CONF} zypper -R ${SYSROOT}"
+fi
+
+
+for i in "$*" ; do
+ echo "i=$i arch= ${ARCH}"
+ INSTALL_LIST=""
+ for j in `rpmbuild-${ARCH} -bp $i 2>&1 | egrep "is needed by" | cut -f1 -d ' '` ; do
+ INSTALL_LIST=$INSTALL_LIST" $j"
+ done
+ if [ "$INSTALL_LIST" != "" ]; then
+ zypper-${ARCH} $NON_INTERACTIVE $QUIET install --no-recommends $INSTALL_LIST;
+ fi
+done
diff --git a/home/bin/zypper-download b/home/bin/zypper-download
new file mode 100755
index 0000000..92a02db
--- /dev/null
+++ b/home/bin/zypper-download
@@ -0,0 +1,88 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+
+BASENAME=$(basename $0)
+ARCH=${BASENAME##*-}
+filetype="package"
+usage="$(basename $0) [-s] [-a ARCH] [-r reponame]+ PACKAGE+"
+REPOLIST=""
+while getopts "a:r:hs" opt ; do
+ case $opt in
+ a) ARCH="$OPTARG";;
+ r) REPOLIST="$REPOLIST --repo=$OPTARG";;
+ h) echo $usage; exit 0;;
+ s) filetype="srcpackage";;
+ \?) echo "Bad option"; exit 1;;
+ esac
+done
+shift $(($OPTIND-1))
+
+VARCACHE="/var/cache/zypp/packages"
+ZYPP_CONF="/etc/zypp/zypp.conf"
+ZYPPER="zypper"
+
+if [ "$ARCH" != "download" ] ; then
+ SYSROOT=/usr/${ARCH}-redhat-linux-gnueabi/sys-root
+ ZYPP_CONF="${SYSROOT}${ZYPP_CONF}"
+ VARCACHE="${SYSROOT}${VARCACHE}"
+ ZYPPER="ZYPP_CONF=${ZYPP_CONF} zypper -R ${SYSROOT}"
+fi
+
+for i in "$*" ; do
+ echo "Searching for $filetype $i"
+ tmpfile=$(mktemp)
+ sudo $ZYPPER -n install --force -d $REPOLIST -t $filetype $i > $tmpfile
+ pkgname=$(awk -F\' '/Forcing installation/ {print $2}' $tmpfile)
+ reponame=$(awk -F\' '/Forcing installation/ {print $4}' $tmpfile)
+ rm $tmpfile
+ if [ "$pkgname" ] ; then
+ echo "Found package name $pkgname in repo '$reponame'"
+ awkprog='BEGIN {FS=" *\\| *"} {if ($3=="'$reponame'") print $2}'
+ repovalue=$(sudo $ZYPPER repos | awk "$awkprog")
+ filename="${VARCACHE}/${repovalue}/${pkgname}"
+ if [ "$filetype" = "package" ] ; then
+ filename="${filename}.rpm"
+ else
+ filename="${filename%.noarch}.src.rpm"
+ fi
+ if [ -f "$filename" ] ; then
+ echo "Copying $filename to local directory"
+ cp $filename $(basename $filename)
+ else
+ # epochs in files really really suck for zypper...
+ # for epoch 6, frex, they add a 6: before the version
+ # in the rpm data but not in the filename
+ filename=`echo $filename | sed -e "s/[0-9]*://"`
+ if [ -f "$filename" ] ; then
+ echo "Copying $filename to local directory"
+ cp $filename $(basename $filename)
+ else
+ echo "Package '$filename' isn't where I thought it should be!"
+ fi
+ fi
+ fi
+done
+
+
+
diff --git a/home/bin/zypper-noarch b/home/bin/zypper-noarch
new file mode 100755
index 0000000..3458538
--- /dev/null
+++ b/home/bin/zypper-noarch
@@ -0,0 +1,66 @@
+#!/bin/bash
+####
+# Copyright (c) 2011 Nokia Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without
+# limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+####
+#
+# Usage:
+#
+# zypper-noarch ARCH ARGS...
+# OR
+# zypper-armv5tel ARGS...
+#
+# The architecture is derived from the name of the shell script, or by
+# running the generic script and passing the architecture as the first argument.
+# This allows us to create a softlink to the shell script for each possible architecture.
+#
+# E.g.: ln -s zypper-noarch zypper-armv5tel
+#
+
+BASENAME=$(basename $0)
+ARCH=${BASENAME#*-}
+if [ "$ARCH" = "noarch" ] ; then
+ ARCH=$1
+ shift
+fi
+
+export SYSROOT=/usr/${ARCH}-redhat-linux-gnueabi/sys-root
+export PKG_CONFIG_PATH=${SYSROOT}/usr/lib/pkgconfig
+
+sudo ZYPP_CONF=${SYSROOT}/etc/zypp/zypp.conf zypper -R $SYSROOT $*
+
+# in case anything we installed added a pkgconfig file, we need to "fix" it to be sysroot friendly
+
+if [ -d ${PKG_CONFIG_PATH} ]; then
+ for i in ${PKG_CONFIG_PATH}/*.pc ; do
+ if [ -f "$i" ]; then
+ if ! grep ${SYSROOT} $i >> /dev/null ; then
+ echo Fixing "$i";
+ sudo cp $i $i.orig
+ sudo sed -i -e "s:=/usr:=${SYSROOT}/usr:" $i
+ sudo sed -i -e "s:=/lib:=${SYSROOT}/lib:" $i
+ sudo sed -i -e "s:-I/usr/include:-I${SYSROOT}/usr/include:" $i
+ sudo sed -i -e "s:-L/usr/lib:-L${SYSROOT}/usr/lib:" $i;
+ sudo sed -i -e "s:=/opt/mt:=${SYSROOT}/opt/mt:" $i
+ fi
+ fi
+ done
+fi