|
|
|
@ -2,8 +2,10 @@
@@ -2,8 +2,10 @@
|
|
|
|
|
echo "Upgrade machete ..." |
|
|
|
|
echo "" |
|
|
|
|
|
|
|
|
|
## 改为优先从gitcode下载,避免域名解析问题 |
|
|
|
|
download_link_gitcode="https://gitcode.net/filesite/machete/-/archive/master/machete-master.tar.gz" |
|
|
|
|
#增加手动下载更新包后更新操作 |
|
|
|
|
manual=$1 |
|
|
|
|
|
|
|
|
|
## 默认从git.filesite.io升级最新版 |
|
|
|
|
download_link_filesite="https://git.filesite.io/filesite/machete/archive/master.tar.gz" |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -32,26 +34,33 @@ fi
@@ -32,26 +34,33 @@ fi
|
|
|
|
|
|
|
|
|
|
cd /var/www/downloads/ |
|
|
|
|
|
|
|
|
|
if [ -f master.tar.gz ]; then |
|
|
|
|
rm -f master.tar.gz |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ -d machete/ ]; then |
|
|
|
|
rm -rf machete/ |
|
|
|
|
fi |
|
|
|
|
# 下载压缩包 |
|
|
|
|
if [ -z "${manual}" ]; then |
|
|
|
|
if [ -f master.tar.gz ]; then |
|
|
|
|
rm -f master.tar.gz |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ -d machete/ ]; then |
|
|
|
|
rm -rf machete/ |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# 升级machete |
|
|
|
|
detect_domain="gitcode.net" |
|
|
|
|
echo "检测${detect_domain}是否可连接..." |
|
|
|
|
detectDomainCanConnect "${detect_domain}" |
|
|
|
|
connect_res=$? |
|
|
|
|
if [ $connect_res -eq 0 ]; then |
|
|
|
|
echo "⚠️⚠️" |
|
|
|
|
echo "当前网络无法连接[${detect_domain}],即将从备用网址下载machete" |
|
|
|
|
curl --connect-timeout 15 "${download_link_filesite}" -o "master.tar.gz" |
|
|
|
|
else |
|
|
|
|
curl --connect-timeout 15 "${download_link_gitcode}" -o "master.tar.gz" |
|
|
|
|
echo "尝试从filesite.io下载最新版源码..." |
|
|
|
|
echo "" |
|
|
|
|
|
|
|
|
|
detect_domain="git.filesite.io" |
|
|
|
|
echo "检测${detect_domain}是否可连接..." |
|
|
|
|
detectDomainCanConnect "${detect_domain}" |
|
|
|
|
connect_res=$? |
|
|
|
|
if [ $connect_res -eq 0 ]; then |
|
|
|
|
echo "⚠️⚠️" |
|
|
|
|
echo "当前网络无法连接[${detect_domain}]" |
|
|
|
|
echo "请手动下载:${download_link_filesite},并保存到:/var/www/downloads/" |
|
|
|
|
echo "再执行:/var/www/machete/upgrade.sh manual" |
|
|
|
|
echo "" |
|
|
|
|
exit |
|
|
|
|
else |
|
|
|
|
curl --connect-timeout 15 "${download_link_filesite}" -o "master.tar.gz" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ -f "master.tar.gz" ]; then |
|
|
|
@ -59,11 +68,6 @@ if [ -f "master.tar.gz" ]; then
@@ -59,11 +68,6 @@ if [ -f "master.tar.gz" ]; then
|
|
|
|
|
tar -zxvf master.tar.gz |
|
|
|
|
rm -f master.tar.gz |
|
|
|
|
|
|
|
|
|
# 兼容gitcode的tar包解压后目录为:machete-master/ |
|
|
|
|
if [ -d machete-master/ ]; then |
|
|
|
|
mv machete-master/ machete/ |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
rsync -vrL machete/* /var/www/machete/ \ |
|
|
|
|
--exclude=www/content/ \ |
|
|
|
|
--exclude=www/navs/ \ |
|
|
|
@ -72,41 +76,29 @@ if [ -f "master.tar.gz" ]; then
@@ -72,41 +76,29 @@ if [ -f "master.tar.gz" ]; then
|
|
|
|
|
--exclude=www/tajian/ \ |
|
|
|
|
--exclude=runtime/ |
|
|
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
echo "Machete front-end upgraded." |
|
|
|
|
echo "" |
|
|
|
|
echo "Machete front-end upgraded." |
|
|
|
|
echo "" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# admin/后台不再维护 |
|
|
|
|
# upgrade admin |
|
|
|
|
## cd /var/www/downloads/ |
|
|
|
|
## curl --connect-timeout 15 "https://git.filesite.io/wen/jialuomaadmin/archive/master.tar.gz" -o "master.tar.gz" |
|
|
|
|
# upgrade nginx config |
|
|
|
|
if [ -d /etc/nginx/http.d/ ]; then |
|
|
|
|
cp /var/www/machete/conf/nginx_machete.conf /etc/nginx/http.d/machete.conf |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
## if [ -f "master.tar.gz" ]; then |
|
|
|
|
## |
|
|
|
|
## tar -zxvf master.tar.gz |
|
|
|
|
## rm -f master.tar.gz |
|
|
|
|
## rm -rf /var/www/machete/www/admin/ |
|
|
|
|
## mv jialuomaadmin/dist/ /var/www/machete/www/admin |
|
|
|
|
## |
|
|
|
|
## fi |
|
|
|
|
## echo "Admin system upgraded." |
|
|
|
|
## echo "" |
|
|
|
|
if [ -d /etc/nginx/conf.d/ ]; then |
|
|
|
|
cp /var/www/machete/conf/nginx_machete.conf /etc/nginx/conf.d/machete.conf |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
/usr/sbin/nginx -s reload |
|
|
|
|
echo "Nginx config upgraded and reloaded." |
|
|
|
|
echo "" |
|
|
|
|
|
|
|
|
|
# upgrade nginx config |
|
|
|
|
if [ -d /etc/nginx/http.d/ ]; then |
|
|
|
|
cp /var/www/machete/conf/nginx_machete.conf /etc/nginx/http.d/machete.conf |
|
|
|
|
else |
|
|
|
|
echo "没有找到源码压缩包:/var/www/downloads/master.tar.gz" |
|
|
|
|
echo "" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ -d /etc/nginx/conf.d/ ]; then |
|
|
|
|
cp /var/www/machete/conf/nginx_machete.conf /etc/nginx/conf.d/machete.conf |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
/usr/sbin/nginx -s reload |
|
|
|
|
echo "Nginx config upgraded and reloaded." |
|
|
|
|
echo "" |
|
|
|
|
|
|
|
|
|
echo "" |
|
|
|
|
echo "==Machete upgrade done.==" |
|
|
|
|