#!/bin/bash TARGET_PATH="/var/www/crm" GIT_PATH="/var/www/matsen-git-repository/matsen-tool-fe/matsen-tool" create_directories() { # Erstelle notwendige Verzeichnisse falls sie nicht existieren mkdir -p ${TARGET_PATH}/angular } copy_files() { cd ${GIT_PATH} sudo GIT_SSH_COMMAND="ssh -i /home/service-spawntree/.ssh/id_rsa -p 1122" git pull echo "$(tput setab 2)matsen fe has been PULLED$(tput sgr 0)" # Erstelle zuerst alle notwendigen Verzeichnisse create_directories cd ${TARGET_PATH}/angular # Alles außer node_modules löschen find . -maxdepth 1 ! -name 'node_modules' ! -name '.' -exec rm -rf {} + echo "$(tput setab 2)Client update$(tput sgr 0)" cp -r ${GIT_PATH}/* ${TARGET_PATH}/angular echo "$(tput setab 2)Files have been copied$(tput sgr 0)" } copy_files npm install npx ng build --configuration production cp -r ${TARGET_PATH}/angular/dist/* ${TARGET_PATH} cp -r ${GIT_PATH}/.htaccess ${TARGET_PATH}/matsen-tool/browser echo "You have updated matsen client!$(tput sgr 0)"