2022-10-06 07:05:46 -05:00
|
|
|
#!/bin/bash
|
|
|
|
# 2022-09-14 Hyperling
|
|
|
|
# Ensure dependencies are met and start the webserver.
|
|
|
|
|
2022-10-08 09:19:40 -05:00
|
|
|
# Ensure we are executing from this file's directory.
|
|
|
|
cd `dirname $0`
|
|
|
|
|
2022-10-06 07:05:46 -05:00
|
|
|
### Can docker-compose do this rather than running a sh file on the host OS?
|
|
|
|
# Look at Dockerfile-ADD for doing git clones into a docker environment.
|
2022-10-08 09:19:40 -05:00
|
|
|
# Out of scope for this project, this project is just the site, leave for now.
|
2022-10-06 07:12:28 -05:00
|
|
|
if [[ ! `which php` || ! `which node`|| ! `which npm` ]]; then
|
|
|
|
sudo apt install -y php-fpm nodejs npm
|
2022-10-06 07:05:46 -05:00
|
|
|
fi
|
|
|
|
|
2022-10-08 09:19:40 -05:00
|
|
|
# Fix any file permissions
|
|
|
|
# Directories and allowed page types are executable, others are not.
|
|
|
|
find ./pages/ | while read file; do
|
|
|
|
if [[ $file == *".php" || $file == *".sh" || -d $file ]]; then
|
|
|
|
mode=755
|
|
|
|
else
|
|
|
|
mode=644
|
|
|
|
fi
|
|
|
|
chmod -c $mode $file
|
|
|
|
done
|
|
|
|
|
2022-10-06 07:05:46 -05:00
|
|
|
npm install
|
|
|
|
|
2022-10-06 07:12:28 -05:00
|
|
|
./main.js
|
2022-10-06 07:05:46 -05:00
|
|
|
###
|
|
|
|
|
|
|
|
exit 0
|