Commit b31617ad authored by Ivan Mazhukin's avatar Ivan Mazhukin

epm-app-update.sh: update to use gitlab repo

parent 607d48d3
#!/bin/sh
#ssh epm@epm-update /home/epm/eepm/tests/update_versions.sh || exit
REPO_URL="https://gitlab.eterfund.ru/etersoft/epm-play-ci-results.git"
REPO_BRANCH="3.64"
REPO_PATH="version/ALTLinux-p11"
APP_VERSIONS_DIR="/var/ftp/pub/download/epm-app-versions"
#if [ -z "$1" ] ; then
# ssh epm@epm-update /home/epm/bin/run-test.sh || exit
#fi
WORKDIR="$(mktemp -d /tmp/epm-app-update.XXXXXX)" || exit
cleanup()
{
rm -rf "$WORKDIR"
}
trap cleanup EXIT HUP INT TERM
rsync -a --delete-after --exclude ".git" epm@epm-update:/home/epm/epm-play-versions/ /var/ftp/pub/download/epm-app-versions/
scp epm@epm-update:/var/lib/eepm/eget-ipfs-db.txt /var/ftp/pub/download/epm-app-versions/
GIT_TERMINAL_PROMPT=0 git clone --depth 1 --branch "$REPO_BRANCH" "$REPO_URL" "$WORKDIR/repo" || exit
ssh epm@epm-update /home/epm/eepm/bin/epm play --full-list-all </dev/null >/var/ftp/pub/download/epm-app-versions/epm-play-list.txt
SRC_DIR="$WORKDIR/repo/$REPO_PATH"
[ -d "$SRC_DIR" ] || exit
IPFS_DB_FILE="$SRC_DIR/eget-ipfs-db.txt"
PLAY_LIST_FILE="$SRC_DIR/epm-play-list.txt"
APP_MERGED_DIR="$WORKDIR/app-versions-merged"
mkdir -p "$APP_MERGED_DIR" "$APP_VERSIONS_DIR"
rsync -a "$SRC_DIR/epm-play-versions/" "$APP_MERGED_DIR/"
rsync -a "$SRC_DIR/epm-files/" "$APP_MERGED_DIR/"
rsync -a "$SRC_DIR/epm-requires/" "$APP_MERGED_DIR/"
rsync -a --delete-after --exclude ".git" "$APP_MERGED_DIR/" "$APP_VERSIONS_DIR/"
if [ -s "$IPFS_DB_FILE" ] ; then
cp "$IPFS_DB_FILE" "$APP_VERSIONS_DIR/"
else
echo "Skip IPFS DB update: file is missing or empty: $IPFS_DB_FILE" >&2
fi
cp "$PLAY_LIST_FILE" "$APP_VERSIONS_DIR/"
# keep status and versions for every epm release
VERSION="$(cat /var/ftp/pub/download/epm-app-versions/eepm)" || exit
# VERSION="$(cat "$APP_VERSIONS_DIR/eepm")" || exit
# use baseversion
VERSION=$(echo "$VERSION" | sed -e 's|\.[0-9]*$||')
[ -n "$VERSION" ] || exit
# VERSION=$(echo "$VERSION" | sed -e 's|\.[0-9]*$||')
VERSION=$REPO_BRANCH
TDIR="/var/ftp/pub/download/eepm/releases/$VERSION/app-versions"
mkdir -p "$TDIR/"
rsync -a --delete-after /var/ftp/pub/download/epm-app-versions/ $TDIR/
scp epm@epm-update:/var/lib/eepm/eget-ipfs-db.txt $TDIR/
rsync -a --delete-after "$APP_VERSIONS_DIR/" "$TDIR/"
TDIR="/var/ftp/pub/download/eepm/releases/$VERSION/logs"
mkdir -p "$TDIR/"
rsync -a --delete-after --exclude "*.git" epm@epm-update:/home/epm/epm-logs/ $TDIR/
rsync -a --delete-after --exclude "*.git" "$SRC_DIR/epm-logs/" "$TDIR/"
TDIR="/var/ftp/pub/download/eepm/releases/$VERSION/error-logs"
mkdir -p "$TDIR/"
rsync -a --delete-after --exclude "*.git" epm@epm-update:/home/epm/epm-errors/ $TDIR/
rsync -a --delete-after --exclude "*.git" "$SRC_DIR/epm-errors/" "$TDIR/"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment