From fe7a7f4d779899493d4397cd28a7d3441aa57746 Mon Sep 17 00:00:00 2001
From: loki-47-6F-64 <loki-47-6F-64@users.noreply.github.com>
Date: Mon, 4 Oct 2021 20:53:40 +0200
Subject: [PATCH] Fix build scripts when used on Ubuntu 21.04

---
 scripts/build-container.sh | 26 +++++++++++++-------------
 scripts/build-sunshine.sh  |  6 +++---
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/scripts/build-container.sh b/scripts/build-container.sh
index e332c7bb..6ddd61a1 100755
--- a/scripts/build-container.sh
+++ b/scripts/build-container.sh
@@ -1,6 +1,6 @@
 #/bin/bash -e
 
-function usage {
+usage() {
 	echo "Usage: $0 [OPTIONS]"
 	echo "	-c: command --> default [build]"
 	echo "	  | delete  --> Delete the container, Dockerfile isn't mandatory"
@@ -13,7 +13,7 @@ function usage {
 }
 
 # Attempt to turn relative paths into absolute paths
-function absolute_path() {
+absolute_path() {
 	RELATIVE_PATH=$1
 	if which realpath >/dev/null 2>/dev/null
 	then
@@ -28,7 +28,7 @@ function absolute_path() {
 CONTAINER_NAME=sunshine
 COMMAND=BUILD
 
-function build_container() {
+build_container() {
 	CONTAINER_NAME=$1
 	DOCKER_FILE=$2
 
@@ -42,9 +42,9 @@ function build_container() {
 	docker build . -t "$CONTAINER_NAME" -f "$DOCKER_FILE"
 }
 
-function delete() {
+delete() {
 	CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
-	if [ "$CONTAINER_NAME_UPPER" == "ALL" ]
+	if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
 	then
 		shopt -s nullglob
 		for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f)
@@ -67,9 +67,9 @@ function delete() {
 	fi
 }
 
-function build() {
+build() {
 	CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
-	if [ "$CONTAINER_NAME_UPPER" == "ALL" ]
+	if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
 	then
 		shopt -s nullglob
 		for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f)
@@ -89,14 +89,14 @@ function build() {
 	fi
 }
 
-function abort() {
+abort() {
 	echo "$1"
 	exit 10
 }
 
-function compile() {
+compile() {
 	CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
-	if [ "$CONTAINER_NAME_UPPER" == "ALL" ]
+	if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
 	then
 		shopt -s nullglob
 
@@ -152,18 +152,18 @@ done
 
 echo "$0 set to $(echo $COMMAND | tr '[:upper:]' '[:lower:]')"
 
-if [[ "$COMMAND" == "BUILD" ]]
+if [ "$COMMAND" = "BUILD" ]
 then
 	echo "Start building..."
 	delete
 	build
 	echo "Done."
-elif [[ "$COMMAND" == "COMPILE" ]]
+elif [ "$COMMAND" = "COMPILE" ]
 then
 	echo "Start compiling..."
 	compile
 	echo "Done."
-elif [[ "$COMMAND" == "DELETE" ]]
+elif [ "$COMMAND" = "DELETE" ]
 then
 	echo "Start deleting..."
 	delete
diff --git a/scripts/build-sunshine.sh b/scripts/build-sunshine.sh
index d6d6359e..23d76335 100755
--- a/scripts/build-sunshine.sh
+++ b/scripts/build-sunshine.sh
@@ -1,6 +1,6 @@
 #/bin/bash -e
 
-function usage {
+usage() {
 	echo "Usage: $0"
 	echo "	-d: Generate a debug build"
 	echo "	-p: Generate a debian package"
@@ -11,7 +11,7 @@ function usage {
 }
 
 # Attempt to turn relative paths into absolute paths
-function absolute_path() {
+absolute_path() {
 	RELATIVE_PATH=$1
 	if which realpath >/dev/null 2>/dev/null
 	then
@@ -81,7 +81,7 @@ while getopts ":dpuhc:s:n:" arg; do
 	esac
 done
 
-[ "$USERNAME" == "" ] && USERNAME=$(logname)
+[ "$USERNAME" = "" ] && USERNAME=$(logname)
 
 BUILD_DIR="$PWD/$CONTAINER_NAME-build"
 SUNSHINE_ASSETS_DIR="-e SUNSHINE_ASSETS_DIR=$BUILD_DIR/assets"