Browse Source

add some basic tasks

master
belliash 7 years ago
parent
commit
2de9a4ab23
1 changed files with 58 additions and 1 deletions
  1. 58
    1
      ezbuild

+ 58
- 1
ezbuild View File

@@ -17,8 +17,65 @@ loadConfiguration
17 17
 
18 18
 # Print EzBuild notice and parse arguments
19 19
 printNotice
20
+until [[ -z "${1}" ]]; do
21
+	case "${1}" in
22
+		-c|--cleanlog)
23
+			EZOPT_CLEANLOG=true
24
+			;;
25
+		-h|--help)
26
+			showEzbuildUsage
27
+			;;
28
+		-l|--listmods)
29
+			listModules
30
+			;;
31
+		-p|--purge)
32
+			EZOPT_PURGETMP=true
33
+			;;
34
+		-P|--purgeonly)
35
+			EZOPT_PURGETMP=true
36
+			EZOPT_PURGEONLY=true
37
+			;;
38
+		-s|--syscheck)
39
+			EZOPT_SYSCHECKONLY=true
40
+			;;
41
+		*)
42
+			die "Unrecognized option ${1}"
43
+			;;
44
+	esac
45
+	shift
46
+done
20 47
 
21 48
 # Check system requirements
22 49
 printInfo "Checking system prerequisites..."
23 50
 checkPrerequisites
24
-[ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements"
51
+[ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements!" 1
52
+if isEnabled ${EZOPT_SYSCHECKONLY}; then
53
+	printInfo "Your system meets all EzBuild requirements!"
54
+	quit
55
+fi
56
+
57
+# Do not allow more than one working copy
58
+PID=$(pidof -s -o '%PPID' -x ${EZNAME})
59
+if [ ${PID} ]; then
60
+	printWarn "The ${EZNAME} is already working with PID: ${PID}"
61
+	printWarn "You cannot have more than one instancy running"
62
+	exit 0
63
+fi
64
+
65
+# Optionally purge whole temp directory or log file only
66
+if isEnabled ${EZOPT_PURGETMP}; then
67
+	printInfo "Clearing temp directory..."
68
+	cleanTemp
69
+	if isEnabled ${EZOPT_PURGEONLY}; then
70
+		quit
71
+	fi
72
+elif isEnabled ${EZOPT_CLEANLOG}; then
73
+	printInfo "Clearing log file..."
74
+	cleanLog
75
+fi
76
+
77
+# Initialize EzBuild environment
78
+makeCoreDirectories || die "EzBuild was unable to create all necessary directories!" 1
79
+EZNOTIFY="yes"
80
+export LC_ALL="C"
81
+trap 'die "Process killed! This may lead into unexpected problems!"' 1 2 3 9 15 17 18 23

Loading…
Cancel
Save