From 3f2cf1cba63b9c54c48a7cbf0d870c185429860d Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Mon, 18 Dec 2017 18:26:53 +0000 Subject: [PATCH] Fix addssh make target in tinyipa This is a followup to Ib6fcd5bbd7e79b9df83b660441dd685b1b17be62 It reuses more common code when adding authorized SSH keys to the tinyipa image during rebuild and adds its directory to the list to be cleaned. Change-Id: Id47add60d7ad8f4266dfd2b1a3b00e45607abd5b --- imagebuild/tinyipa/Makefile | 1 + imagebuild/tinyipa/add-ssh-tinyipa.sh | 19 +++++-------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/imagebuild/tinyipa/Makefile b/imagebuild/tinyipa/Makefile index 7fa83d725..ad0bf47ba 100644 --- a/imagebuild/tinyipa/Makefile +++ b/imagebuild/tinyipa/Makefile @@ -27,6 +27,7 @@ clean_build: sudo -v sudo rm -rf tinyipabuild sudo rm -rf tinyipafinal + sudo rm -rf tinyipaaddssh rm -f *tinyipa*.vmlinuz rm -f *tinyipa*.gz rm -f *tinyipa*.sha256 diff --git a/imagebuild/tinyipa/add-ssh-tinyipa.sh b/imagebuild/tinyipa/add-ssh-tinyipa.sh index a1de35065..c1372e0a5 100755 --- a/imagebuild/tinyipa/add-ssh-tinyipa.sh +++ b/imagebuild/tinyipa/add-ssh-tinyipa.sh @@ -19,24 +19,16 @@ set -ex WORKDIR=$(readlink -f $0 | xargs dirname) -REBUILDDIR="$WORKDIR/rebuild" +REBUILDDIR="$WORKDIR/tinyipaaddssh" DST_DIR=$REBUILDDIR source ${WORKDIR}/common.sh -source ${WORKDIR}/build_files/tc-mirror.sh TINYCORE_MIRROR_URL=${TINYCORE_MIRROR_URL:-} BRANCH_PATH=${BRANCH_PATH:-master} TINYIPA_RAMDISK_FILE=${TINYIPA_RAMDISK_FILE:-} SSH_PUBLIC_KEY=${SSH_PUBLIC_KEY:-} -TC=1001 -STAFF=50 - -CHROOT_PATH="/tmp/overides:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin" -CHROOT_CMD="sudo chroot $REBUILDDIR /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 $REBUILDDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy" - function validate_params { echo "Validating location of public SSH key" if [ -n "$SSH_PUBLIC_KEY" ]; then @@ -56,16 +48,14 @@ function validate_params { echo "Failed to find neither provided nor default SSH key" exit 1 fi - - choose_tc_mirror } function get_tinyipa { if [ -z $TINYIPA_RAMDISK_FILE ]; then mkdir -p $WORKDIR/build_files/cache cd $WORKDIR/build_files/cache - wget -N https://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-${BRANCH_PATH}.gz - TINYIPA_RAMDISK_FILE="$WORKDIR/build_files/cache/tinyipa-${BRANCH_PATH}.gz" + wget -N https://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa${BRANCH_EXT}.gz + TINYIPA_RAMDISK_FILE="$WORKDIR/build_files/cache/tinyipa${BRANCH_EXT}.gz" fi } @@ -132,6 +122,7 @@ function rebuild_ramdisk { sudo -v +validate_params get_tinyipa unpack_ramdisk setup_tce "$DST_DIR" @@ -144,5 +135,5 @@ install_ssh # with 'sudo' afterwards fix_python_optimize -cleanup_tce $DST_DIR +cleanup_tce "$DST_DIR" rebuild_ramdisk