auto replace lua script path

This commit is contained in:
liyong
2022-02-08 13:57:15 +08:00
committed by XiaoLi
parent ebc73eed8d
commit 022679a784
7 changed files with 42 additions and 10 deletions
+10 -2
View File
@@ -21,10 +21,18 @@ cp conf/local_macos/*.conf $openresty_sub_config_dir
openresty_install_path=$(openresty -V 2>&1 | tr '\n' '\f' | sed -r 's/.*--prefix=(.*)[[:space:]]--with-cc.*/\1/')
openresty_lua_scripts_dir=$openresty_install_path/scripts
echo $openresty_lua_scripts_dir
# -- Make scripts dir
mkdir -p $openresty_lua_scripts_dir
# -- Copy scripts file
cp scripts/*.lua $openresty_lua_scripts_dir
# -- Replace scripts path in file
replaced_scripts_path=$(echo $openresty_lua_scripts_dir | sed 's_/_\\/_g')
echo "$replaced_scripts_path"
sed -i -e "s/\$script_path/$replaced_scripts_path/" \
"$openresty_lua_scripts_dir"/combine.lua \
"$openresty_lua_scripts_dir"/convert_audio.lua \
"$openresty_lua_scripts_dir"/test_upyun_upload.lua \
"$openresty_lua_scripts_dir"/upyun_upload.lua
# Reload openresty
openresty -t