diff --git a/CHANGELOG.md b/CHANGELOG.md
index 070c720..aa981f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
-- macOS support
+- [macOS](https://apple.com/macos) support
+- [Windows](https://microsoft.com/windows) support, but it could be unstable ⚠️
### Changed
- Remove parallel requests improvement, because it's buggy in some situations...
diff --git a/README.md b/README.md
index 282d30c..438ff8e 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,9 @@ _Based on previous work by [@vladbabii](https://github.com/vladbabii) on [docker
### Standalone
-Just clone the repo and use the script:
+> **Note**: The easiest way to install `psu` is to use [Docker method](#docker-image-and-variants), instead of this one
+
+Check the [Requirements](#requirements) section then [git] clone the repo and use the [bash] script below:
```bash
git clone https://gitlab.com/psuapp/psu.git
@@ -50,17 +52,37 @@ For detailed instructions, see [How to use](#how-to-use) section.
You will need these dependencies installed:
-- [bash](https://www.gnu.org/software/bash/)* (>= 5.0.3)
-- [curl](https://curl.se/)* (>= 7.64.0, but >= 7.76.0 is recommended)
-- [jq](https://stedolan.github.io/jq/)* (>= 1.5.1)
-- [timeout](https://man7.org/linux/man-pages/man1/timeout.1.html)* For macOS run: `brew install coreutils`
-- [uuidgen](https://man7.org/linux/man-pages/man1/uuidgen.1.html) only for some OS (Debian and Alpine work fine without it)
-- greadlink Only for macOS run: `brew install coreutils`
+##### For [Linux] based systems ([Alpine], [Debian], [Ubuntu]...)
+- [bash]\* (>= 4.4.23)
+- [curl]\* (>= 7.64.0, but >= 7.76.0 is recommended)
+- [jq]\* (>= 1.5.1)
+- [uuidgen] recommended only for some OS (Alpine and Debian work fine without it)
+
+For [Debian] and similar apt-powered [Linux] systems, run: `apt install bash curl jq`
+
+##### For [macOS]
+- [bash]\* (>= 4.4.23)
+- [curl]\* (>= 7.64.0, but >= 7.76.0 is recommended)
+- [jq]\* (>= 1.5.1)
+- [timeout]\* (included in the [coreutils] package)
+- greadlink (included in the [coreutils] package)
+
+You should install [Homebrew], then run: `brew install bash coreutils jq`
+
+##### For [Windows]
+- [bash]\* (>= 4.4.23)
+- [curl]\* (>= 7.64.0, but >= 7.76.0 is recommended)
+- [jq]\* (>= 1.5.1)
+
+> **Note**: `psu`should work with [Windows], but it could be unstable ⚠️
+
+You should download and install [Git](https://git-scm.com/download/win) and [jq](https://stedolan.github.io/jq/download) for [Windows]
+
+##### For all systems
+- [docker-compose] is recommended but not required (useful for linting docker compose/stack files)
\* = required
-For Debian and similar apt-powered systems: `apt install bash curl jq`
-
### Docker image and variants
If you don't want or can't install `psu` and its dependencies, you can run it with the default [published Docker image](https://hub.docker.com/r/psuapp/psu), like this:
@@ -246,3 +268,19 @@ For detailed instructions, see the [CLI Commands](docs/README.md) documentation.
Source code contained by this project is licensed under the [GNU General Public License version 3](https://www.gnu.org/licenses/gpl-3.0.en.html).
See [LICENSE](LICENSE) file for reference.
+
+[Linux]: https://kernel.org
+[Alpine]: https://alpinelinux.org
+[Debian]: https://debian.org
+[Ubuntu]: https://ubuntu.com/
+[macOS]: https://apple.com/macos
+[Homebrew]: https://brew.sh
+[coreutils]: https://formulae.brew.sh/formula/coreutils
+[Windows]: https://microsoft.com/windows
+[bash]: https://www.gnu.org/software/bash
+[curl]: https://curl.se
+[jq]: https://stedolan.github.io/jq
+[timeout]: https://man7.org/linux/man-pages/man1/timeout.1.html
+[uuidgen]: https://man7.org/linux/man-pages/man1/uuidgen.1.html
+[docker-compose]: https://docs.docker.com/compose/install
+[git]: https://git-scm.com/
\ No newline at end of file
diff --git a/psu b/psu
index 39a5592..a9a2d2d 100755
--- a/psu
+++ b/psu
@@ -170,7 +170,7 @@ main() {
echo "$services"
else
# Only display service(s) name in quiet mode
- echo "$services" | jq -r '.[] | [.Spec.Name] | add'
+ echo "$services" | jq -r '.[] | [.Spec.Name] | add' | tr -d '\r'
fi
exit 0
fi
@@ -229,7 +229,7 @@ main() {
echo "$tasks"
else
# Only display task(s) id in quiet mode
- echo "$tasks" | jq -r '.[] | [.ID] | add'
+ echo "$tasks" | jq -r '.[] | [.ID] | add' | tr -d '\r'
fi
exit 0
fi
@@ -248,7 +248,7 @@ main() {
echo "$containers"
else
# Only display container(s) id in quiet mode
- echo "$containers" | jq -r '.[] | [.Id] | add'
+ echo "$containers" | jq -r '.[] | [.Id] | add' | tr -d '\r'
fi
exit 0
fi
@@ -277,7 +277,7 @@ main() {
echo "$STACKS"
else
# Only display stack names in quiet mode
- echo "$STACKS" | jq -r '.[] | [.Name] | add'
+ echo "$STACKS" | jq -r '.[] | [.Name] | add' | tr -d '\r'
fi
exit 0
fi
@@ -912,7 +912,7 @@ unique_temp_file_path() {
if [ -w "$temp_path" ]; then
local file_uuid
# Generate universally unique identifier (UUID)
- file_uuid=$(if [ -x "$(command -v uuidgen)" ]; then uuidgen; else cat /proc/sys/kernel/random/uuid; fi)
+ file_uuid=$(if [ -x "$(command -v uuidgen)" ]; then uuidgen; else cat /proc/sys/kernel/random/uuid 2> /dev/null || od -vAn -N4 -t u4 < /dev/urandom | tr -d ' '; fi)
if [ -z "$file_uuid" ]; then
echo_error "You must install the 'uuidgen' program, to generate universally unique identifier"
exit 1
@@ -1340,11 +1340,13 @@ lint() {
###################################################
env_file_to_json() {
local jq_command
+ local sh_command
- # For macOS compatibility
- jq_command="$(which jq)"
+ # For macOS and Windows compatibility
+ jq_command="$(command -v jq)"
+ sh_command="$(command -v sh)"
- env -i sh -c "(unset \$(env | sed 's/=.*//'); set -a; . $(readlink_wrapper -f $ENVIRONMENT_VARIABLES_FILE); set +a; \"$jq_command\" -njc 'env | to_entries | map({name: .key, value: .value})')"
+ env -i "$sh_command" -c "(unset \$(env | sed 's/=.*//'); set -a; . $(readlink_wrapper -f $ENVIRONMENT_VARIABLES_FILE); set +a; \"$jq_command\" -njc 'env | to_entries | map({name: .key, value: .value})')"
}
# Set the ACTIONS variable who's a list of all psu actions
diff --git a/tests/run.sh b/tests/run.sh
index 65f4781..37508b7 100644
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -15,11 +15,11 @@ fi
SWARM_NODE_NAME=${SWARM_NODE_NAME:-cluster}
SWARM_NODE_IP=${SWARM_NODE_IP:-$(getent hosts "${SWARM_NODE_NAME}" | awk '{ print $1 }')}
-export BASE_DOMAIN="$SWARM_NODE_IP.nip.io"
+export BASE_DOMAIN=${SWARM_NODE_IP}.nip.io
export PSU_STACK_NAME="web-app"
-PSU_URL="https://portainer.$BASE_DOMAIN"
-PSU_USER="admin"
-PSU_PASSWORD=${PSU_PASSWORD:-"$(openssl rand -hex 50)"}
+PSU_URL="${PSU_URL:-"https://portainer.${BASE_DOMAIN}"}"
+PSU_USER="${PSU_USER:-admin}"
+PSU_PASSWORD="${PSU_PASSWORD:-"$(openssl rand -hex 50)"}"
PSU_TAG=$(if [ -n "$PSU_TAG" ]; then
eval echo "$PSU_TAG";