contrib/deploy/nfs/: Tools to deploy OE images for NFS boot.
authorPaul Sokolovsky <pmiscml@gmail.com>
Tue, 25 Dec 2007 17:35:14 +0000 (17:35 +0000)
committerPaul Sokolovsky <pmiscml@gmail.com>
Tue, 25 Dec 2007 17:35:14 +0000 (17:35 +0000)
* Provides best practices for exports locations and sample of exports file.
(The same location is used by default by initramfs-uniboot).
* Tool to deploy tar.bz2/tar.gz/cpio.gz images to exported location.

contrib/deploy/nfs/.mtn2git_empty [new file with mode: 0644]
contrib/deploy/nfs/exports.sample [new file with mode: 0644]
contrib/deploy/nfs/oe-nfs-deploy-image [new file with mode: 0755]

diff --git a/contrib/deploy/nfs/.mtn2git_empty b/contrib/deploy/nfs/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/contrib/deploy/nfs/exports.sample b/contrib/deploy/nfs/exports.sample
new file mode 100644 (file)
index 0000000..6d82f49
--- /dev/null
@@ -0,0 +1,2 @@
+# /etc/exports: NFS file systems being exported.  See exports(5).
+/srv/nfs/oe    192.168.0.0/16(rw,insecure,no_root_squash)
diff --git a/contrib/deploy/nfs/oe-nfs-deploy-image b/contrib/deploy/nfs/oe-nfs-deploy-image
new file mode 100755 (executable)
index 0000000..ee54069
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# Wonder what the heck is /srv ? Read Filesystem Hierarchy Standard,
+# http://www.pathname.com/fhs/pub/fhs-2.3.html#SRVDATAFORSERVICESPROVIDEDBYSYSTEM
+# So, /srv/nfs is root of all NFS exports your system offers, and /srv/nfs/oe is
+# OpenEmbedded's subset (think security).
+NFS_ROOT=/srv/nfs/oe
+
+if [ -z "$1" ]; then
+    echo "$0 - Deploy OpenEmbedded-generated image for device NFS boot"
+    echo "Usage: $0 <image> | -l"
+    exit
+fi
+
+if [ "$1" == "-l" ]; then
+    if [ -n "$2" ]; then
+       extra="-name *$2*"
+    fi
+    find tmp/deploy/ -regextype posix-extended -wholename '*/images/*' -regex '.+\.(tar\.bz2|tar\.gz|cpio\.gz)$' $extra | xargs ls -l
+    exit
+fi
+
+if [ ! -f $1 ]; then
+    echo "Cannot find image $1"
+    exit
+fi
+
+ext=`echo $1 | sed -r -e 's/.+\.([^.]+\.[^.]+)/\1/'`
+basename=`basename $1 .$ext`
+
+if [ -z "$basename" ]; then
+    echo "Assertion failed"
+    exit 100
+fi
+
+echo "Deploying to: $NFS_ROOT/$basename"
+
+rm -rf $NFS_ROOT/$basename
+
+mkdir -p $NFS_ROOT/$basename
+
+if [ "$ext" == "tar.bz2" ]; then
+    tar -xj -f $1 -C $NFS_ROOT/$basename
+elif [ "$ext" == "tar.gz" ]; then
+    tar -xz -f $1 -C $NFS_ROOT/$basename
+else
+    FPATH=`pwd`
+    cd $NFS_ROOT/$basename 
+    bash -c "gzip -d -c $FPATH/$1 | cpio -i --no-absolute-filenames"
+    cd $FPATH
+fi