Преглед на файлове

#IQRV #comment [Scripts] 添加拷贝安装脚本

gifur преди 4 години
родител
ревизия
832a412432
променени са 3 файла, в които са добавени 91 реда и са изтрити 137 реда
  1. 3 0
      CMakeLists.txt
  2. 0 137
      addin/din/unix/rvcinstall_tmp.sh
  3. 88 0
      addin/install.sh

+ 3 - 0
CMakeLists.txt

@@ -503,6 +503,9 @@ install(FILES "${CMAKE_SOURCE_DIR}/addin/hardwarecfg/${ROOT_INI_NAME}"
 	COMPONENT scripts)
 install(PROGRAMS ${BAT_SCRIPTS} DESTINATION "${PACK_INSTALL_PREFIX_VERSION}" COMPONENT scripts)
 install(FILES "${CMAKE_SOURCE_DIR}/addin/Run.ini" DESTINATION "${PACK_INSTALL_RUN_DIR}/./.." COMPONENT scripts)
+if(NOT MSVC)
+	install(PROGRAMS "${CMAKE_SOURCE_DIR}/addin/install.sh" DESTINATION "${PACK_INSTALL_RUN_DIR}/./.." COMPONENT scripts)
+endif(NOT MSVC)
 
 list(REMOVE_DUPLICATES RVC_CONAN_DEP_LIBS)
 if(CONAN_LIB_DIRS_QT)

+ 0 - 137
addin/din/unix/rvcinstall_tmp.sh

@@ -1,137 +0,0 @@
-#!/bin/bash
-MY_PATH="`dirname \"$0\"`"              # relative
-# echo "1"$MY_PATH
-MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
-
-
-echo "[RVCTermianal] === Install Start === "
-echo "result=-1&msg=install begin" > `pwd`/install.log
-rvc_install_path_root="/opt"
-rvc_install_path_rvc_dir=${rvc_install_path_root}/rvc
-rvc_install_path_Run_dir=${rvc_install_path_root}/Run
-rvc_install_path_hardware_dir=${rvc_install_path_Run_dir}/hardwarecfg
-rvc_install_path_versions_dir=${rvc_install_path_Run_dir}/version
-
-
-#detect the usr input the vendor or not
-has_vendor=0
-tolower_vendor=''
-upper_vendor=''
-if [ $# -eq 1 ];then
-    has_vendor=1
-    echo has arguments: $*
-	tolower_vendor=$(echo $1 | awk '{ print tolower($0) }' )
-    upper_vendor=$(echo $1 | awk '{ print toupper($0) }' )
-else
-    echo no any arguments.
-fi
-
-# to detect zipped pkg is exist or not
-pkgs=$(sudo find ${MY_PATH} -type f -name *.tar.gz | head -n 1)
-if [ "#${pkgs}" = "#" ]
-then
-    echo Fail to find tar install package !!
-    exit 1
-else
-    echo ${pkgs}
-fi
-
-cur_pkg=${pkgs}
-slen=${#cur_pkg}
-cur_pkg_len=$((${slen}-6))
-cur_pkg_exists_dir=$(echo $cur_pkg | awk '{ print substr($0,0,length($0)-6) }') #.tar.gz
-echo ${cur_pkg_exists_dir}
-
-# remove the unzipped files if exists
-if [ -d $cur_pkg_exists_dir ]; then
-    echo "to remove unzipped exists directory"
-    sudo rm -rf ${cur_pkg_exists_dir}
-fi
-
-# unzip the zipped pkg.
-echo to unzip $cur_pkg ...
-tar -xzvf $cur_pkg
-echo unzip $cur_pkg done!
-
-# fetch the version full path at pkg
-version_dir=$(find ${cur_pkg_exists_dir}/Run/version/ -maxdepth 1 -regex ".*[0-9\.]$" -type d)
-echo version dir: $version_dir
-slen=${#cur_pkg_exists_dir}
-rel_version_dir=${version_dir:$slen+1}
-echo ${rel_version_dir}
-
-#if [ $has_vendor -eq 1 ];then
-#    bak=${cur_pkg}_bak
-#    sudo rm -rf ${bak}
-#    sudo mkdir -p ${bak}
-#    sudo cp -R 'find ${version_dir} -type d -path ${version_dir}/dep -prune -o -print | sed 1d' ${bak}
-#fi
-
-
-# to copy thirdparty libraries
-
-# deal with libcef.so
-if [ ! -f "$version_dir/bin/Chromium/libcef.so" -a ! -f "/usr/lib/libcef.so"  ];then
-    echo cannot found libcef.so !!!
-    exit 1
-else if [ ! -f "/usr/lib/libcef.so" ];then
-    echo to mv libcef.so...
-    sudo mv $version_dir/bin/Chromium/libcef.so /usr/lib/
-    echo mv libcef.so done!
-else if [ -f "$version_dir/bin/Chromium/libcef.so" ]; then
-    sudo rm $version_dir/bin/Chromium/libcef.so
-fi
-fi
-fi
-sudo chmod 644 /usr/lib/libcef.so
-
-#delete /opt/rvc
-# sudo rm -rf ${rvc_install_path_rvc_dir}
-
-if [ ! -f $rvc_install_path_hardware_dir/root.ini ]; then
-    #delete /opt/Run
-    sudo rm -rf ${rvc_install_path_Run_dir}
-else
-    echo has root.ini at hardware folder!! do not remove Run base dir.
-fi
-
-
-#copy the Run pkg to run path
-echo to copy Run package...
-sudo cp -rvf $cur_pkg_exists_dir/Run ${rvc_install_path_root}
-echo copy Run package completely!
-
-#copy the res pkg to rvc path
-echo to copy rvc Audio files...
-if [ ! -d $rvc_install_path_rvc_dir ]; then
-    sudo mkdir -p ${rvc_install_path_rvc_dir}
-fi
-sudo cp -rvf $cur_pkg_exists_dir/Data/Audio ${rvc_install_path_rvc_dir}/addata
-echo copy rvc Audio files completely!
-
-echo change the run scripts priviledge...
-echo ${rvc_install_path_rvc_dir}
-echo ${rvc_install_path_root}/${rel_version_dir}
-sudo chmod 766 -R ${rvc_install_path_rvc_dir}
-sudo chmod 666 -R ${rvc_install_path_hardware_dir}
-sudo chmod 777 -R ${rvc_install_path_root}/${rel_version_dir}
-sudo chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh
-sudo chmod 777 ${rvc_install_path_versions_dir}/sudo_spexplorer.sh
-echo change the run scripts priviledge done!
-
-if [ $has_vendor -eq 1 ];then
-    root_file=$rvc_install_path_hardware_dir/root.ini
-    root_vendor_file=$rvc_install_path_hardware_dir/root.ini.$tolower_vendor
-    if [ -f $root_vendor_file ] #  ! -f $root_file -a 
-    then
-        echo copy root.ini
-        sudo cp $root_vendor_file $root_file
-    fi
-fi
-
-echo "result=0&msg=install ok" > `pwd`/install.log
-chmod 777 `pwd`/install.log
-
-echo "[RVCTermianal] all install work done completely!!!"
-
-exit 0

+ 88 - 0
addin/install.sh

@@ -0,0 +1,88 @@
+#!/bin/bash
+MY_PATH="`dirname \"$0\"`"              # relative
+# echo "1"$MY_PATH
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+
+
+echo "[RVCTermianal] === Install Start === "
+rvc_install_path_root="/opt"
+rvc_install_path_rvc_dir=${rvc_install_path_root}/rvc
+rvc_install_path_Run_dir=${rvc_install_path_root}/Run
+rvc_install_path_hardware_dir=${rvc_install_path_Run_dir}/hardwarecfg
+rvc_install_path_versions_dir=${rvc_install_path_Run_dir}/version
+
+#detect the usr input the vendor or not
+has_vendor=0
+tolower_vendor=''
+upper_vendor=''
+if [ $# -eq 1 ];then
+    has_vendor=1
+    echo has arguments: $*
+	tolower_vendor=$(echo $1 | awk '{ print tolower($0) }' )
+    upper_vendor=$(echo $1 | awk '{ print toupper($0) }' )
+else
+    echo no any arguments indicate vendor name.
+fi
+
+# fetch the version full path at pkg
+version_dir=$(find ${MY_PATH}/Run/version/ -maxdepth 1 -regex ".*[0-9\.]$" -type d)
+echo version dir: $version_dir
+slen=${#MY_PATH}
+rel_version_dir=${version_dir:$slen+1}
+echo ${rel_version_dir}
+
+if [ ! -f $rvc_install_path_hardware_dir/root.ini ]; then
+    #delete /opt/Run
+    sudo rm -rf ${rvc_install_path_Run_dir}
+else
+    echo root.ini 文件已存在,跳过清除 Run 文件夹.
+    if [ -f ${MY_PATH}/Run/hardwarecfg/root.ini ]; then
+        sudo rm ${MY_PATH}/Run/hardwarecfg/root.ini
+    fi
+    if [ -d ${MY_PATH}/Run/runinfo ]; then
+        sudo rm -rf ${MY_PATH}/Run/runinfo
+    fi
+fi
+
+#copy the Run pkg to run path
+echo to copy Run package...
+sudo cp -rvf $MY_PATH/Run ${rvc_install_path_root}
+echo copy Run package completely!
+
+#copy the res pkg to rvc path
+echo to copy rvc Audio files...
+if [ ! -d $rvc_install_path_rvc_dir ]; then
+    sudo mkdir -p ${rvc_install_path_rvc_dir}
+fi
+if [ ! -d $rvc_install_path_rvc_dir/addata ]; then
+    sudo mkdir -p ${rvc_install_path_rvc_dir}/addata
+fi
+sudo cp -rvf $MY_PATH/Data/Audio ${rvc_install_path_rvc_dir}/addata
+echo copy rvc Audio files completely!
+sudo cp -rvf $MY_PATH/Data/Video ${rvc_install_path_rvc_dir}/addata
+echo copy rvc Video files completely!
+
+echo change the run scripts priviledge...
+echo ${rvc_install_path_rvc_dir}
+echo ${rvc_install_path_root}/${rel_version_dir}
+sudo chmod 777 ${rvc_install_path_root}
+sudo chmod a+rw -R ${rvc_install_path_rvc_dir}
+sudo chmod a+rw -R ${rvc_install_path_hardware_dir}
+sudo chmod 777 -R ${rvc_install_path_root}/${rel_version_dir}
+sudo chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh
+sudo chmod 777 ${rvc_install_path_versions_dir}/sudo_spexplorer.sh
+echo change the run scripts priviledge done!
+
+if [ $has_vendor -eq 1 ];then
+    root_file=$rvc_install_path_hardware_dir/root.ini
+    root_vendor_file=$rvc_install_path_hardware_dir/root.ini.$tolower_vendor
+    if [ -f $root_vendor_file -a ! -f $root_files ] #  ! -f $root_file -a 
+    then
+        echo "重命名 root.ini "
+        sudo cp $root_vendor_file $root_file
+    fi
+fi
+
+echo "[RVCTermianal] === Install Done ! === "
+
+exit 0