Skip to content

Commit

Permalink
update: 0.0.1
Browse files Browse the repository at this point in the history
Signed-off-by: huyikun.hyk <[email protected]>
  • Loading branch information
huyikun.hyk committed Feb 26, 2024
1 parent 60405d1 commit 1e0fad3
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions script.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
set -e # 报错后不继续执行
#!/bin/bash

# 执行命令并捕获输出
VERSION_OUTPUT=$(s -v)
version=$5
# valid_version=(
# v3.0.0
# v3.0.1
# v3.0.2
# )
# if [[ "${valid_version[@]}" =~ "${version}" ]]; then
if [ ! -f "/usr/local/bin/s" ]; then
set -e # 报错后不继续执行

# 检查输出是否包含版本号的格式
if [[ $VERSION_OUTPUT ]]; then
EXTRACTED_CONTENT=$(echo "$VERSION_OUTPUT" | sed -n 's/start:\([^,]*\),.*/\1/p;q')
echo "Version output is valid: $EXTRACTED_CONTENT"
else
echo 'Serverless-devs installing.'
npm install -g @serverless-devs/s@${version}
curl "https://images.devsapp.cn/bin/s/${version}" --output /usr/local/bin/s
chmod 777 /usr/local/bin/s
echo 'Serverless-devs has been installed successfully.'
# curl "https://images.devsapp.cn/bin/s/${version}" --output /usr/local/bin/s
# chmod 777 /usr/local/bin/s
fi

echo '################################################'
s config add --AccountID $1 --AccessKeyID $2 --AccessKeySecret $3 -a $4 -f
echo '################################################'
echo 'The access has been configured automatically, use "s config get" to check.'
# else
# echo $version "is not valid, please choose correct version."


# # version=$5
# # valid_version=(
# # v3.0.0
# # v3.0.1
# # v3.0.2
# # )
# # if [[ "${valid_version[@]}" =~ "${version}" ]]; then
# echo 'Serverless-devs installing.'
# npm install -g @serverless-devs/s@${version}
# echo 'Serverless-devs has been installed successfully.'
# # curl "https://images.devsapp.cn/bin/s/${version}" --output /usr/local/bin/s
# # chmod 777 /usr/local/bin/s
# fi
# echo '################################################'
# s config add --AccountID $1 --AccessKeyID $2 --AccessKeySecret $3 -a $4 -f
# echo '################################################'
# echo 'The access has been configured automatically, use "s config get" to check.'
# # else
# # echo $version "is not valid, please choose correct version."
# # fi

0 comments on commit 1e0fad3

Please sign in to comment.