heroweb/svelte/run.sh

49 lines
1.3 KiB
Bash
Raw Normal View History

2024-09-02 08:00:49 +00:00
#!/bin/bash
set -e
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd ${BASE_DIR}
# Check if node_modules exists, if not, install the package
if [ ! -d "node_modules" ]; then
npm config set @wx:registry https://npm.svar.dev
npm install @wx/trial-svelte-filemanager
fi
#install hero if not done yet
if ! command -v hero &> /dev/null; then
curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/install_hero.sh > /tmp/hero_install.sh
bash /tmp/hero_install.sh
fi
hero git clone -u https://github.com/svar-widgets/filemanager-backend-go
pushd ${HOME}/code/github/svar-widgets/filemanager-backend-go
# Check if filemanager-go exists, if not, build it
if [ ! -f "filemanager-go" ]; then
go build
fi
function manage_filemanager {
set +ex
pkill -f filemanager-go &> /dev/null
screen -S filemanager -X quit &> /dev/null
set -e
screen -S filemanager -dm bash -c "${HOME}/code/github/svar-widgets/filemanager-backend-go/filemanager-go"
sleep 0.5
nc -zv localhost 3200
if [ $? -eq 0 ]; then
echo "Filemanager on port 3200 is running."
else
echo "Error: Filemanager port 3200 is not accessible."
fi
#screen -r filemanager
}
manage_filemanager
popd &> /dev/null