Skip to content

Commit

Permalink
Fix build scripts when used on Ubuntu 21.04
Browse files Browse the repository at this point in the history
  • Loading branch information
loki-47-6F-64 committed Oct 4, 2021
1 parent cb0b32f commit fe7a7f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions scripts/build-container.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -28,7 +28,7 @@ function absolute_path() {
CONTAINER_NAME=sunshine
COMMAND=BUILD

function build_container() {
build_container() {
CONTAINER_NAME=$1
DOCKER_FILE=$2

Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions scripts/build-sunshine.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fe7a7f4

Please sign in to comment.