Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 2689217

Browse files
committed
Align variable default values in builder scripts
Also, make some of the variables overridable in the environment. Signed-off-by: Patrick McCarty <[email protected]>
1 parent 2bb1136 commit 2689217

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

basic_creator.sh

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/bin/bash
22
VER=$1
33
XZ_DEFAULTS="--threads 0"
4-
PREVREL=`cat /var/lib/update/image/latest.version`
54

6-
SWUPDREPO=/usr/src/clear-projects/swupd-server
7-
BUNDLEREPO=/usr/src/clear-projects/clr-bundles
8-
UPDATEDIR=/var/lib/update
5+
SWUPDREPO=${SWUPDREPO:-"/usr/src/clear-projects/swupd-server"}
6+
BUNDLEREPO=${BUNDLEREPO:-"/usr/src/clear-projects/clr-bundles"}
7+
UPDATEDIR=${UPDATEDIR:-"/var/lib/update"}
8+
9+
PREVREL=`cat ${UPDATEDIR}/image/latest.version`
910

1011
error() {
1112
echo "${1:-"Unknown Error"}"
@@ -16,7 +17,7 @@ error() {
1617
# eg: all of openstack, pnp, bat, cloud stuff, non-basic scripting language bundles
1718
${SWUPDREPO}/mk_groups_ini.sh
1819

19-
export SWUPD_CERTS_DIR="/root/swupd-certs"
20+
export SWUPD_CERTS_DIR=${SWUPD_CERTS_DIR:-"/root/swupd-certs"}
2021
export LEAF_KEY="leaf.key.pem"
2122
export LEAF_CERT="leaf.cert.pem"
2223
export CA_CHAIN_CERT="ca-chain.cert.pem"
@@ -54,12 +55,12 @@ popd ${SWUPDREPO}
5455

5556
# expose the new build to staging / testing
5657
echo ${VER} > ${UPDATEDIR}/image/latest.version
57-
STAGING=$(cat ${UPDATEDIR}/www//version/formatstaging/latest)
58+
STAGING=$(cat ${UPDATEDIR}/www/version/formatstaging/latest)
5859
if [ "${STAGING}" -lt "${VER}" ]; then
59-
echo ${VER} > ${UPDATEDIR}/www//version/formatstaging/latest
60+
echo ${VER} > ${UPDATEDIR}/www/version/formatstaging/latest
6061
fi
6162

62-
#valgrind /usr/src/clear-projects/swupd-server/swupd_create_update ${VER}
63-
time hardlink /var/lib/update/image/${VER}/*
64-
time hardlink /var/lib/update/image/$PREVREL /var/lib/update/image/${VER}
65-
time hardlink /var/lib/update/www/$PREVREL /var/lib/update/www/${VER}
63+
#valgrind ${SWUPDREPO}/swupd_create_update ${VER}
64+
time hardlink ${UPDATEDIR}/image/${VER}/*
65+
time hardlink ${UPDATEDIR}/image/${PREVREL} ${UPDATEDIR}/image/${VER}
66+
time hardlink ${UPDATEDIR}/www/${PREVREL} ${UPDATEDIR}/www/${VER}

mk_groups_ini.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#! /bin/bash
22

33
COMMON=${COMMON:-"/root/common"}
4-
BUNDLEREPO=${BUNDLEREPO:-"/root/clr-bundles"}
4+
BUNDLEREPO=${BUNDLEREPO:-"/usr/src/clear-projects/clr-bundles"}
55

6-
SWUPD_SERVER_DIR=${SWUPD_SERVER_DIR:-"/var/lib/update"}
7-
SWUPD_GROUPS_INI=${SWUPD_GROUPS_INI:-"$SWUPD_SERVER_DIR/groups.ini"}
8-
SWUPD_SERVER_INI=${SWUPD_SERVER_INI:-"$SWUPD_SERVER_DIR/server.ini"}
6+
UPDATEDIR=${UPDATEDIR:-"/var/lib/update"}
7+
SWUPD_GROUPS_INI=${SWUPD_GROUPS_INI:-"$UPDATEDIR/groups.ini"}
8+
SWUPD_SERVER_INI=${SWUPD_SERVER_INI:-"$UPDATEDIR/server.ini"}
99

10-
if [ ! -d "$SWUPD_SERVER_DIR" ]; then
11-
mkdir -p $SWUPD_SERVER_DIR/{image,www}
10+
if [ ! -d "$UPDATEDIR" ]; then
11+
mkdir -p $UPDATEDIR/{image,www}
1212
fi
1313

1414
if [ ! -f "$SWUPD_SERVER_INI" ]; then
@@ -17,8 +17,8 @@ if [ ! -f "$SWUPD_SERVER_INI" ]; then
1717
cp -p $template/server.ini $SWUPD_SERVER_INI
1818
fi
1919

20-
if [ ! -f "$SWUPD_SERVER_DIR/image/latest.version" ]; then
21-
echo "0" > $SWUPD_SERVER_DIR/image/latest.version
20+
if [ ! -f "$UPDATEDIR/image/latest.version" ]; then
21+
echo "0" > $UPDATEDIR/image/latest.version
2222
fi
2323

2424
echo "rebuilding $SWUPD_GROUPS_INI based on $BUNDLEREPO"

pack_maker.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
# consider which version-pair packs are meaningful for intermediate builds
2121
# and revert builds.
2222

23-
SWUPDREPO=${SWUPDREPO:-"/root/swupd-server"}
24-
BUNDLEREPO=${BUNDLEREPO:-"/root/clr-bundles"}
25-
SWUPDWEBDIR="/var/lib/update/www"
23+
SWUPDREPO=${SWUPDREPO:-"/usr/src/clear-projects/swupd-server"}
24+
BUNDLEREPO=${BUNDLEREPO:-"/usr/src/clear-projects/clr-bundles"}
25+
UPDATEDIR=${UPDATEDIR:-"/var/lib/update"}
26+
SWUPDWEBDIR="${UPDATEDIR}/www"
2627
SWUPD_CERTS_DIR=${SWUPD_CERTS_DIR=:-"/root/swupd-certs"}
2728

2829
export XZ_DEFAULTS="--threads 0"
@@ -83,7 +84,7 @@ for BUNDLE in $BUNDLE_LIST; do
8384
done
8485

8586
for v in $BUNDLE_VER_LIST; do
86-
if [ -e /var/lib/update/www/${VER}/pack-${BUNDLE}-from-$v.tar ]; then
87+
if [ -e ${SWUPDWEBDIR}/${VER}/pack-${BUNDLE}-from-$v.tar ]; then
8788
echo "${VER}/pack-${BUNDLE}-from-$v.tar already exists, skipping."
8889
else
8990
${SWUPDREPO}/swupd_make_pack $v ${VER} ${BUNDLE}

publish.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ if [[ $# < 1 ]]; then
1313
exit 1
1414
fi
1515
FORMAT=$1
16+
UPDATEDIR=${UPDATEDIR:-"/var/lib/update"}
1617

17-
ver1=`cat /var/lib/update/www/version/formatstaging/latest`
18-
ver2=`cat /var/lib/update/www/version/format$FORMAT/latest`
19-
cp /var/lib/update/www/version/formatstaging/latest /var/lib/update/www/version/format$FORMAT/latest
18+
ver1=`cat ${UPDATEDIR}/www/version/formatstaging/latest`
19+
ver2=`cat ${UPDATEDIR}/www/version/format$FORMAT/latest`
20+
cp ${UPDATEDIR}/www/version/formatstaging/latest ${UPDATEDIR}/www/version/format$FORMAT/latest
2021
echo "Updated from $ver2 to $ver1 in format $FORMAT"

0 commit comments

Comments
 (0)