#!/bin/sh

INSTALL_PATH=/opt/kros-gate
LOG_PATH=/var/log/kros-gate
MODULE_NAME=kros-gate

sudo mkdir $INSTALL_PATH
sudo mkdir $INSTALL_PATH/conf
sudo mkdir $INSTALL_PATH/logs
#sudo mkdir $INSTALL_PATH/lib
sudo mkdir $LOG_PATH
sudo cp $MODULE_NAME.jar $INSTALL_PATH
#sudo cp *.key $INSTALL_PATH
#sudo cp lib/* $INSTALL_PATH/lib
sudo cp conf/* $INSTALL_PATH/conf
sudo cp $MODULE_NAME.sh /etc/init.d/$MODULE_NAME
echo "server.log.path=$LOG_PATH" | sudo tee -a $INSTALL_PATH/conf/kros.properties
sudo chmod +x /etc/init.d/$MODULE_NAME
sudo update-rc.d $MODULE_NAME defaults
sudo /etc/init.d/$MODULE_NAME restart
