-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCRIPT-1a-check-setup
executable file
·74 lines (66 loc) · 2.48 KB
/
SCRIPT-1a-check-setup
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# ----------------------------------------------------------------------
# This script is intended to be "sourced" by other scripts
# (although it can be run stand-alone).
#
# This script:
# Checks that the one-time "setup"
# for this term and course has been completed successfully.
#
# It relies upon the data in:
# SET_CONSTANTS
#
# which in turn relies upon the data in:
# SET_TERM_AND_COURSE
#
# Author: David Mutchler.
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Get the values of the variables:
# course e.g. csse120
# term e.g. 202030
# data_folder e.g. DATA/DATA-csse120-202030
# data_subfolders e.g. ( DATA DATA-csse120-202030 )
# repos_folder e.g. REPOS/REPOS-csse120-202030
# repos_subfolders e.g. ( REPOS REPOS-csse120-202030 )
# repo_prefix e.g. csse120-202030-
# gitter_ssh e.g.
# gitter_repos_folder e.g. /srv/repos
#
# from the relevant files.
# ----------------------------------------------------------------------
if [ "${SET_CONSTANTS_HAS_RUN}" != "1" ]; then
source SET_CONSTANTS
fi
# ---------------------------------------------------------------------
# Confirm that the REPOS subfolder exists. Exit with a warning if not.
# ---------------------------------------------------------------------
if [ ! -d "${repos_folder}" ]; then
echo ""
echo "ERROR: The course and term are:"
echo " Course: ${course}"
echo " Term: ${term}"
echo "but there is no corresponding REPOS subfolder"
echo " Subfolder: ${repos_folder}"
echo "Figure out what is wrong and re-run this script."
echo "Nothing done."
echo ""
exit 1
fi
# ---------------------------------------------------------------------
# Confirm that the DATA subfolder exists. Exit with a warning if not.
# ---------------------------------------------------------------------
if [ ! -d "${data_folder}" ]; then
echo ""
echo "ERROR: The course and term are:"
echo " Course: ${course}"
echo " Term: ${term}"
echo "but there is no corresponding DATA subfolder"
echo " Subfolder: ${data_folder}"
echo "Figure out what is wrong and re-run this script."
echo "Nothing done."
echo ""
exit 1
fi
CHECK_SETUP_HAS_RUN=1 # For use in scripts "sourcing" this script.