Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix install env issues #373

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions ext/v3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ function download_file() {
fi
_down_symbol=0
if [ ! -f "$2" ]; then
echo -ne "$(nhead) 正在下载 $1 ... "
# 获取目录路径
download_dir=$(dirname "$2")

# 检查目录是否存在,如果不存在则创建
if [ ! -d "$download_dir" ]; then
mkdir -p "$download_dir"
fi

echo -ne "$(nhead) 正在下载 $1 到目录 $download_dir ... "
$downloader "$1" -$_down_prefix "$2" >/dev/null 2>&1 && echo "完成!" && _down_symbol=1
else
echo "已存在!" && _down_symbol=1
echo "文件已存在!" && _down_symbol=1
fi
if [ $_down_symbol == 0 ]; then
echo "$(nhead red) 下载失败!请检查网络连接!"
Expand Down Expand Up @@ -68,6 +76,7 @@ function install_native_php() {

# 安装下载Composer
function install_native_composer() {

if [ ! -f "$ZM_TEMP_DIR/composer.phar" ]; then
# 下载 composer.phar
download_file "https://mirrors.aliyun.com/composer/composer.phar" "$ZM_TEMP_DIR/composer.phar" || return 1
Expand Down Expand Up @@ -209,9 +218,9 @@ function if_use_aliyun() {

function if_restore_native_runtime() {
ZM_RUNTIME_DIR="$ZM_PWD/$ZM_CUSTOM_DIR/runtime/"
mkdir -p "$ZM_RUNTIME_DIR"
if [ "$php_executable" = "$ZM_TEMP_DIR/php" ]; then
echo "$(nhead) 移动内建 PHP 到框架目录 $ZM_RUNTIME_DIR ..." && \
mkdir -p "$ZM_RUNTIME_DIR" && \
mv "$ZM_TEMP_DIR/php" "$ZM_RUNTIME_DIR" || {
echo "$(nhead red) 移动内建 PHP 到框架目录失败!" && return 1
}
Expand All @@ -220,8 +229,8 @@ function if_restore_native_runtime() {
if [ "$composer_executable" = "$ZM_TEMP_DIR/composer" ]; then
echo "$(nhead) 移动内建 Composer 到框架目录 $ZM_RUNTIME_DIR ..." && \
mkdir -p "$ZM_CUSTOM_DIR/runtime" && \
mv "$ZM_TEMP_DIR/composer" "$ZM_RUNTIME_DIR" && \
mv "$ZM_TEMP_DIR/composer.phar" "$ZM_RUNTIME_DIR" || {
mv "$ZM_TEMP_DIR/composer.phar" "$ZM_RUNTIME_DIR" && \
mv "$ZM_TEMP_DIR/composer" "$ZM_RUNTIME_DIR" || {
echo "$(nhead red) 移动内建 Composer 到框架目录失败!" && return 1
}
composer_executable="$ZM_RUNTIME_DIR/composer"
Expand Down
Loading