-
Notifications
You must be signed in to change notification settings - Fork 1
/
develop.sh
executable file
·56 lines (47 loc) · 1.72 KB
/
develop.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Helper Shell Script
# Author: Rick Timmis <[email protected]>
#
# The purpose of this script is to make it as simple as possible for new kubuntu
# contributors, to get a development instance of kubuntu.org up and working
# so that they can develop new content, and maintain the site with ease
# For usage with Development IDE Configurations (i.e JetBrains or VSCode)
# the script can be called with a --stop switch
for ARG in "$@"
do
if [ "$ARG" = "--stop" ]; then
echo "Stopping kubuntu.org development services..."
# Add your stop behavior here
pkill -HUP hugo
pkill -HUP firefox
# You can use `exit` or `break` depending on your script structure
# If you want to stop the script execution if --stop is found, use `exit`
# If you want to just stop the loop and continue with the script, use `break`
exit
fi
done
# Check if the hugo static site builder is available and install it from the snap store
# if it isn't then install it
if ! command -v hugo &> /dev/null
then
echo "Hugo is not installed. Installing via Snap..."
sudo snap install hugo
else
echo "Starting kubuntu.org development services..."
fi
# The Hugo Server command reloads the site upon any change, but to help avoid
# any parallel runs of collisions. We check if it is runing from a previous session
# and stop it if required.
# We loop and wait here, to enable Hugo to clean up
while pgrep hugo > /dev/null
do
echo "Hugo is running. Sending HUP signal..."
pkill -HUP hugo
sleep 5
done
# Start the Hugo development server
#hugo server --disableFastRender &
hugo server &
# Launch the site in the browser
firefox --new-window http://localhost:1313 &>/dev/null &
exit 0