From: Jonathan Rajotte Date: Tue, 23 Feb 2016 17:01:23 +0000 (-0500) Subject: Lava: rootfs generation via vmdeboostrap X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0e37945f2de38d0c816ea779c451818714a903a5;p=lttng-ci.git Lava: rootfs generation via vmdeboostrap --- diff --git a/lava/rootfs/vmdeboostrap/README.md b/lava/rootfs/vmdeboostrap/README.md new file mode 100644 index 0000000..04fc453 --- /dev/null +++ b/lava/rootfs/vmdeboostrap/README.md @@ -0,0 +1,16 @@ +# How to + +For Ubuntu trusty amd64 +$ ARCH=amd64 DISTRIBUTION=trusty ./lttng-rootfs.sh + +For Ubuntu trusty armhf +$ ARCH=armhf DISTRIBUTION=trusty MIRROR=http://ports.ubuntu.com ./lttng-rootfs.sh --foreign=/usr/bin/qemu-arm-static + +Can be used for debian rootfs + +# Requirement + +* vmdeboostrap v1.3 - git://git.liw.fi/vmdebootstrap + Looks like v1.4 fail on dhcp configuration. +* cliapp - git://git.liw.fi/cliapp + diff --git a/lava/rootfs/vmdeboostrap/external-packages.sha1sum b/lava/rootfs/vmdeboostrap/external-packages.sha1sum new file mode 100644 index 0000000..105a30a --- /dev/null +++ b/lava/rootfs/vmdeboostrap/external-packages.sha1sum @@ -0,0 +1,2 @@ +5bfe242e609717d86e734e42e8a357947fbd70b3 linaro-overlay_1112.2_all.deb +00970ed3c6f0722b30163f0ffa87d7216199cdda linaro-overlay-minimal_1112.2_all.deb diff --git a/lava/rootfs/vmdeboostrap/lava-vmdebootstrap b/lava/rootfs/vmdeboostrap/lava-vmdebootstrap new file mode 100755 index 0000000..76c746d --- /dev/null +++ b/lava/rootfs/vmdeboostrap/lava-vmdebootstrap @@ -0,0 +1,27 @@ +#!/bin/sh + +set -e + +# temporary: download linaro-overlay packages, which provide +# auto-serial-console. Plans for the future include providing +# auto-serial-console in the Debian archive so we don't need this. +PREFIX=https://launchpad.net/~linaro-maintainers/+archive/overlay/+files +set -x +while read line; do + if ! echo "$line" | sha1sum --check --quiet - > /dev/null 2>&1; then + package=$(echo "$line" | awk '{ print($2) }') + echo "Downloading $package ..." + wget --quiet $PREFIX/$package + echo "$line" | sha1sum --check --quiet + fi +done < external-packages.sha1sum + +set -x +sudo vmdebootstrap \ + --custom-package='linaro-overlay_1112.2_all.deb' \ + --custom-package='linaro-overlay-minimal_1112.2_all.deb' \ + --enable-dhcp \ + --serial-console --serial-console-command='/bin/auto-serial-console' \ + --root-password='root' \ + --verbose \ + "$@" diff --git a/lava/rootfs/vmdeboostrap/lttng-rootfs.sh b/lava/rootfs/vmdeboostrap/lttng-rootfs.sh new file mode 100755 index 0000000..87ea305 --- /dev/null +++ b/lava/rootfs/vmdeboostrap/lttng-rootfs.sh @@ -0,0 +1,45 @@ +#!/bin/bash -xue +# Copyright (C) 2016- Jonathan Rajotte-Julien +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -x + +# http://stackoverflow.com/questions/4609668/override-variable-in-bash-script-from-command-line +: ${ARCH:="amd64"} +: ${DISTRIBUTION:="trusty"} +: ${MIRROR:=http://archive.ubuntu.com/ubuntu} +: ${COMPONENTS:=universe,multiverse,main,restricted} + +date=`date +%Y-%m-%d-%H%M` +tarname="rootfs_${ARCH}_${DISTRIBUTION}_${date}.tar" + +./lava-vmdebootstrap \ + --arch=$ARCH \ + --distribution=$DISTRIBUTION \ + --tarball $tarname \ + --mirror=$MIRROR \ + --package=autoconf,automake,bash-completion,bison,bsdtar,build-essential,chrpath,clang,cloc,cppcheck,curl,flex,gettext,git,htop,jq,libglib2.0-dev,libpopt-dev,libtap-harness-archive-perl,libtool,libxml2-dev,python-virtualenv,python3,python3-dev,python3-sphinx,swig2.0,texinfo,tree,uuid-dev,vim,wget \ + --debootstrapopts=components=main,universe,multiverse\ + --hostname='linaro-server' \ + --user=linaro/linaro \ + --no-kernel \ + "$@" + +if [ $? -ne 0 ]; then + echo "An error occurred" + exit +else + gzip --best $tarname +fi