update source variables

This commit is contained in:
root 2025-05-14 14:54:29 +07:00
parent 7d3f9b28d9
commit 8d732a72e9
3 changed files with 23 additions and 4 deletions

View File

@ -38,11 +38,11 @@ if [ -d "/etc/systemd/system" ]; then
sudo sed -i "s#NPM_BIN=.*#NPM_BIN=$NPM_BIN#" $pwd_install/service_run/giteaService.conf && sudo sed -i "s#NPM_BIN=.*#NPM_BIN=$NPM_BIN#" $pwd_install/service_run/giteaService.conf &&
echo -e "* \e[32mNPM_BIN\e[0m *" && echo -e "* \e[32mNPM_BIN\e[0m *" &&
sudo sed -i "s#source .*#source $escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaHook.sh && sudo sed -i "s#source=.*#source=$escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaHook.sh &&
echo -e "* \e[32mEXEC_FILE\e[0m *" && echo -e "* \e[32mEXEC_FILE\e[0m *" &&
echo "" echo ""
sudo sed -i "s#source .*#source $escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaService.sh && sudo sed -i "s#source=.*#source=$escaped_pwd_install/service_run/giteaService.conf#" $pwd_install/service_run/giteaService.sh &&
systemctl stop giteaHook.service systemctl stop giteaHook.service

View File

@ -1,7 +1,16 @@
#!/bin/bash #!/bin/bash
#File chua bien moi truong #File chua bien moi truong
source /home/joseph/tr2/gitea_CICD/service_run/giteaService.conf source=/home/joseph/tr2/gitea_CICD/service_run/giteaService.conf
while read -r line; do
[[ -z "$line" || "$line" =~ ^# ]] && continue
if [[ "$line" =~ ^[A-Za-z_][A-Za-z0-9_]*= ]]; then
varname="${line%%=*}"
varvalue="${line#*=}"
export "$varname=$varvalue"
fi
done < $source
check="false" check="false"

View File

@ -1,7 +1,17 @@
#!/bin/bash #!/bin/bash
set -e # Dừng script nếu có lỗi set -e # Dừng script nếu có lỗi
source /home/phuc/gitea_CICD/service_run/giteaService.conf source=/home/joseph/tr2/gitea_CICD/service_run/giteaService.conf
while read -r line; do
[[ -z "$line" || "$line" =~ ^# ]] && continue
if [[ "$line" =~ ^[A-Za-z_][A-Za-z0-9_]*= ]]; then
varname="${line%%=*}"
varvalue="${line#*=}"
export "$varname=$varvalue"
fi
done < $source
export HOME=$PROJECT_PATH export HOME=$PROJECT_PATH
indexjs_path="$HOOK_PATH/index.js" indexjs_path="$HOOK_PATH/index.js"