mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2024-12-28 10:35:05 +08:00
chore: get run.sh to be POSIX Compliant (#1649)
* Create CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * fix: get run.sh posix compliant * Update venv.sh * Delete CONTRIBUTING.md --------- Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
This commit is contained in:
parent
5449f84f06
commit
8bd34d1881
20
run.sh
20
run.sh
@ -1,27 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
# macOS specific env:
|
# macOS specific env:
|
||||||
export PYTORCH_ENABLE_MPS_FALLBACK=1
|
export PYTORCH_ENABLE_MPS_FALLBACK=1
|
||||||
export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
|
export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
|
||||||
elif [[ "$(uname)" != "Linux" ]]; then
|
elif [ "$(uname)" != "Linux" ]; then
|
||||||
echo "Unsupported operating system."
|
echo "Unsupported operating system."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d ".venv" ]; then
|
if [ -d ".venv" ]; then
|
||||||
echo "Activate venv..."
|
echo "Activate venv..."
|
||||||
source .venv/bin/activate
|
. .venv/bin/activate
|
||||||
else
|
else
|
||||||
echo "Create venv..."
|
echo "Create venv..."
|
||||||
requirements_file="requirements.txt"
|
requirements_file="requirements.txt"
|
||||||
|
|
||||||
# Check if Python 3.8 is installed
|
# Check if Python 3.8 is installed
|
||||||
if ! command -v python3 &> /dev/null; then
|
if ! command -v python3 >/dev/null 2>&1; then
|
||||||
echo "Python 3 not found. Attempting to install 3.8..."
|
echo "Python 3 not found. Attempting to install 3.8..."
|
||||||
if [[ "$(uname)" == "Darwin" ]] && command -v brew &> /dev/null; then
|
if [ "$(uname)" = "Darwin" ] && command -v brew >/dev/null 2>&1; then
|
||||||
brew install python@3.8
|
brew install python@3.8
|
||||||
elif [[ "$(uname)" == "Linux" ]] && command -v apt-get &> /dev/null; then
|
elif [ "$(uname)" = "Linux" ] && command -v apt-get >/dev/null 2>&1; then
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install python3.8
|
sudo apt-get install python3.8
|
||||||
else
|
else
|
||||||
@ -31,13 +31,13 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
source .venv/bin/activate
|
. .venv/bin/activate
|
||||||
|
|
||||||
# Check if required packages are installed and install them if not
|
# Check if required packages are installed and install them if not
|
||||||
if [ -f "${requirements_file}" ]; then
|
if [ -f "${requirements_file}" ]; then
|
||||||
installed_packages=$(python3 -m pip freeze)
|
installed_packages=$(python3 -m pip freeze)
|
||||||
while IFS= read -r package; do
|
while IFS= read -r package; do
|
||||||
[[ "${package}" =~ ^#.* ]] && continue
|
expr "${package}" : "^#.*" > /dev/null && continue
|
||||||
package_name=$(echo "${package}" | sed 's/[<>=!].*//')
|
package_name=$(echo "${package}" | sed 's/[<>=!].*//')
|
||||||
if ! echo "${installed_packages}" | grep -q "${package_name}"; then
|
if ! echo "${installed_packages}" | grep -q "${package_name}"; then
|
||||||
echo "${package_name} not found. Attempting to install..."
|
echo "${package_name} not found. Attempting to install..."
|
||||||
@ -53,7 +53,7 @@ fi
|
|||||||
# Download models
|
# Download models
|
||||||
./tools/dlmodels.sh
|
./tools/dlmodels.sh
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [ $? -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user