Files
resty_functions/cp_scripts_local_macos.sh
T

39 lines
1.3 KiB
Bash
Raw Normal View History

2022-02-03 20:17:56 +08:00
#!/bin/sh
set -x
# Openresty config
2022-02-03 20:17:56 +08:00
# -- Get openresty config path
openresty_config_file_path=$(openresty -t 2>&1 | tr '\n' '\f' | sed -r 's/.*file[[:space:]](.*)[[:space:]]syntax.*/\1/')
openresty_config_path=${openresty_config_file_path%/*}
openresty_sub_config_dir=$openresty_config_path/conf.d
echo $openresty_sub_config_dir
2022-02-03 20:17:56 +08:00
# -- Make sub config dir
mkdir -p $openresty_sub_config_dir
# -- Copy sun config file
cp conf/local_macos/*.conf $openresty_sub_config_dir
# Lua scripts
# -- Get openresty install path
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
2022-02-08 13:57:15 +08:00
# -- Make scripts dir
mkdir -p $openresty_lua_scripts_dir
2022-02-08 13:57:15 +08:00
# -- Copy scripts file
cp scripts/*.lua $openresty_lua_scripts_dir
2022-02-08 13:57:15 +08:00
# -- Replace scripts path in file
replaced_scripts_path=$(echo $openresty_lua_scripts_dir | sed 's_/_\\/_g')
echo "$replaced_scripts_path"
2022-02-08 14:14:57 +08:00
sed -i -e "s/<SCRIPT_PATH>/$replaced_scripts_path/" \
2022-02-08 13:57:15 +08:00
"$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
openresty -s reload