From 4230a3ba6e4360371e259f2b102bf4518134344e Mon Sep 17 00:00:00 2001 From: Sam Betts Date: Fri, 8 Apr 2016 15:45:35 +0100 Subject: [PATCH] Add script to install missing tinyipa dependencies Squashfs-tools is missing when building the tinyipa image during the post job, this patch adds a new script to the tinyipa build process that ensures that missing dependencies get installed as part of the build process. It also replaces a use of realpath it build-iso.sh where it should be readlink to ensure that we don't need that dependency. Change-Id: I9a60dcf42f6a9ba624aa347f0f375bb40432ef77 Closes-Bug: #1567981 --- imagebuild/tinyipa/Makefile | 8 ++++++-- imagebuild/tinyipa/build-iso.sh | 2 +- imagebuild/tinyipa/build-tinyipa.sh | 3 +++ imagebuild/tinyipa/finalise-tinyipa.sh | 2 ++ imagebuild/tinyipa/install-deps.sh | 17 +++++++++++++++++ 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 imagebuild/tinyipa/install-deps.sh diff --git a/imagebuild/tinyipa/Makefile b/imagebuild/tinyipa/Makefile index 4666a2c89..50379651e 100644 --- a/imagebuild/tinyipa/Makefile +++ b/imagebuild/tinyipa/Makefile @@ -1,6 +1,10 @@ -default: build finalise +.PHONY: default all dependencies build finalise iso clean clean_build clean_iso +default: dependencies build finalise -all: build finalise iso +all: dependencies build finalise iso + +dependencies: + ./install-deps.sh build: ./build-tinyipa.sh diff --git a/imagebuild/tinyipa/build-iso.sh b/imagebuild/tinyipa/build-iso.sh index 5ac76636b..be0db458e 100755 --- a/imagebuild/tinyipa/build-iso.sh +++ b/imagebuild/tinyipa/build-iso.sh @@ -1,7 +1,7 @@ #!/bin/sh set -ex -WORKDIR=$(realpath $0 | xargs dirname) +WORKDIR=$(readlink -f $0 | xargs dirname) cd $WORKDIR/build_files wget -N https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-4.06.tar.gz && tar zxf syslinux-4.06.tar.gz diff --git a/imagebuild/tinyipa/build-tinyipa.sh b/imagebuild/tinyipa/build-tinyipa.sh index 6bd04e43b..5d6fe53aa 100755 --- a/imagebuild/tinyipa/build-tinyipa.sh +++ b/imagebuild/tinyipa/build-tinyipa.sh @@ -10,6 +10,9 @@ CHROOT_CMD="sudo chroot $BUILDDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$ TC=1001 STAFF=50 + +echo "Building tinyipa:" + # Ensure we have an extended sudo to prevent the need to enter a password over # and over again. sudo -v diff --git a/imagebuild/tinyipa/finalise-tinyipa.sh b/imagebuild/tinyipa/finalise-tinyipa.sh index ee42bfbcc..f85bc234b 100755 --- a/imagebuild/tinyipa/finalise-tinyipa.sh +++ b/imagebuild/tinyipa/finalise-tinyipa.sh @@ -13,6 +13,8 @@ CHROOT_PATH="/tmp/overides:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/u CHROOT_CMD="sudo chroot $FINALDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy" TC_CHROOT_CMD="sudo chroot --userspec=$TC:$STAFF $FINALDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy" +echo "Finalising tinyipa:" + sudo -v if [ -d "$FINALDIR" ]; then diff --git a/imagebuild/tinyipa/install-deps.sh b/imagebuild/tinyipa/install-deps.sh new file mode 100755 index 000000000..6737856e9 --- /dev/null +++ b/imagebuild/tinyipa/install-deps.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +PACKAGES="wget python-pip unzip sudo gawk squashfs-tools" + +echo "Installing dependencies:" + +if [ -x "/usr/bin/apt-get" ]; then + sudo -E apt-get update + sudo -E apt-get install -y $PACKAGES +elif [ -x "/usr/bin/dnf" ]; then + sudo -E dnf install -y $PACKAGES +elif [ -x "/usr/bin/yum" ]; then + sudo -E yum install -y $PACKAGES +else + echo "No supported package manager installed on system. Supported: apt, yum, dnf" + exit 1 +fi