-
Notifications
You must be signed in to change notification settings - Fork 3
/
detector-main.sh
56 lines (48 loc) · 1006 Bytes
/
detector-main.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
#Execute all Scripts in path
#run-parts /opt/detector/rulesets
#https://queirozf.com/entries/sed-examples-search-and-replace-on-linux
detect_linux(){
central="/opt/detector/rulesets/central/*.sh"
privacy="/opt/detector/rulesets/privacy/*.sh"
ARRAY1=()
ARRAY1+=("$central")
ARRAY2=()
ARRAY2+=("$privacy")
#Don't keep adding to the log, by uncommenting the following echo, make sure to use other tools to extract logs in time
#echo "---" > /var/log/detector.log
for file in $ARRAY1 $ARRAY2
do
bash "$file"
done
}
detector_main(){
OS="`uname`"
case $OS in
'Linux')
detect_linux;;
esac
}
detector_main
#Check OS-TYPE
# https://megamorf.gitlab.io/2021/05/08/detect-operating-system-in-shell-script/
# Detect the platform (similar to $OSTYPE)
# alias ls='ls --color=auto'
# ;;
# 'FreeBSD')
# OS='FreeBSD'
# alias ls='ls -G'
# ;;
# 'WindowsNT')
# OS='Windows'
# ;;
# 'Darwin')
# OS='Mac'
# ;;
# 'SunOS')
# OS='Solaris'
# ;;
# 'AIX') ;;
# *) ;;
#esac
#