#!/bin/bash # Rocky9 not compatible yet, because GUI gems should be updated . /usr/src/m2/framework/bash_functions.sh . /usr/src/m2/framework/settings.sh VERSION="1.1.6" SCRIPT_NAME="GUI Install" k_start k_detect_os k_config_details source "/etc/profile.d/rvm.sh" report "GUI installation starting" 3 # Same stable rev for /home/m2, /home/m4 and /usr/src/m2 DB/scripts stable_rev=$(cat /usr/src/m2/gui/stable_revision) report "Downloading GUI files..." 3 if ! svn co -r "$stable_rev" http://svn.kolmisoft.com/"$SYSTEM_GUI_DIR"/gui/trunk "/home/$SYSTEM_GUI_DIR" > /dev/null 2>&1; then report "svn checkout exit with errors" 1 report "svn command used" 3 report "svn co -r $stable_rev http://svn.kolmisoft.com/$SYSTEM_GUI_DIR/gui/trunk /home/$SYSTEM_GUI_DIR" 3 EXIT_CODE=1 fi # ln -s /home/m2/public /var/www/html/billing # apache is not installed yet source "/etc/profile.d/rvm.sh" if [[ $centos_version == 7 ]]; then gem install bundler -v 1.12.5 rvm use 2.2.2 cd "/home/$SYSTEM_GUI_DIR" bundle config build.nokogiri --use-system-libraries bundle update elif [[ $ROCKY9 == 1 ]]; then #rvm get stable --auto-dotfiles # to avoid Warning! PATH is not properly set up, not sure it helps, does not help :( rvm use ruby-3.2.2 gem install bundler rvm use 3.2.2 date # cp -fr /usr/src/m2/gui/r9_tmp/Gemfile /home/m2/ # fake Gemfile just for testing cd "/home/$SYSTEM_GUI_DIR" bundle config build.nokogiri --use-system-libraries bundle update date fi cp -fr /usr/src/m2/gui/gui_config_files/environment.rb "/home/$SYSTEM_GUI_DIR/config" cp -fr /usr/src/m2/gui/gui_config_files/database.yml "/home/$SYSTEM_GUI_DIR/config" if [[ $SYSTEM_GUI_DIR == "m4" ]]; then sed -i 's#/home/m2#/home/m4#' /home/m4/config/environment.rb fi if [ ! -f "/home/$SYSTEM_GUI_DIR/public/invoice_templates/default.xlsx" ]; then cp -f /usr/src/m2/gui/gui_config_files/default.xlsx "/home/$SYSTEM_GUI_DIR/public/invoice_templates/" report "Default template default.xlsx copied to /home/$SYSTEM_GUI_DIR/public/invoice_templates/ directory" 0 else report "Default template default.xlsx already exists in /home/$SYSTEM_GUI_DIR/public/invoice_templates/ directory" 0 fi mkdir -p /var/log/m2 touch /var/log/m2/gui_debug.log check_and_fix_permission /var/log/m2/gui_debug.log 0666 report touch /var/log/m2/gui_crash.log check_and_fix_permission /var/log/m2/gui_crash.log 0666 report mkdir -p "/home/$SYSTEM_GUI_DIR/log" touch "/home/$SYSTEM_GUI_DIR/log/production.log" check_and_fix_permission "/home/$SYSTEM_GUI_DIR/log/production.log" 0666 report touch "/home/$SYSTEM_GUI_DIR/log/development.log" check_and_fix_permission "/home/$SYSTEM_GUI_DIR/log/development.log" 0666 report mkdir -p /home/"$SYSTEM_GUI_DIR"/tmp check_and_fix_permission "/home/$SYSTEM_GUI_DIR/tmp" 0777 report chmod 777 -R "/home/$SYSTEM_GUI_DIR/public/images/logo" chmod 777 -R /tmp/m2 chmod 1777 -R "/home/$SYSTEM_GUI_DIR/public/invoice_templates" chmod 777 -R "/home/$SYSTEM_GUI_DIR/public/rate_notification_templates" # /etc/init.d/httpd restart # apache not installed yet # install cronjobs k_config_details if [[ $GUI_PRESENT == "1" ]]; then report "Installing GUI cronjobs" 3 for cron_file in /usr/src/m2/gui/cronjobs/*; do cp -f "$cron_file" /etc/cron.d chmod 0644 "/etc/cron.d/$(basename "$cron_file")" done k_service_restart crond fi report "GUI installation complete" 0 k_exit $EXIT_CODE