1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #!/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
- # check root priviledge
- if [ $(id -u) != 0 ]; then
- echo "[ERROR] === 该安装脚本需要以ROOT权限启动,请在命令行窗口添加sudo指令执行 'sudo bash $0',如果无法执行相关指令,请先确认系统已开启开发者模式 ==="
- exit 0
- fi
- argument1=
- if [ $# -eq 1 ];then
- echo has arguments: $*
- argument1=$(echo $1 | awk '{ print tolower($0) }' )
- else
- echo no any arguments.
- fi
- if [ "$argument1" = "pure" ]; then
- killall -9 spshell > /dev/null 2>&1
- killall -9 sphost > /dev/null 2>&1
- killall -9 guardian > /dev/null 2>&1
- killall -9 uosbrowser > /dev/null 2>&1
- killall -9 browser > /dev/null 2>&1
- killall -s 9 `ps -aux | grep browser | awk '{print $2}'` > /dev/null 2>&1
- 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...
- if [ ! -d $rvc_install_path_Run_dir ]; then
- sudo mkdir -p ${$rvc_install_path_Run_dir}
- fi
- 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/rvc/adData/Audio ${rvc_install_path_rvc_dir}/adData
- echo copy rvc Audio files completely!
- #sudo cp -rvf $MY_PATH/rvc/adData/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
- sudo chmod a+rw ${rvc_install_path_versions_dir}/active.txt
- echo change the run scripts priviledge done!
- echo "[RVCTermianal] === Install Done ! === "
- echo "[RVCTermianal] === 所有步骤执行成功,正常退出=== "
- exit 0
|