etcd/vendor-update.sh
Johannes Kastl 7b0bc56119 - Update to version 3.5.17
- Update etcd configuration file based on etcd.conf.yml.sample
- Fixing a configuration data loss bug:
  Fillup really really wants that the template and the target file
  actually follow the sysconfig format. The current config and the
  current template do not fulfill this requirement.
  Move the current /etc/sysconfig/etcd to /etc/default/etcd and
  install a new sysconfig file which only adds the ETCD_OPTIONS
  option, which is actually used by the unit file.
  This also makes it a bit cleaner to move etcd to use
  --config-file in the long run.

OBS-URL: https://build.opensuse.org/package/show/devel:kubic/etcd?expand=0&rev=30
2024-12-05 19:30:21 +00:00

52 lines
1.1 KiB
Bash

#!/usr/bin/bash
#
# Script to update the vendor tarball
# Author: Elisei Roca
#------------------------------------
set -eo pipefail
# set -x
NAME=etcd
STACK=("server" "etcdctl" "etcdutl")
VERSION=$(grep -oP '(?<=Version:)(.*)' etcd.spec | xargs)
[ ! -f "$NAME-$VERSION".tar.gz ] && echo "$NAME-$VERSION.tar.gz does not exist" && exit 1
echo "Updating vendor file..."
tempdir="$(mktemp -d --suffix=.etcd)"
function cleanup() {
rm -rf "${tempdir}"
}
trap cleanup EXIT
mkdir -p "${tempdir}/vendor"
tar --strip-components=1 -xvf "$NAME-$VERSION".tar.gz -C "${tempdir}" &> /dev/null
dir=$(pwd)
for item in ${STACK[*]}; do
mkdir "${tempdir}/vendor/${item}"
cd "${tempdir}/${item}"
go mod vendor
mv vendor/ ../vendor/"$item"
done
cd "$dir"
fdupes -r -1 "${tempdir}/vendor/" |
while read line; do
target="";
for file in ${line[*]}; do
if [ "x${target}" == "x" ]; then
target=$file;
else
ln -f "${target}" "${file}";
fi;
done;
done
tar -czvf vendor.tar.gz -C "${tempdir}" vendor &> /dev/null
echo "Repacked to vendor.tar.gz"