ยง2024-11-01
# ---function hook_script {---------------------------------------------
function hook_script {
echo "#!/bin/bash
git --git-dir=/var/opt/$1.git --work-tree=\"/opt/$1\" checkout "\$3" -f
cd \"/opt/$1\"
rm -rf package-lock.json
npm install --production --no-optional --no-package-lock --no-audit --ignore-scripts --no-shrinkwrap --progress=false
sudo $SYSTEMCTL_PATH restart $1 || echo \"Failed restarting service\"" > "/var/opt/$1.git/hooks/update"
chmod +x "/var/opt/$1.git/hooks/update"
}
export -f hook_script
-
called from
07_install_wildduck.sh
# fresh install cd /var/opt git clone --bare https://github.com/nodemailer/wildduck.git # create update hook so we can later deploy to this location hook_script wildduck
-
/var/opt/wildduck.git/hooks/update
#!/bin/bash
git --git-dir=/var/opt/wildduck.git --work-tree="/opt/wildduck" checkout $3 -f
cd "/opt/wildduck"
rm -rf package-lock.json
npm install --production --no-optional --no-package-lock --no-audit --ignore-scripts --no-shrinkwrap --progress=false
sudo /usr/bin/systemctl restart wildduck || echo "Failed restarting service"