diff --git a/Makefile b/Makefile index 23d4d00..4cee8cb 100644 --- a/Makefile +++ b/Makefile @@ -19,13 +19,13 @@ love-release: clean ll="$$(grep -E -m 1 "^LONG_OPTIONS=['\"]?.*['\"]?" "$$file" | sed -Ee "s/LONG_OPTIONS=['\"]?//" -e "s/['\"]?$$//" -e "s/,/,$${s}/g")"; \ if [[ -n $$ll ]]; then l="$${l},$${s}$${ll}"; fi; \ long="$${l},$${long}"; \ - if [[ -n $$shelp ]]; then shelp="$$shelp\n"; fi; \ - shelp="$$shelp -$$(grep "init_module" $$file | sed -e 's/init_module //' -e 's/" "/\t/g' -e 's/"//g' | awk -F "\t" '{print($$3," ",$$1)}')"; \ + shelp="$$shelp\\n\\ -$$(grep "init_module" $$file | sed -Ee 's/init_module //' -e 's/" "/ /g' -e "s/\"//g" | awk -F "\t" '{print($$3," ",$$1)}')\\\\"; \ done; \ + shelp="$$shelp\\n"; \ sed -Ee "s/^OPTIONS=(['\"]?)/OPTIONS=\1$$short/" -e "s/^LONG_OPTIONS=(['\"]?)/LONG_OPTIONS=\1$$long/" \ -e 's/INSTALLED=false/INSTALLED=true/' \ - -e "/^EndOfSHelp/ i\\$$shelp" \ - -e 's/SCRIPTS_DIR="scripts"/SCRIPTS_DIR="$(SED_INSTALL_DIR)\/scripts"/' love-release.sh > '$(BUILD_DIR)/love-release'; \ + -e 's/SCRIPTS_DIR="scripts"/SCRIPTS_DIR="$(SED_INSTALL_DIR)\/scripts"/' \ + -e "$$(echo "$$(sed -n '/^EndOfSHelp/=' love-release.sh) i \\$$(printf "$$shelp")")" love-release.sh > '$(BUILD_DIR)/love-release'; \ comp="$$(if [[ -n $$long ]]; then echo --$$long | tr -d ':' | sed -e 's/,$$//' -e 's/,/ --/g'; fi)$$(if [[ -n $$short ]]; then echo $$short | sed -E 's/(.)/ -\1/g'; fi) "; \ sed -Ee "s/opts=\"(.*)/opts=\"$$comp\1/" completion.sh > '$(BUILD_DIR)/completion.sh' cp love-release.1 '$(BUILD_DIR)/love-release.1' @@ -52,12 +52,13 @@ embedded: clean ll="$$(grep -E -m 1 "^LONG_OPTIONS=['\"]?.*['\"]?" "$$file" | sed -Ee "s/LONG_OPTIONS=['\"]?//" -e "s/['\"]?$$//" -e "s/,/,$${s}/g")"; \ if [[ -n $$ll ]]; then l="$${l},$${s}$${ll}"; fi; \ long="$${l},$${long}"; \ - shelp="$$shelp -$$(grep "init_module" $$file | sed -e 's/init_module //' -e 's/" "/\t/g' -e 's/"//g' | awk -F "\t" '{print($$3," ",$$1)}')"; \ + shelp="$$shelp\\n\\ -$$(grep "init_module" $$file | sed -Ee 's/init_module //' -e 's/" "/ /g' -e "s/\"//g" | awk -F "\t" '{print($$3," ",$$1)}')\\\\"; \ done; \ + shelp="$$shelp\\n"; \ sed -Ee "s/^OPTIONS=(['\"]?)/OPTIONS=\1$$short/" -e "s/^LONG_OPTIONS=(['\"]?)/LONG_OPTIONS=\1$$long/" \ -e 's/EMBEDDED=false/EMBEDDED=true/' \ - -e "/^EndOfSHelp/ i\\$$shelp" \ - -e '/include_scripts_here$$/r $(BUILD_DIR)/tmp' love-release.sh > '$(BUILD_DIR)/love-release.sh' + -e '/include_scripts_here$$/r $(BUILD_DIR)/tmp' \ + -e "$$(echo "$$(sed -n '/^EndOfSHelp/=' love-release.sh) i \\$$(printf "$$shelp")")" love-release.sh > '$(BUILD_DIR)/love-release.sh'; chmod 0775 '$(BUILD_DIR)/love-release.sh' rm -rf '$(BUILD_DIR)/tmp' diff --git a/README.md b/README.md index 2771f34..942bd5c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ `love-release.sh` -- Bash script to generate [LÖVE](https://love2d.org/) game releases ### INSTALLATION -`love-release` relies on `GNU getopt` (OSX and BSD user needs to install it), `curl`, `zip` and `unzip`. +`love-release` relies on `GNU getopt` and `GNU readlink` (OSX and BSD users need to install them), `curl`, `zip` and `unzip`. You need to have `lua` installed to be able to read the configuration. You also need Wine to get icons and installer for Windows, the Debian pakaging utilities for Debian and the Android SDK to build a package for Android. diff --git a/love-release.sh b/love-release.sh index 7dbef14..75118ec 100755 --- a/love-release.sh +++ b/love-release.sh @@ -26,7 +26,7 @@ check_deps () { } && { unset GETOPT_COMPATIBLE local out=$(getopt -T) - if [[ $? -eq 4 && -z $out ]]; then + if (( $? != 4 )) && [[ -n $out ]]; then local opt=false fi } @@ -34,6 +34,16 @@ check_deps () { >&2 echo "GNU getopt is not installed. Aborting." local EXIT=true fi + if ! command -v readlink > /dev/null 2>&1 || ! readlink -m / > /dev/null 2>&1; then + command -v greadlink > /dev/null 2>&1 || { + >&2 echo "GNU readlink is not installed. Aborting." + local EXIT=true + } && { + readlink () { + greadlink "$@" + } + } + fi command -v lua > /dev/null 2>&1 || { echo "lua is not installed. Install it to ease your releases."