From 3d263910697566f9da848ba884fad9f168a40b63 Mon Sep 17 00:00:00 2001
From: Kalila L <somnilibertas@gmail.com>
Date: Sun, 21 Feb 2021 19:41:44 -0500
Subject: [PATCH] Update pkg-scripts.

---
 pkg-scripts/README          | 60 -------------------------
 pkg-scripts/README.md       | 88 +++++++++++++++++++++++++++++++++++++
 pkg-scripts/make-deb-server |  4 +-
 pkg-scripts/make-rpm-server |  2 +-
 4 files changed, 91 insertions(+), 63 deletions(-)
 delete mode 100644 pkg-scripts/README
 create mode 100644 pkg-scripts/README.md

diff --git a/pkg-scripts/README b/pkg-scripts/README
deleted file mode 100644
index 6eb74980d0..0000000000
--- a/pkg-scripts/README
+++ /dev/null
@@ -1,60 +0,0 @@
-Collection of scripts to create server distribution packages.  Most of these scripts assume
-use of the build script at https://github.com/vircadia/vircadia-builder, specifically that
-the following directory structure exists
-
-base folder/
-	source/		git checkout
-	build/		result of cmake build
-	qt5-install/	installed or built Qt5 installation
-
-These scripts assume that the current directory is the pkg-scripts folder inside of the source directory
-and that the base folder can be reached by going to "../..".  This may not work if pkg-scripts is a symlink;
-adding an VIRCADIA=~/Vircadia to the beginning of the commandline will override where it looks for the base folder
-
-Ubuntu:
-	DEBEMAIL="your-email@somewhere.com" DEBFULLNAME="Your Full Name" ./make-deb-server
-
-	This script will retrieve the current git commit date and hash and assemble a version from it.
-	It will attempt construct a .deb file in the pkg-scripts folder
-
-Amazon Linux 2:
-	./make-rpm-server
-
-	This script will retrieve the current git commit date and hash and assemble a version from it.
-	It will attempt construct an .rpm file in the pkg-scripts folder
-
-Docker:
-	./make-docker-server
-
-	This script will attempt to create a docker container
-
-Results:
-	The following directory structure is created for binaries:
-		/opt/vircadia - executables
-		/opt/vircadia/lib - private shared libraries required for executables
-		/opt/vircadia/resources - files required by domain-server administrative website
-		/opt/vircadia/plugins - files required by assignment-client, mainly for audio codecs
-
-	The following systemd services are installed in /usr/lib/systemd/system:
-		vircadia-assignment-client.service
-		vircadia-domain-server.service
-		vircadia-server.target - used to launch/shutdown the two prior services
-		vircadia-assignment-client@.service
-		vircadia-domain-server@.service
-		vircadia-server@.target - used to launch/shutdown the two prior services
-
-		The top three services in this list are the "normal" services that launch Vircadia
-		in the typical fashion.  The bottom three services are "template" services designed
-		to permit multiple services to be installed and running on a single machine.
-
-		The script "/opt/vircadia/new-server serverName basePort" will do the necessary
-		setup for a new domain with the specified server name and port.  Upon installation
-		the package will create and launch a domain named "default" at base port 40100.
-		The domain name here has nothing to do with the name people will use to find your
-		domain and has nothing to do with "place names", it is only used to locate the files
-		used to configure and run the domain on your server.
-
-	The server stores its files in the following locations:
-		/var/lib/vircadia/.local - "unnamed" services (the default location for Vircadia servers)
-		/var/lib/vircadia/serverName - "named" (template) domains
-		/etc/opt/vircadia - environment variables when launching named domains
diff --git a/pkg-scripts/README.md b/pkg-scripts/README.md
new file mode 100644
index 0000000000..f4f1056877
--- /dev/null
+++ b/pkg-scripts/README.md
@@ -0,0 +1,88 @@
+# Vircadia Server Packaging Scripts
+
+Collection of scripts to create server distribution packages. Most of these scripts assume
+use of the build script at https://github.com/vircadia/vircadia-builder, specifically that
+the following directory structure exists:
+
+```
+base folder/
+	source/		git checkout
+	build/		result of cmake build
+	qt5-install/	installed or built Qt5 installation
+```
+
+These scripts assume that the current directory is the pkg-scripts folder inside of the source directory
+and that the base folder can be reached by going to `../..`. This may not work if pkg-scripts is a symlink; adding an VIRCADIA=~/Vircadia to the beginning of the commandline will override where it looks for the base folder.
+
+## Ubuntu
+```
+DEBVERSION="Semver e.g. 2021.1.0" DEBEMAIL="your-email@somewhere.com" DEBFULLNAME="Your Full Name" ./make-deb-server
+```
+
+This script will retrieve the current git commit date and hash and append it to your specified version.
+It will attempt construct a .deb file in the pkg-scripts folder
+
+## Amazon Linux 2
+    
+You will need to install `rpm-build` if you have not already.
+```
+sudo yum install rpm-build
+```
+Then, run the build script.
+```
+RPMVERSION="Semver e.g. 2021.1.0" ./make-rpm-server
+```
+
+This script will retrieve the current git commit date and hash and append it to your specified version.
+It will attempt construct an .rpm file in the pkg-scripts folder
+
+## Docker
+```
+./make-docker-server
+```
+
+This script will attempt to create a docker container.
+
+## Results
+
+### Binaries
+
+The following directory structure is created for binaries:
+```
+/opt/vircadia - executables
+/opt/vircadia/lib - private shared libraries required for executables
+/opt/vircadia/resources - files required by domain-server administrative website
+/opt/vircadia/plugins - files required by assignment-client, mainly for audio codecs
+```
+
+### Services
+
+The following systemd services are installed in `/usr/lib/systemd/system`:
+```
+vircadia-assignment-client.service
+vircadia-domain-server.service
+vircadia-server.target - used to launch/shutdown the two prior services
+vircadia-assignment-client@.service
+vircadia-domain-server@.service
+vircadia-server@.target - used to launch/shutdown the two prior services
+```
+
+The top three services in this list are the "normal" services that launch Vircadia
+in the typical fashion. The bottom three services are "template" services designed
+to permit multiple services to be installed and running on a single machine.
+
+The script `/opt/vircadia/new-server serverName basePort` will do the necessary
+setup for a new domain with the specified server name and port. Upon installation
+the package will create and launch a domain named "default" at base port 40100.
+The domain name here has nothing to do with the name people will use to find your
+domain and has nothing to do with "place names", it is only used to locate the files
+used to configure and run the domain on your server.
+
+### Stored Files
+
+The server stores its files in the following locations:
+```
+/var/lib/vircadia/.local - "unnamed" services (the default location for Vircadia servers)
+/var/lib/vircadia/serverName - "named" (template) domains
+/etc/opt/vircadia - environment variables when launching named domains
+```
diff --git a/pkg-scripts/make-deb-server b/pkg-scripts/make-deb-server
index 6a7bff26c3..2040563691 100755
--- a/pkg-scripts/make-deb-server
+++ b/pkg-scripts/make-deb-server
@@ -6,11 +6,11 @@ fi
 
 GITDATE=`git -C $VIRCADIA/source log -n 1 --format=raw | grep author | cut -d">" -f 2 | cut -d" " -f 2 | xargs -I {} date -d @{} +"%Y%m%d"`
 GITCOMMIT=`git -C $VIRCADIA/source rev-parse HEAD | cut -c 1-7`
-VERSION=2020.2.0-asteria-$GITDATE-$GITCOMMIT
+VERSION=$DEBVERSION-$GITDATE-$GITCOMMIT
 
 sudo apt-get install chrpath binutils dh-make
 
-DEB_BUILD_ROOT=temp-make-deb/vircadia-server-$VERSION-0ubuntu1
+DEB_BUILD_ROOT=temp-make-deb/vircadia-server_$VERSION-0ubuntu1
 rm -r temp-make-deb
 mkdir -p $DEB_BUILD_ROOT
 
diff --git a/pkg-scripts/make-rpm-server b/pkg-scripts/make-rpm-server
index 20ac76d4b0..d75a7257b3 100755
--- a/pkg-scripts/make-rpm-server
+++ b/pkg-scripts/make-rpm-server
@@ -5,7 +5,7 @@ if [ "$VIRCADIA" = "" ]; then
 fi
 GITDATE=`git -C $VIRCADIA/source log -n 1 --format=raw | grep author | cut -d">" -f 2 | cut -d" " -f 2 | xargs -I {} date -d @{} +"%Y%m%d"`
 GITCOMMIT=`git -C $VIRCADIA/source rev-parse HEAD | cut -c 1-7`
-VERSION=2020.2.0_ASTERIA_${GITDATE}_${GITCOMMIT}
+VERSION=$RPMVERSION-$GITDATE-$GITCOMMIT
 
 SOFILES=`ls \
 		$VIRCADIA/build/libraries/*/*.so \