-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.sh
53 lines (53 loc) · 2.36 KB
/
installer.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
#Do not run this! It's not up to date, and probably won't work as of now. We'll update the installer later on once the program is at a more finished state.
echo "This is the installer for samsi. It will install the samsi webapp to this installers current location. Are you sure you wish to continue? y/n"
read user_input
if !["$user_input" == "y"]; then
echo "Exiting"
exit 3
fi
echo "Selected yes"
echo "Finding script path"
script_dir=$( cd "$( dirname "$0" )" && pwd )
echo "Script path found at" $script_dir
echo "Trying to create Data folder"
if [ ! -d $script_dir/Data ]; then
mkdir $script_dir/Data
else
echo "An instance of samsi already exists, would you like to overwrite it or exit? y/n"
read user_input
if !["$user_input" == "y"]; then
echo "Exiting"
exit 3
else
echo "skipping"
fi
fi
echo "Data folder created"
echo "Attempting to create pages directory"
if [ ! -d $script_dir/Pages ]; then
mkdir $script_dir/Pages
else
echo "Pages directory already exists, skipping"
fi
echo "Attempting to create templates directory"
if [ ! -d $script_dir/Templates ]; then
mkdir $script_dir/Templates
else
echo "Templates directory already exists, skipping"
fi
echo "Attempting to write location to text file for later use"
echo "$script_dir" > $script_dir/Data/location.txt
echo "Writen directory location to text file"
echo "Attempting to download index.php form GitHub"
curl --get https://raw.githubusercontent.com/DNAmaster10/SAMSI/main/index.php > /var/www/html/index.php
if [ ! -f $script_dir/index.php ]; then
echo "Could not establish a connection with github"
exit 3
fi
curl --get https://raw.githubusercontent.com/DNAmaster10/SAMSI/main/adminPanelTemplate.txt > /var/www/html/Templates/adminPanelTemplate.txt
curl --get https://raw.githubusercontent.com/DNAmaster10/SAMSI/main/register.php > /var/www/html/Pages/register.php
curl --get https://raw.githubusercontent.com/DNAmaster10/SAMSI/main/schoolRegComplete.php > /var/www/html/Pages/schoolRegComplete.php
curl --get https://raw.githubusercontent.com/DNAmaster10/SAMSI/main/login.php > /var/www/html/Pages/login.php
curl --get https://raw.githubusercontent.com/DNAmaster10/SAMSI/main/checkSchool.php > /var/www/html/Pages/checkSchool.php
curl --get https://raw.githubusercontent.com/DNAmaster10/SAMSI/main/logged_in.txt > /var/www/html/Templates
echo "Found index page"