From: AJ ONeal Date: Mon, 27 Apr 2020 06:00:09 +0000 (+0000) Subject: bugfix file copy and version detect X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=a7bd695b101fab5db5f0db40d82fa7287e044359;p=webi-installers%2F.git bugfix file copy and version detect --- diff --git a/flutter/flutter.bash b/flutter/flutter.bash index 6d8abfc..6fe9688 100644 --- a/flutter/flutter.bash +++ b/flutter/flutter.bash @@ -21,7 +21,6 @@ if [ "darwin" == "$FLUTTER_OS" ]; then fi my_tmp="$WEBI_TMP" -sudo_cmd="$WEBI_SUDO" ######### # BEGIN # @@ -61,9 +60,8 @@ mkdir -p "$flutter_install_path" # TODO warn if existing flutter in path my take precedence if [ -e "$flutter_install_path/bin/flutter" ]; then # flutter of some version is already installed - echo "${FLUTTER_VER}" == "$($flutter_install_path/bin/flutter --version)" - if [ "${FLUTTER_VER}" == "$($flutter_install_path/bin/flutter --version | cut -d ' ' -f 3 2>/dev/null)" ]; then - echo ${FLUTTER_VER} already installed at $flutter_install_path + if [ "${FLUTTER_VER}" == "$($flutter_install_path/bin/flutter --version | head -n 1 | cut -d ' ' -f2 2>/dev/null)" ]; then + echo flutter_${FLUTTER_VER} already installed at $flutter_install_path exit 0 fi fi @@ -94,11 +92,11 @@ else tar xf ${FLUTTER_LOCAL} -C ${FLUTTER_UNTAR}/ #--strip-components=1 fi if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then - echo $sudo_cmd rsync -Krl "${FLUTTER_UNTAR}"/flutter/ "$flutter_install_path/" - rsync -Krl "${FLUTTER_UNTAR}/" "$flutter_install_path/" 2>/dev/null || $sudo_cmd rsync -Krl "${FLUTTER_UNTAR}/" "$flutter_install_path/" + echo rsync -Krl "${FLUTTER_UNTAR}"/flutter/ "$flutter_install_path/" + rsync -Krl "${FLUTTER_UNTAR}/flutter/" "$flutter_install_path/" else - echo $sudo_cmd cp -Hr "${FLUTTER_UNTAR}/"flutter/* "${FLUTTER_UNTAR}/"flutter/.* "$flutter_install_path/" - cp -Hr "${FLUTTER_UNTAR}"/* "$flutter_install_path/" 2>/dev/null || $sudo_cmd cp -Hr "${FLUTTER_UNTAR}"/* "$flutter_install_path/" + echo cp -Hr "${FLUTTER_UNTAR}/"flutter/* "${FLUTTER_UNTAR}/"flutter/.* "$flutter_install_path/" + cp -Hr "${FLUTTER_UNTAR}/"flutter/* "${FLUTTER_UNTAR}/"flutter/.* "$flutter_install_path/" fi rm -rf "${FLUTTER_UNTAR}"