refactor build wrapper into smaller operations
This commit is contained in:
parent
4c7c703846
commit
71f806847a
2 changed files with 56 additions and 57 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
|
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
pwd
|
||||||
read -p "Enter Server CN (localhost or address): " SRVNAME
|
read -p "Enter Server CN (localhost or address): " SRVNAME
|
||||||
read -p "Enter Client CN (localhost or address): " CLTNAME
|
read -p "Enter Client CN (localhost or address): " CLTNAME
|
||||||
|
|
||||||
|
|
@ -23,7 +25,6 @@ rm -rf staging
|
||||||
# Get passwords for CAs
|
# Get passwords for CAs
|
||||||
read -p "Enter Server CA Passphrase: " SRVCAPASS
|
read -p "Enter Server CA Passphrase: " SRVCAPASS
|
||||||
read -p "Enter Client CA Passphrase: " CLTCAPASS
|
read -p "Enter Client CA Passphrase: " CLTCAPASS
|
||||||
|
|
||||||
# Generate CA Keys
|
# Generate CA Keys
|
||||||
echo "[+] Generating Server CA Key"
|
echo "[+] Generating Server CA Key"
|
||||||
openssl genrsa -passout pass:$SRVCAPASS -aes256 -out $SERVER_PATH/ca.key 4096
|
openssl genrsa -passout pass:$SRVCAPASS -aes256 -out $SERVER_PATH/ca.key 4096
|
||||||
|
|
@ -76,59 +77,3 @@ echo "[+] Converting private keys to X.509"
|
||||||
openssl pkcs8 -topk8 -nocrypt -in $CLIENT_PATH/private.key -out $CLIENT_PATH/private.pem
|
openssl pkcs8 -topk8 -nocrypt -in $CLIENT_PATH/private.key -out $CLIENT_PATH/private.pem
|
||||||
openssl pkcs8 -topk8 -nocrypt -in $SERVER_PATH/private.key -out $SERVER_PATH/private.pem
|
openssl pkcs8 -topk8 -nocrypt -in $SERVER_PATH/private.key -out $SERVER_PATH/private.pem
|
||||||
openssl pkcs8 -topk8 -nocrypt -in $TEST_PATH/private.key -out $TEST_PATH/private.pem
|
openssl pkcs8 -topk8 -nocrypt -in $TEST_PATH/private.key -out $TEST_PATH/private.pem
|
||||||
|
|
||||||
echo "[+] initiating gradle build"
|
|
||||||
./gradlew clean build
|
|
||||||
|
|
||||||
# Ideally this next section would be done with gradle
|
|
||||||
# Unfortunately gradle's protobuf distribution plugin does not seem to have facilities to manually include certs
|
|
||||||
# Or to specify seperate client and server tarballs for that matter
|
|
||||||
# Definitely more research on gradle should be done, but after JobServ hits MVP
|
|
||||||
echo "[+] extracting built code"
|
|
||||||
mkdir staging
|
|
||||||
mkdir staging/client
|
|
||||||
mkdir staging/server
|
|
||||||
mkdir staging/test
|
|
||||||
|
|
||||||
DIST_TAR=JobServ.tar
|
|
||||||
DIST_DIR=JobServ
|
|
||||||
if [ -f build/distributions/jobserv.tar ]; then
|
|
||||||
DIST_TAR=jobserv.tar
|
|
||||||
DIST_DIR=jobserv
|
|
||||||
fi
|
|
||||||
|
|
||||||
tar -xvf build/distributions/$DIST_TAR -C staging/client
|
|
||||||
tar -xvf build/distributions/$DIST_TAR -C staging/server
|
|
||||||
tar -xvf build/distributions/$DIST_TAR -C staging/test
|
|
||||||
|
|
||||||
echo "[+] removing server capabilities from client"
|
|
||||||
rm staging/client/$DIST_DIR/bin/jobserv-server staging/client/$DIST_DIR/bin/jobserv-server.bat
|
|
||||||
|
|
||||||
echo "[+] removing client capabilities from server"
|
|
||||||
rm staging/server/$DIST_DIR/bin/jobserv-client staging/server/$DIST_DIR/bin/jobserv-client.bat
|
|
||||||
|
|
||||||
echo "[+] populating certificates"
|
|
||||||
cp resources/server/server.crt staging/server/
|
|
||||||
cp resources/server/private.pem staging/server/
|
|
||||||
cp resources/client/ca.crt staging/server/
|
|
||||||
cp resources/client/client.crt staging/client/
|
|
||||||
cp resources/client/private.pem staging/client/
|
|
||||||
cp resources/server/ca.crt staging/client/
|
|
||||||
cp -r resources/* staging/test/
|
|
||||||
|
|
||||||
echo "[+] Adding wrapper script for client"
|
|
||||||
# This could also be a .desktop file without much more work.
|
|
||||||
cat << EOF > staging/client/client
|
|
||||||
./$DIST_DIR/bin/jobserv-client private.pem client.crt ca.crt \$@
|
|
||||||
EOF
|
|
||||||
chmod +x staging/client/client
|
|
||||||
|
|
||||||
echo "[+] Adding wrapper script for server"
|
|
||||||
# This could also be a .desktop file without much more work.
|
|
||||||
cat << EOF > staging/server/server
|
|
||||||
./$DIST_DIR/bin/jobserv-server \$1 server.crt private.pem ca.crt
|
|
||||||
EOF
|
|
||||||
chmod +x staging/server/server
|
|
||||||
|
|
||||||
echo "[+] removing test logs"
|
|
||||||
rm JobServ-Server-*
|
|
||||||
54
package.sh
Executable file
54
package.sh
Executable file
|
|
@ -0,0 +1,54 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Ideally this next section would be done with gradle
|
||||||
|
# Unfortunately gradle's protobuf distribution plugin does not seem to have facilities to manually include certs
|
||||||
|
# Or to specify seperate client and server tarballs for that matter
|
||||||
|
# Definitely more research on gradle should be done, but after JobServ hits MVP
|
||||||
|
echo "[+] extracting built code"
|
||||||
|
mkdir staging
|
||||||
|
mkdir staging/client
|
||||||
|
mkdir staging/server
|
||||||
|
mkdir staging/test
|
||||||
|
|
||||||
|
DIST_TAR=JobServ.tar
|
||||||
|
DIST_DIR=JobServ
|
||||||
|
if [ -f build/distributions/jobserv.tar ]; then
|
||||||
|
DIST_TAR=jobserv.tar
|
||||||
|
DIST_DIR=jobserv
|
||||||
|
fi
|
||||||
|
|
||||||
|
tar -xvf build/distributions/$DIST_TAR -C staging/client
|
||||||
|
tar -xvf build/distributions/$DIST_TAR -C staging/server
|
||||||
|
tar -xvf build/distributions/$DIST_TAR -C staging/test
|
||||||
|
|
||||||
|
echo "[+] removing server capabilities from client"
|
||||||
|
rm staging/client/$DIST_DIR/bin/jobserv-server staging/client/$DIST_DIR/bin/jobserv-server.bat
|
||||||
|
|
||||||
|
echo "[+] removing client capabilities from server"
|
||||||
|
rm staging/server/$DIST_DIR/bin/jobserv-client staging/server/$DIST_DIR/bin/jobserv-client.bat
|
||||||
|
|
||||||
|
echo "[+] populating certificates"
|
||||||
|
cp resources/server/server.crt staging/server/
|
||||||
|
cp resources/server/private.pem staging/server/
|
||||||
|
cp resources/client/ca.crt staging/server/
|
||||||
|
cp resources/client/client.crt staging/client/
|
||||||
|
cp resources/client/private.pem staging/client/
|
||||||
|
cp resources/server/ca.crt staging/client/
|
||||||
|
cp -r resources/* staging/test/
|
||||||
|
|
||||||
|
echo "[+] Adding wrapper script for client"
|
||||||
|
# This could also be a .desktop file without much more work.
|
||||||
|
cat << EOF > staging/client/client
|
||||||
|
./$DIST_DIR/bin/jobserv-client private.pem client.crt ca.crt \$@
|
||||||
|
EOF
|
||||||
|
chmod +x staging/client/client
|
||||||
|
|
||||||
|
echo "[+] Adding wrapper script for server"
|
||||||
|
# This could also be a .desktop file without much more work.
|
||||||
|
cat << EOF > staging/server/server
|
||||||
|
./$DIST_DIR/bin/jobserv-server \$1 server.crt private.pem ca.crt
|
||||||
|
EOF
|
||||||
|
chmod +x staging/server/server
|
||||||
|
|
||||||
|
echo "[+] removing test logs"
|
||||||
|
rm JobServ-Server-*
|
||||||
Loading…
Add table
Add a link
Reference in a new issue