Fix build scripts when used on Ubuntu 21.04

This commit is contained in:
loki-47-6F-64 2021-10-04 20:53:40 +02:00
parent cb0b32f90a
commit fe7a7f4d77
2 changed files with 16 additions and 16 deletions

View File

@ -1,6 +1,6 @@
#/bin/bash -e #/bin/bash -e
function usage { usage() {
echo "Usage: $0 [OPTIONS]" echo "Usage: $0 [OPTIONS]"
echo " -c: command --> default [build]" echo " -c: command --> default [build]"
echo " | delete --> Delete the container, Dockerfile isn't mandatory" echo " | delete --> Delete the container, Dockerfile isn't mandatory"
@ -13,7 +13,7 @@ function usage {
} }
# Attempt to turn relative paths into absolute paths # Attempt to turn relative paths into absolute paths
function absolute_path() { absolute_path() {
RELATIVE_PATH=$1 RELATIVE_PATH=$1
if which realpath >/dev/null 2>/dev/null if which realpath >/dev/null 2>/dev/null
then then
@ -28,7 +28,7 @@ function absolute_path() {
CONTAINER_NAME=sunshine CONTAINER_NAME=sunshine
COMMAND=BUILD COMMAND=BUILD
function build_container() { build_container() {
CONTAINER_NAME=$1 CONTAINER_NAME=$1
DOCKER_FILE=$2 DOCKER_FILE=$2
@ -42,9 +42,9 @@ function build_container() {
docker build . -t "$CONTAINER_NAME" -f "$DOCKER_FILE" docker build . -t "$CONTAINER_NAME" -f "$DOCKER_FILE"
} }
function delete() { delete() {
CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]') CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
if [ "$CONTAINER_NAME_UPPER" == "ALL" ] if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
then then
shopt -s nullglob shopt -s nullglob
for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f) for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f)
@ -67,9 +67,9 @@ function delete() {
fi fi
} }
function build() { build() {
CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]') CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
if [ "$CONTAINER_NAME_UPPER" == "ALL" ] if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
then then
shopt -s nullglob shopt -s nullglob
for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f) for file in $(find . -maxdepth 1 -iname "Dockerfile-*" -type f)
@ -89,14 +89,14 @@ function build() {
fi fi
} }
function abort() { abort() {
echo "$1" echo "$1"
exit 10 exit 10
} }
function compile() { compile() {
CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]') CONTAINER_NAME_UPPER=$(echo "$CONTAINER_NAME" | tr '[:lower:]' '[:upper:]')
if [ "$CONTAINER_NAME_UPPER" == "ALL" ] if [ "$CONTAINER_NAME_UPPER" = "ALL" ]
then then
shopt -s nullglob shopt -s nullglob
@ -152,18 +152,18 @@ done
echo "$0 set to $(echo $COMMAND | tr '[:upper:]' '[:lower:]')" echo "$0 set to $(echo $COMMAND | tr '[:upper:]' '[:lower:]')"
if [[ "$COMMAND" == "BUILD" ]] if [ "$COMMAND" = "BUILD" ]
then then
echo "Start building..." echo "Start building..."
delete delete
build build
echo "Done." echo "Done."
elif [[ "$COMMAND" == "COMPILE" ]] elif [ "$COMMAND" = "COMPILE" ]
then then
echo "Start compiling..." echo "Start compiling..."
compile compile
echo "Done." echo "Done."
elif [[ "$COMMAND" == "DELETE" ]] elif [ "$COMMAND" = "DELETE" ]
then then
echo "Start deleting..." echo "Start deleting..."
delete delete

View File

@ -1,6 +1,6 @@
#/bin/bash -e #/bin/bash -e
function usage { usage() {
echo "Usage: $0" echo "Usage: $0"
echo " -d: Generate a debug build" echo " -d: Generate a debug build"
echo " -p: Generate a debian package" echo " -p: Generate a debian package"
@ -11,7 +11,7 @@ function usage {
} }
# Attempt to turn relative paths into absolute paths # Attempt to turn relative paths into absolute paths
function absolute_path() { absolute_path() {
RELATIVE_PATH=$1 RELATIVE_PATH=$1
if which realpath >/dev/null 2>/dev/null if which realpath >/dev/null 2>/dev/null
then then
@ -81,7 +81,7 @@ while getopts ":dpuhc:s:n:" arg; do
esac esac
done done
[ "$USERNAME" == "" ] && USERNAME=$(logname) [ "$USERNAME" = "" ] && USERNAME=$(logname)
BUILD_DIR="$PWD/$CONTAINER_NAME-build" BUILD_DIR="$PWD/$CONTAINER_NAME-build"
SUNSHINE_ASSETS_DIR="-e SUNSHINE_ASSETS_DIR=$BUILD_DIR/assets" SUNSHINE_ASSETS_DIR="-e SUNSHINE_ASSETS_DIR=$BUILD_DIR/assets"