提交 263b742f 编写于 作者: Z zhengmz-aliyun

zerotier: fix bug

1. fix config_path: create and persist
2. fix secret: support identity.secret
3. fix stop_instance: remove existing networks
上级 fa96401f
......@@ -35,9 +35,10 @@ start_instance() {
# Create link or copy files from CONFIG_PATH to config_path
if [ -n "$config_path" -a "$config_path" != "$path" ]; then
# Create the config path to init and persist
if [ ! -d "$config_path" ]; then
echo "ZeroTier config_path does not exist: $config_path" 1>&2
return
echo "ZeroTier config_path does not exist: $config_path, create..."
mkdir -p $config_path
fi
# ensure that the target exists
......@@ -60,7 +61,7 @@ start_instance() {
args="$args -p${port}"
fi
if [ -z "$secret" ]; then
if [ -z "$secret" -a ! -f $path/identity.secret ]; then
echo "Generate secret - please wait..."
local sf="/tmp/zt.$cfg.secret"
......@@ -106,6 +107,9 @@ start_service() {
stop_instance() {
local cfg="$1"
# Remove existing networks
rm -f ${CONFIG_PATH}_${cfg}/networks.d/*.conf
# Remove existing link or folder
rm -rf ${CONFIG_PATH}_${cfg}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册