ยง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
#!/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"