diff --git a/devkit-kunpeng-porting.spec b/devkit-kunpeng-porting.spec index 0fc2d2f7dfaf409f130ab2611be459260a82cbf8..9f9cc3075e646da6f96ef1820e90a52042e34410 100644 --- a/devkit-kunpeng-porting.spec +++ b/devkit-kunpeng-porting.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: devkit-porting-advisor -Version: 2.5.0 +Version: 23.0.RC2 Release: 1 Summary: devkit porting advisor License: GPL @@ -23,30 +23,30 @@ mkdir -p ${TempPortingDir} echo "download package..." cd %{_sourcedir} -wget https://kunpeng-repo.obs.cn-north-4.myhuaweicloud.com/Porting%20Advisor/Porting%20Advisor%202.5.0/Porting-advisor_2.5.0_linux-Kunpeng.tar.gz -tar -xf Porting-advisor_2.5.0_linux-Kunpeng.tar.gz -cd %{_sourcedir}/Porting-advisor_2.5.0_linux-Kunpeng -tar -xf Porting-advisor_2.5.0_linux-Kunpeng.tar.gz -cp -rf %{_sourcedir}/Porting-advisor_2.5.0_linux-Kunpeng/Porting-advisor_2.5.0_linux-Kunpeng ${TempPortingDir} -cd ${TempPortingDir}/Porting-advisor_2.5.0_linux-Kunpeng +wget https://kunpeng-repo.obs.cn-north-4.myhuaweicloud.com/Porting%20Advisor/Porting%20Advisor%2023.0.RC2/Porting-advisor_23.0.RC2_linux-Kunpeng.tar.gz +tar -xf Porting-advisor_23.0.RC2_linux-Kunpeng.tar.gz +cd %{_sourcedir}/Porting-advisor_23.0.RC2_linux-Kunpeng +tar -xf Porting-advisor_23.0.RC2_linux-Kunpeng.tar.gz +cp -rf %{_sourcedir}/Porting-advisor_23.0.RC2_linux-Kunpeng/Porting-advisor_23.0.RC2_linux-Kunpeng ${TempPortingDir} +cd ${TempPortingDir}/Porting-advisor_23.0.RC2_linux-Kunpeng echo "patch..." PatchPath=%{_sourcedir}/remove-the-interaction.patch -patch -p1 < ${PatchPath} -cp %{_sourcedir}/Porting-advisor_2.5.0_linux-Kunpeng/cms ${TempPortingDir}/Porting-advisor_2.5.0_linux-Kunpeng +patch -p2 < ${PatchPath} +cp %{_sourcedir}/Porting-advisor_23.0.RC2_linux-Kunpeng/cms ${TempPortingDir}/Porting-advisor_23.0.RC2_linux-Kunpeng cd ${TempPortingDir} -tar -zcf Porting-advisor_2.5.0_linux-Kunpeng.tar.gz ./Porting-advisor_2.5.0_linux-Kunpeng +tar -zcf Porting-advisor_23.0.RC2_linux-Kunpeng.tar.gz ./Porting-advisor_23.0.RC2_linux-Kunpeng ls ${TempPortingDir} -rm -rf ${TempPortingDir}/Porting-advisor_2.5.0_linux-Kunpeng +rm -rf ${TempPortingDir}/Porting-advisor_23.0.RC2_linux-Kunpeng %install echo "install..." PortingDir=$RPM_BUILD_ROOT/home/devkit-porting mkdir -p ${PortingDir} -cp %{_sourcedir}/temp-porting-dir/Porting-advisor_2.5.0_linux-Kunpeng.tar.gz ${PortingDir} +cp %{_sourcedir}/temp-porting-dir/Porting-advisor_23.0.RC2_linux-Kunpeng.tar.gz ${PortingDir} %files -/home/devkit-porting/Porting-advisor_2.5.0_linux-Kunpeng.tar.gz +/home/devkit-porting/Porting-advisor_23.0.RC2_linux-Kunpeng.tar.gz #%doc @@ -56,10 +56,10 @@ echo "pre install..." %post echo "post install..." PortingDir=/home/devkit-porting -PortingInstallDir=${PortingDir}/Porting-advisor_2.5.0_linux-Kunpeng +PortingInstallDir=${PortingDir}/Porting-advisor_23.0.RC2_linux-Kunpeng cd ${PortingDir} -tar -xf Porting-advisor_2.5.0_linux-Kunpeng.tar.gz +tar -xf Porting-advisor_23.0.RC2_linux-Kunpeng.tar.gz cd ${PortingInstallDir} bash .install.sh web diff --git a/remove-the-interaction.patch b/remove-the-interaction.patch index e539f6c6502814f1cf28a419ebf5bee91aab9ff3..5b33b3bfed3ef04c543835f15bfdf851510be291 100644 --- a/remove-the-interaction.patch +++ b/remove-the-interaction.patch @@ -1,97 +1,33 @@ -From f4162517b31be8dd69f869a0ea3443766bb7e0bd Mon Sep 17 00:00:00 2001 -From: abc -Date: Fri, 10 Mar 2023 01:56:50 +0800 -Subject: [PATCH] remove-the-interaction +From 3838f7207a9e8e4fb98f8b744fedf5ff051aa78c Mon Sep 17 00:00:00 2001 +From: goatmiemie <13041298066@163.com> +Date: Thu, 13 Jul 2023 15:36:37 +0800 +Subject: [PATCH] asd --- - .install.sh | 2 + - .upgrade.sh | 0 - check_install_env.sh | 29 ++----- - common_func.sh | 57 ++++++-------- - common_path.sh | 47 ++---------- - const.conf | 3 +- - install_webfunc.sh | 179 ++++--------------------------------------- - start_install.sh | 2 +- - uninstall.sh | 51 ------------ - 9 files changed, 54 insertions(+), 316 deletions(-) - mode change 100755 => 100644 .install.sh - mode change 100755 => 100644 .upgrade.sh - mode change 100755 => 100644 uninstall.sh + .../.install.sh | 2 + + .../common_func.sh | 56 ++++------ + .../common_path.sh | 46 +------- + .../install_webfunc.sh | 105 +++--------------- + .../start_install.sh | 2 +- + .../uninstall.sh | 16 --- + 6 files changed, 43 insertions(+), 184 deletions(-) -diff --git a/.install.sh b/.install.sh -old mode 100755 -new mode 100644 -index daae2ee..98bcd97 ---- a/.install.sh -+++ b/.install.sh -@@ -100,3 +100,5 @@ install_main(){ +diff --git a/Porting-advisor_23.0.RC2_linux-Kunpeng/.install.sh b/Porting-advisor_23.0.RC2_linux-Kunpeng/.install.sh +index 72317a4..f8719f1 100644 +--- a/Porting-advisor_23.0.RC2_linux-Kunpeng/.install.sh ++++ b/Porting-advisor_23.0.RC2_linux-Kunpeng/.install.sh +@@ -102,3 +102,5 @@ install_main(){ return 0 fi } + +install_main $1 -diff --git a/.upgrade.sh b/.upgrade.sh -old mode 100755 -new mode 100644 -diff --git a/check_install_env.sh b/check_install_env.sh -index 5a5f252..d963e6c 100644 ---- a/check_install_env.sh -+++ b/check_install_env.sh -@@ -135,8 +135,8 @@ get_user_choice(){ - if [[ "$j" == "1" ]]; then - logger "Warning: The installation environment check failed. Read the following carefully." ${TIP_COLOR_WARNING} - fi -- if [[ "$i" -le "2" ]]; then -- logger "The check items 1 to 3 fails, proceed according to the handling suggestions." ${TIP_COLOR_WARNING} -+ if [[ "$i" -le "1" ]]; then -+ logger "The check items 1 to 2 fails, proceed according to the handling suggestions." ${TIP_COLOR_WARNING} - logger "Failed to check the environment. Perform related operations based on the suggestions and reinstall the tool." "ERROR" - logger "Installation canceled." ${TIP_COLOR_SUCCESS} - exit 1 -@@ -150,26 +150,7 @@ get_user_choice(){ - else - logger "The check item 8 fails, the firewall port ${HTTPSPORT} is disabled. In this case, authorize the tool to enable the port or manually enable it." ${TIP_COLOR_WARNING} - fi -- while true; do -- read -p "Do you want to authorize the tool to handle the items failed in the installation environment check?(y/n)" y_n -- logger "Failed to check the installation environment. Read the suggestions for the items that fail the check." "WARNING" -- logger "Do you want to authorize the tool to handle the items failed in the installation environment check? You input is:$y_n" -- if [[ $y_n == "y" ]] || [[ $y_n == "Y" ]]; then -- user_choice=yes -- return 0 -- elif [[ $y_n == "n" ]] || [[ $y_n == "N" ]]; then -- if [[ "$check_result_flag" == "7" ]]; then -- no_of_firewall_info -- return 0 -- else -- logger "You have refused to authorize the tool to process failed items in the environment check. Tool installation canceled." ${TIP_COLOR_SUCCESS} -- logger "Installation failed." ${TIP_COLOR_FAILED} -- exit 1 -- fi -- else -- logger "Incorrect entered information." ${TIP_COLOR_WARNING} -- fi -- done -+ user_choice=yes - fi - fi - done -@@ -201,6 +182,10 @@ record_firewall_modification(){ - # 处理环境检查中的失败项 - resolve_fail_checklist(){ - if [[ "$user_choice" == "yes" ]]; then -+ -+ if [[ "${CheckResult[2]}" = "fail" ]]; then -+ setenforce 0 -+ fi - if [[ "$check_result_flag" -le "5" ]]; then - # 环境清理 防火墙待检测 - del_service_conf -diff --git a/common_func.sh b/common_func.sh -index f82c215..7d8b9de 100644 ---- a/common_func.sh -+++ b/common_func.sh -@@ -719,44 +719,33 @@ create_multi_user(){ +\ No newline at end of file +diff --git a/Porting-advisor_23.0.RC2_linux-Kunpeng/common_func.sh b/Porting-advisor_23.0.RC2_linux-Kunpeng/common_func.sh +index 6bed807..c1f65af 100644 +--- a/Porting-advisor_23.0.RC2_linux-Kunpeng/common_func.sh ++++ b/Porting-advisor_23.0.RC2_linux-Kunpeng/common_func.sh +@@ -745,44 +745,32 @@ create_multi_user(){ # 创建多用户之前先删除残留portworker del_multi_user # 添加多用户 只有安装涉及到此步骤,使用路径为全局变量$customize_path @@ -155,23 +91,14 @@ index f82c215..7d8b9de 100644 fi done + return 0 -+ } del_multi_user(){ -diff --git a/common_path.sh b/common_path.sh -index 8c5de96..3ee028d 100644 ---- a/common_path.sh -+++ b/common_path.sh -@@ -699,7 +699,6 @@ get_install_user() - fi - } - -- - # 获取用户自定义安装路径 - get_customize_path() - { -@@ -712,47 +711,11 @@ get_customize_path() +diff --git a/Porting-advisor_23.0.RC2_linux-Kunpeng/common_path.sh b/Porting-advisor_23.0.RC2_linux-Kunpeng/common_path.sh +index 411f92b..9006339 100644 +--- a/Porting-advisor_23.0.RC2_linux-Kunpeng/common_path.sh ++++ b/Porting-advisor_23.0.RC2_linux-Kunpeng/common_path.sh +@@ -738,47 +738,11 @@ get_customize_path() else default_path="${HOME}" fi @@ -216,105 +143,21 @@ index 8c5de96..3ee028d 100644 - fi - fi - done ++ + change_path_auth $default_path $install_way $tool_name + check_avail_space $default_path + CUSTOMIZE_PATH="$default_path" + return '0' -+ } get_user_path() -diff --git a/const.conf b/const.conf -index 1cc1691..f1316a5 100644 ---- a/const.conf -+++ b/const.conf -@@ -18,7 +18,6 @@ kunpeng_software_support=https://support-it.huawei.com/kunpeng-software-support/ - web_https_url=https://IP:HTTPSPORT/porting/#/login - enable_port_tip=https://www.hikunpeng.com/document/detail/zh/kunpengdevps/porting/usermanual/kunpengpt_06_0017.html - nginx_systemctl_faild=https://www.hikunpeng.com/document/detail/zh/kunpengdevps/porting/usermanual/kunpengpt_06_0105.html --support_upgrade_version=2.3.0;2.5.RC1; - support_change_disclaimer_version=2.3.0;2.5.RC1; # “用户免责声明”更新,老版本升级到当前版本要重新签署 - cpu_implementers=(0x48 0x41) # 鲲鹏平台特征值. 两个值必须同时存在例如0x48和0xd01 --cpu_parts=(0xd01 0xd08) -\ No newline at end of file -+cpu_parts=(0xd01 0xd08) -diff --git a/install_webfunc.sh b/install_webfunc.sh -index 175482c..72d8a1e 100644 ---- a/install_webfunc.sh -+++ b/install_webfunc.sh -@@ -50,35 +50,8 @@ check_port_conflict() - port_status='1' - occupy_port=$inport - logger "Invalid port. The port $occupy_port is in use." ${TIP_COLOR_FAILED} -+ exit 1 - fi -- systemport=$(lsof -i :$inport|grep -v "PID" | awk '{print $2}') -- while [ "$conflictflag" == "1" ] -- do -- if [ "$systemport" != "" ]; then -- inport=$(($inport+1)) -- else -- if [ "$toolportflg" == "0" ]; then -- if [ "$inport" == "$HTTPSPORT" ]; then -- inport=$(($inport+1)) -- else -- conflictflag='0' -- break -- fi -- else -- conflictflag='0' -- break -- fi -- fi -- if [ "$inport" == "65536" ]; then -- inport=1024 -- fi -- if [ "$inport" == "$originport" ]; then -- conflictflag='0' -- inport=65536 -- break -- fi -- systemport=$(lsof -i :$inport|grep -v "PID" | awk '{print $2}') -- done - if [ "$set_tool_port_flg" == "0" ]; then - TOOLPORT=$inport - elif [ "$set_tool_port_flg" == "1" ]; then -@@ -86,143 +59,30 @@ check_port_conflict() - fi +diff --git a/Porting-advisor_23.0.RC2_linux-Kunpeng/install_webfunc.sh b/Porting-advisor_23.0.RC2_linux-Kunpeng/install_webfunc.sh +index 175482c..fc74418 100644 +--- a/Porting-advisor_23.0.RC2_linux-Kunpeng/install_webfunc.sh ++++ b/Porting-advisor_23.0.RC2_linux-Kunpeng/install_webfunc.sh +@@ -119,110 +119,31 @@ user_customize_port(){ } --# 端口用户自定义化实现交互功能 --user_customize_port(){ -- inputflag="1" -- while [ "$inputflag" == "1" ] -- do -- if [ "$port_status" == "0" ]; then -- tip_word="The $2 port $1 is valid. " -- else -- tip_word="The $2 port $occupy_port is in use." -- fi -- read -p "${tip_word} Set the $2 port to $1 (y/n default: y):" Y_N -- logger "${tip_word} Set the $2 port to $1 (y/n default: y), your input is ${Y_N}" -- if [ ! -n "$Y_N" ]; then -- Y_N='' -- inputflag="0" -- break -- elif [ "$Y_N" == "y" -o "$Y_N" == "n" ];then -- inputflag="0" -- break -- fi -- done -- if [ "$Y_N" = "n" ];then -- if [ "$2" = "tool" ]; then -- set_django_port $django_port -- else -- set_nginx_port $nginx_port -- fi -- else -- logger "Set the $2 port $1" ${TIP_COLOR_SUCCESS} -- fi --} - ip_input_customize(){ - ipflg='1' - while [ "$ipflg" == "1" ] @@ -393,7 +236,9 @@ index 175482c..72d8a1e 100644 - user_customize_port $HTTPSPORT "HTTPS" - fi + check_port_conflict $nginx_port ++ + logger "Set the nginx server port $nginx_port" ${TIP_COLOR_SUCCESS} ++ } set_django_port(){ @@ -429,59 +274,29 @@ index 175482c..72d8a1e 100644 - user_customize_port $TOOLPORT "tool" - fi + check_port_conflict $django_port -+ logger "Set the nginx server port $django_port" ${TIP_COLOR_SUCCESS} ++ logger "Set the django server port $django_port" ${TIP_COLOR_SUCCESS} ++ } # config ip and port -@@ -237,24 +97,15 @@ ip_port_config(){ - set_django_port $django_port - #################### - if [ "$flg" -eq "0" ]; then -- https_ip_port=$HTTPSPORT -+ https_ip_port=$nginx_port - else -- https_ip_port=$IP:$HTTPSPORT -+ https_ip_port=$IP:$nginx_port - fi -- tool_port=$TOOLPORT -+ tool_port=$django_port - current_dir=$(cd $(dirname $0); pwd) -- sed -i "s/IP:HTTPSPORT/$IP:$HTTPSPORT/g" $current_dir/const.conf -+ sed -i "s/IP:HTTPSPORT/$IP:$nginx_port/g" $current_dir/const.conf - } - --# cloud IDE 的django和nginx端口设置 --set_django_nginx_port(){ -- # 设置NGINX端口 -- set_tool_port_flg=1 -- check_port_conflict 8084 -- # 设置django端口 -- set_tool_port_flg=0 -- check_port_conflict 7998 --} - - check_installed(){ - architecture=$(uname -m) -diff --git a/start_install.sh b/start_install.sh -index 76c0a96..ed32ade 100644 ---- a/start_install.sh -+++ b/start_install.sh -@@ -160,7 +160,7 @@ start_install_process() - rm_file $new_path/unwind.h - platform=$(uname -a | awk -F " " '{print $(NF-1)}') - # 二进制文件验证的cms文件copy到tools下面 -- cp -rf $current_dir/../cms $customize_path/portadv/tools/ -+ cp -rf $current_dir/cms $customize_path/portadv/tools/ - # 解决方案移植模板放到resource/migration/目录下 - mkdir -p $customize_path/portadv/resource/migration - # 修改迁移模板中部分文件中的“/home/porting” -diff --git a/uninstall.sh b/uninstall.sh -old mode 100755 -new mode 100644 -index 16674e9..f171111 ---- a/uninstall.sh -+++ b/uninstall.sh -@@ -53,16 +53,6 @@ else +diff --git a/Porting-advisor_23.0.RC2_linux-Kunpeng/start_install.sh b/Porting-advisor_23.0.RC2_linux-Kunpeng/start_install.sh +index 3d532c7..6a1b00e 100644 +--- a/Porting-advisor_23.0.RC2_linux-Kunpeng/start_install.sh ++++ b/Porting-advisor_23.0.RC2_linux-Kunpeng/start_install.sh +@@ -169,7 +169,7 @@ install_web(){ + rm_file $new_path/unwind.h + platform=$(uname -a | awk -F " " '{print $(NF-1)}') + # 二进制文件验证的cms文件copy到tools下面 +- cp -rf $current_dir/../cms $customize_path/portadv/tools/ ++ cp -rf $current_dir/cms $customize_path/portadv/tools/ + # 解决方案移植模板放到resource/migration/目录下 + mkdir -p $customize_path/portadv/resource/migration + # 修改迁移模板中部分文件中的“/home/porting” +diff --git a/Porting-advisor_23.0.RC2_linux-Kunpeng/uninstall.sh b/Porting-advisor_23.0.RC2_linux-Kunpeng/uninstall.sh +index 508f884..aad84c3 100644 +--- a/Porting-advisor_23.0.RC2_linux-Kunpeng/uninstall.sh ++++ b/Porting-advisor_23.0.RC2_linux-Kunpeng/uninstall.sh +@@ -53,21 +53,6 @@ else os_type="$DefaultOsType" os_name="$DefaultOsName" fi @@ -495,57 +310,22 @@ index 16674e9..f171111 - break - fi -done - - if [ "$TO_DELETE" == "n" ] - then -@@ -132,47 +122,6 @@ if [ ! -e "$first_path/portadv/tools/webui" ]; then - check_cmd_task - fi - - --# 检查web模式当前是否有任务进行 --function check_web_task() --{ -- # gunicorn切换启动方式目前只有一个进程 -- default_process_count=1 -- if [[ $os_name =~ (CentOS .* 6\.) || $os_name =~ (Red Hat .* 6\.) ]]; then -- process_nums=$(ps -ef | grep gunicorn | grep porting | wc -l) -- else -- process_nums=$(ps -ef | grep gunicorn | grep -v service_gunicorn | grep porting | wc -l) -- fi -- if (( $(($default_process_count+1)) < $process_nums )); then -- read -p "A task is running.Are you sure you want to uninstall porting advisor?(y/n)" DELETE_WEB -- if [ "$DELETE_WEB" == "n" ]; then -- exit 0 -- elif [ "$DELETE_WEB" == "y" ]; then -- echo -e "\e[1;32mThe Kunpeng Porting Advisor is uninstalling.\e[0m" -- else -- echo -e "\e[1;31mIncorrect entered information.\e[0m" -- exit 1 -- fi -- fi -- portworker_process_nums=$(ps -o ruser=userForLongName -e -o pid,ppid | grep portworker | wc -l) -- # 查看是否有僵尸portworkerX僵尸进程并清理 -- if [ ! -z "${portworker_process_nums}" ]; then -- # 查看portworkerX组是否为porting -- results=$(ps -o ruser=userForLongName -e -o pid | grep portworker | awk '{print $1"+"$2}') -- if [ ! -z "${results}" ]; then -- for res in ${results};do -- user=$(echo $res | cut -d "+" -f 1) -- process_id=$(echo $res | cut -d "+" -f 2) -- portworker_gid=(id -g $user) -- if [ "${portworker_gid}" == "${porting_uid}" ]; then -- kill -9 $process_id -- fi -- done -- fi -- fi --} +-if [ "$TO_DELETE" == "n" ] +-then +- exit 0 +-fi + + # 判断用户是否有卸载权限 + file_user=$(ls -al $0 | awk '{print $3}') +@@ -171,7 +156,6 @@ function check_web_task() + fi + fi + } -check_web_task -- + check_firewalld "$os_name" "$os_type" - #web模式,关闭服务,移除开机启动 -- -2.27.0 +2.36.1.windows.1