-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·58 lines (51 loc) · 2.22 KB
/
install.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
57
58
#!/bin/sh
clear
echo ' _ _ _ '
echo '| | | | | | '
echo '| |__| |_ _ __| | ___ '
echo '| __ | | | |/ _` |/ _ \ '
echo '| | | | |_| | (_| | __/ '
echo '|_| |_|\__ |\____|\___| '
echo ' __/ | '
echo ' |___/ '
echo "This script will attempt to set up permissions and generate a configuration file for Hastie."
echo "Please ensure you have already installed Jekyll and set up at least one project."
echo -n "Press any key to continue..."
read ANSWER
# Config generator
touch includes/config.php
echo "<?php" > includes/config.php
echo ""
read -p "Enter the absolute path for your _posts (/var/www/yoursite/_posts): " postsdir
if [ -d "$postsdir" ]; then
sudo chown -R www-data:www-data $postsdir && echo "Success! Permissions updated for posts directory."
else
echo "Setting permissions failed: The _posts directory $postsdir does not exist. See README for information."
fi
echo "\$postsDirectory = \"$postsdir\";" >> ./includes/config.php
echo ""
read -p "Enter the absolute path for your Hastie installation (/var/www/yoursite/hyde): " hydedir
if [ -d "$hydedir" ]; then
sudo chown -R www-data:www-data $hydedir && echo "Success! Ownership of Hastie directory updated."
sudo chmod -R 664 $hydedir && echo "Success! Permissions updated for Hastie directory."
else
echo "Setting permissions failed: The Hastie directory $hydedir does not exist. See README for information."
fi
echo "\$backendurl = \"$hydedir\";" >> ./includes/config.php
echo ""
read -p "Enter the absolute path of your Jekyll source. (/var/www/yoursite): " sourcepath
echo "\$sourcedir = \"$sourcepath\";" >> ./includes/config.php
echo ""
read -p "Enter the absolute path for jekyll to build into. (/var/www/yoursite/_site): " targetdir
echo "\$webroot = \"$targetdir\";" >> ./includes/config.php
echo ""
read -p "Your website's URL (including http://): " siteurl
echo "\$siteurl = \"$siteurl\";" >> ./includes/config.php
echo ""
read -p "Your website's name : " websitename
echo "\$sitename = \"$websitename\";" >> ./includes/config.php
echo ""
read -p "Backend Title (Default: Hastie): " customtitle
: ${customtitle:=Hastie}
echo "\$hydetitle = \"$customtitle\";" >> ./includes/config.php
exit 0