代码拉取完成,页面将自动刷新
#!/bin/bash
# check if the script is run from script directory
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
if [[ "$DIR" != "$PWD" ]]; then
echo "You must run this script from $DIR"
exit 1
fi
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Choose the config method (venv or docker)
answer_config=""
echo "choose your installation"
while [[ "$answer_config" == "" ]]; do
read -p "1: venv, 2: docker : " answer_config
case $answer_config in
"1")
#remove logs file if exist (to avoid appending)
if [ -f logs_install.txt ]; then
rm logs_install.txt
fi
#execute the install_venv.sh script and output error in logs file
source install_venv.sh 2>&1 | tee -a logs_install.txt 1>&2 | { while IFS= read -r line; do echo "$line"; done; }
;;
"2")
#remove logs file if exist (to avoid appending)
if [ -f logs_docker.txt ]; then
rm logs_docker.txt
fi
source install_docker.sh 2>&1 | tee -a logs_docker.txt 1>&2 | { while IFS= read -r line; do echo "$line"; done; }
;;
*)
echo "choose a valid configuration"
answer_config=""
;;
esac
#statements
done
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。