From 18f61837c8c83cbf15cc2c4234afe913bcd6c608 Mon Sep 17 00:00:00 2001
From: "alexandr.kravchenko" <alexander.kravchenko@demlabs.net>
Date: Thu, 13 Feb 2020 22:41:19 +0500
Subject: [PATCH] Checking out the postfix version modification (How will
 changelogs work now?)

---
 prod_build/linux/debian/scripts/deploy.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/prod_build/linux/debian/scripts/deploy.sh b/prod_build/linux/debian/scripts/deploy.sh
index 04e8a26f2..8a4a7c14d 100755
--- a/prod_build/linux/debian/scripts/deploy.sh
+++ b/prod_build/linux/debian/scripts/deploy.sh
@@ -1,5 +1,21 @@
 #!/bin/bash
 
+repack() {
+
+DEBNAME=$1
+echo "Renaming control on $DEBNAME"
+mkdir tmp && cd tmp
+ar p ../$DEBNAME control.tar.gz | tar -xz
+VERSION=$(cat control | grep Version | cut -d ':' -f2)
+echo "Version is $VERSION"
+sed -i "s/$VERSION/${VERSION}-$DISTR_CODENAME/" control
+tar czf control.tar.gz *[!z]
+ar r ../$DEBNAME control.tar.gz
+cd ..
+rm -rf tmp
+
+}
+
 echo "Deploying to $PACKAGE_PATH"
 echo $wd
 
@@ -12,10 +28,16 @@ NOTONBUILDSERVER=0
 gitlab-runner -v 2&>> /dev/null || NOTONBUILDSERVER=$?
 if [[ $NOTONBUILDSERVER == 0 ]]; then
 	mkdir -p $REPO_DIR_SRC
+	cd $REPO_DIR_SRC
 	for pkgfile in $PKGFILES; do
 		cp -v $wd/$PACKAGE_PATH/$pkgfile $REPO_DIR_SRC
+		for variant in $HOST_DISTR_VERSIONS; do
+			ls $pkgfile | grep $variant && DISTR_CODENAME=$variant #Since we add a postfix into every debpackage done, we'll extract it that way.
+		done
+		repack $pkgfile
 	done
 	cd $REPO_DIR
+	echo "Attempting to add packages into $DISTR_VARIANT section to $DISTR_CODENAME"
 	sudo reprepro -C "$DISTR_COMPONENT" --ask-passphrase includedeb "$DISTR_CODENAME" $REPO_DIR_SRC/*.deb
 	#Update into reprepro:
 	
-- 
GitLab