|
@ -217,7 +217,15 @@ get_os() { |
|
|
local uname_output |
|
|
local uname_output |
|
|
uname_output="$(uname -s)" |
|
|
uname_output="$(uname -s)" |
|
|
case "${uname_output}" in |
|
|
case "${uname_output}" in |
|
|
Linux*) e linux;; |
|
|
|
|
|
|
|
|
Linux*) |
|
|
|
|
|
if [[ "$(< /proc/version)" == *@(Microsoft|WSL)* ]]; then |
|
|
|
|
|
e wsl |
|
|
|
|
|
# elif [[ "$(< /proc/version)" == *"@(microsoft|WSL)"* ]]; then |
|
|
|
|
|
# e wsl2 |
|
|
|
|
|
else |
|
|
|
|
|
e linux |
|
|
|
|
|
fi |
|
|
|
|
|
;; |
|
|
Darwin*) e mac;; |
|
|
Darwin*) e mac;; |
|
|
CYGWIN*) e cygwin;; |
|
|
CYGWIN*) e cygwin;; |
|
|
MINGW*) e mingw;; |
|
|
MINGW*) e mingw;; |
|
@ -648,6 +656,10 @@ pretty_print() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
win_env() { "$CMD" /c "<nul set /p=%${1}%" 2>/dev/null; } |
|
|
|
|
|
wsl_path_env() { wslpath "$(win_env "${1}")"; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_os() { |
|
|
set_os() { |
|
|
OS="$(get_os)" |
|
|
OS="$(get_os)" |
|
|
case "$OS" in |
|
|
case "$OS" in |
|
@ -680,6 +692,41 @@ set_os() { |
|
|
TZ_PATH=${TZ_PATH:-"$COMPOSE_LOCAL_ROOT"/timezones} |
|
|
TZ_PATH=${TZ_PATH:-"$COMPOSE_LOCAL_ROOT"/timezones} |
|
|
COMPOSE_LAUNCHER_CACHE=${COMPOSE_LAUNCHER_CACHE:-"$COMPOSE_LOCAL_ROOT"/cache} |
|
|
COMPOSE_LAUNCHER_CACHE=${COMPOSE_LAUNCHER_CACHE:-"$COMPOSE_LOCAL_ROOT"/cache} |
|
|
;; |
|
|
;; |
|
|
|
|
|
wsl) |
|
|
|
|
|
type -p cmd.exe >/dev/null || { |
|
|
|
|
|
die "cmd.exe is not found in \$PATH." |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CMD=$(type -p cmd.exe >/dev/null) || { |
|
|
|
|
|
for p in {/mnt,}/c/WINDOWS/SYSTEM32; do |
|
|
|
|
|
if [ -x "$p"/cmd.exe ]; then |
|
|
|
|
|
CMD="$p"/cmd.exe |
|
|
|
|
|
fi |
|
|
|
|
|
done |
|
|
|
|
|
if [ -z "$CMD" ]; then |
|
|
|
|
|
die "cmd.exe is not found in \$PATH." \ |
|
|
|
|
|
"And could not find it in standard directories." |
|
|
|
|
|
fi |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WIN_HOME="$(wsl_path_env UserProfile)" |
|
|
|
|
|
WIN_PROGRAM_FILES="$(wsl_path_env ProgramFiles)" |
|
|
|
|
|
|
|
|
|
|
|
COMPOSE_LAUNCHER_APP_DIR="$WIN_PROGRAM_FILES/Compose" |
|
|
|
|
|
COMPOSE_LOCAL_ROOT=${COMPOSE_LOCAL_ROOT:-"$WIN_HOME/AppData/Local/Compose/Launcher"} |
|
|
|
|
|
|
|
|
|
|
|
COMPOSE_VAR=${COMPOSE_VAR:-"$WIN_HOME/AppData/Local/Compose/lib"} |
|
|
|
|
|
COMPOSE_CACHE=${COMPOSE_CACHE:-"$WIN_HOME/AppData/Local/Compose/cache"} |
|
|
|
|
|
|
|
|
|
|
|
DATASTORE=${DATASTORE:-"$WIN_HOME/AppData/Local/Compose/data"} |
|
|
|
|
|
CONFIGSTORE=${CONFIGSTORE:-"$WIN_HOME/AppData/Local/Compose/config"} |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "$COMPOSE_VAR" "$COMPOSE_CACHE" "$DATASTORE" "$CONFIGSTORE" || return 1 |
|
|
|
|
|
SESSION_DIR=${SESSION_DIR:-"$COMPOSE_LOCAL_ROOT"/sessions} |
|
|
|
|
|
CHARM_STORE=${CHARM_STORE:-"$COMPOSE_LAUNCHER_APP_DIR/charm-store"} |
|
|
|
|
|
TZ_PATH=${TZ_PATH:-"$COMPOSE_LOCAL_ROOT"/timezones} |
|
|
|
|
|
COMPOSE_LAUNCHER_CACHE=${COMPOSE_LAUNCHER_CACHE:-"$COMPOSE_LOCAL_ROOT"/cache} |
|
|
|
|
|
;; |
|
|
*) |
|
|
*) |
|
|
echo "System '$os' not supported yet." >&2 |
|
|
echo "System '$os' not supported yet." >&2 |
|
|
return 1 |
|
|
return 1 |
|
|