mirror of
https://github.com/clearlinux/swupd-server.git
synced 2026-04-28 10:53:50 +00:00
Align variable default values in builder scripts
Also, make some of the variables overridable in the environment. Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
#!/bin/bash
|
||||
VER=$1
|
||||
XZ_DEFAULTS="--threads 0"
|
||||
PREVREL=`cat /var/lib/update/image/latest.version`
|
||||
|
||||
SWUPDREPO=/usr/src/clear-projects/swupd-server
|
||||
BUNDLEREPO=/usr/src/clear-projects/clr-bundles
|
||||
UPDATEDIR=/var/lib/update
|
||||
SWUPDREPO=${SWUPDREPO:-"/usr/src/clear-projects/swupd-server"}
|
||||
BUNDLEREPO=${BUNDLEREPO:-"/usr/src/clear-projects/clr-bundles"}
|
||||
UPDATEDIR=${UPDATEDIR:-"/var/lib/update"}
|
||||
|
||||
PREVREL=`cat ${UPDATEDIR}/image/latest.version`
|
||||
|
||||
error() {
|
||||
echo "${1:-"Unknown Error"}"
|
||||
@@ -16,7 +17,7 @@ error() {
|
||||
# eg: all of openstack, pnp, bat, cloud stuff, non-basic scripting language bundles
|
||||
${SWUPDREPO}/mk_groups_ini.sh
|
||||
|
||||
export SWUPD_CERTS_DIR="/root/swupd-certs"
|
||||
export SWUPD_CERTS_DIR=${SWUPD_CERTS_DIR:-"/root/swupd-certs"}
|
||||
export LEAF_KEY="leaf.key.pem"
|
||||
export LEAF_CERT="leaf.cert.pem"
|
||||
export CA_CHAIN_CERT="ca-chain.cert.pem"
|
||||
@@ -54,12 +55,12 @@ popd ${SWUPDREPO}
|
||||
|
||||
# expose the new build to staging / testing
|
||||
echo ${VER} > ${UPDATEDIR}/image/latest.version
|
||||
STAGING=$(cat ${UPDATEDIR}/www//version/formatstaging/latest)
|
||||
STAGING=$(cat ${UPDATEDIR}/www/version/formatstaging/latest)
|
||||
if [ "${STAGING}" -lt "${VER}" ]; then
|
||||
echo ${VER} > ${UPDATEDIR}/www//version/formatstaging/latest
|
||||
echo ${VER} > ${UPDATEDIR}/www/version/formatstaging/latest
|
||||
fi
|
||||
|
||||
#valgrind /usr/src/clear-projects/swupd-server/swupd_create_update ${VER}
|
||||
time hardlink /var/lib/update/image/${VER}/*
|
||||
time hardlink /var/lib/update/image/$PREVREL /var/lib/update/image/${VER}
|
||||
time hardlink /var/lib/update/www/$PREVREL /var/lib/update/www/${VER}
|
||||
#valgrind ${SWUPDREPO}/swupd_create_update ${VER}
|
||||
time hardlink ${UPDATEDIR}/image/${VER}/*
|
||||
time hardlink ${UPDATEDIR}/image/${PREVREL} ${UPDATEDIR}/image/${VER}
|
||||
time hardlink ${UPDATEDIR}/www/${PREVREL} ${UPDATEDIR}/www/${VER}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#! /bin/bash
|
||||
|
||||
COMMON=${COMMON:-"/root/common"}
|
||||
BUNDLEREPO=${BUNDLEREPO:-"/root/clr-bundles"}
|
||||
BUNDLEREPO=${BUNDLEREPO:-"/usr/src/clear-projects/clr-bundles"}
|
||||
|
||||
SWUPD_SERVER_DIR=${SWUPD_SERVER_DIR:-"/var/lib/update"}
|
||||
SWUPD_GROUPS_INI=${SWUPD_GROUPS_INI:-"$SWUPD_SERVER_DIR/groups.ini"}
|
||||
SWUPD_SERVER_INI=${SWUPD_SERVER_INI:-"$SWUPD_SERVER_DIR/server.ini"}
|
||||
UPDATEDIR=${UPDATEDIR:-"/var/lib/update"}
|
||||
SWUPD_GROUPS_INI=${SWUPD_GROUPS_INI:-"$UPDATEDIR/groups.ini"}
|
||||
SWUPD_SERVER_INI=${SWUPD_SERVER_INI:-"$UPDATEDIR/server.ini"}
|
||||
|
||||
if [ ! -d "$SWUPD_SERVER_DIR" ]; then
|
||||
mkdir -p $SWUPD_SERVER_DIR/{image,www}
|
||||
if [ ! -d "$UPDATEDIR" ]; then
|
||||
mkdir -p $UPDATEDIR/{image,www}
|
||||
fi
|
||||
|
||||
if [ ! -f "$SWUPD_SERVER_INI" ]; then
|
||||
@@ -17,8 +17,8 @@ if [ ! -f "$SWUPD_SERVER_INI" ]; then
|
||||
cp -p $template/server.ini $SWUPD_SERVER_INI
|
||||
fi
|
||||
|
||||
if [ ! -f "$SWUPD_SERVER_DIR/image/latest.version" ]; then
|
||||
echo "0" > $SWUPD_SERVER_DIR/image/latest.version
|
||||
if [ ! -f "$UPDATEDIR/image/latest.version" ]; then
|
||||
echo "0" > $UPDATEDIR/image/latest.version
|
||||
fi
|
||||
|
||||
echo "rebuilding $SWUPD_GROUPS_INI based on $BUNDLEREPO"
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
# consider which version-pair packs are meaningful for intermediate builds
|
||||
# and revert builds.
|
||||
|
||||
SWUPDREPO=${SWUPDREPO:-"/root/swupd-server"}
|
||||
BUNDLEREPO=${BUNDLEREPO:-"/root/clr-bundles"}
|
||||
SWUPDWEBDIR="/var/lib/update/www"
|
||||
SWUPDREPO=${SWUPDREPO:-"/usr/src/clear-projects/swupd-server"}
|
||||
BUNDLEREPO=${BUNDLEREPO:-"/usr/src/clear-projects/clr-bundles"}
|
||||
UPDATEDIR=${UPDATEDIR:-"/var/lib/update"}
|
||||
SWUPDWEBDIR="${UPDATEDIR}/www"
|
||||
SWUPD_CERTS_DIR=${SWUPD_CERTS_DIR=:-"/root/swupd-certs"}
|
||||
|
||||
export XZ_DEFAULTS="--threads 0"
|
||||
@@ -83,7 +84,7 @@ for BUNDLE in $BUNDLE_LIST; do
|
||||
done
|
||||
|
||||
for v in $BUNDLE_VER_LIST; do
|
||||
if [ -e /var/lib/update/www/${VER}/pack-${BUNDLE}-from-$v.tar ]; then
|
||||
if [ -e ${SWUPDWEBDIR}/${VER}/pack-${BUNDLE}-from-$v.tar ]; then
|
||||
echo "${VER}/pack-${BUNDLE}-from-$v.tar already exists, skipping."
|
||||
else
|
||||
${SWUPDREPO}/swupd_make_pack $v ${VER} ${BUNDLE}
|
||||
|
||||
@@ -13,8 +13,9 @@ if [[ $# < 1 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
FORMAT=$1
|
||||
UPDATEDIR=${UPDATEDIR:-"/var/lib/update"}
|
||||
|
||||
ver1=`cat /var/lib/update/www/version/formatstaging/latest`
|
||||
ver2=`cat /var/lib/update/www/version/format$FORMAT/latest`
|
||||
cp /var/lib/update/www/version/formatstaging/latest /var/lib/update/www/version/format$FORMAT/latest
|
||||
ver1=`cat ${UPDATEDIR}/www/version/formatstaging/latest`
|
||||
ver2=`cat ${UPDATEDIR}/www/version/format$FORMAT/latest`
|
||||
cp ${UPDATEDIR}/www/version/formatstaging/latest ${UPDATEDIR}/www/version/format$FORMAT/latest
|
||||
echo "Updated from $ver2 to $ver1 in format $FORMAT"
|
||||
|
||||
Reference in New Issue
Block a user