-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup.sh
executable file
·61 lines (53 loc) · 1.68 KB
/
startup.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
59
60
61
#! /usr/bin/env bash
cfg=/playbook/roles/common/vars/main.yml
# Convert configuration from TOML to YAML
if [ -f /etc/sit-inbox/config.toml ]; then
echo "Reading config /etc/sit-inbox.toml"
mkdir -p $(dirname $cfg)
toml2yaml /etc/sit-inbox/config.toml > "$cfg"
else
echo /etc/sit-inbox/config.toml not found, aborting
exit 1
fi
json=config.json
yaml2json /schema.yaml > /schema.json
yaml2json ${cfg} > ${json}
ajv compile -s /schema.json || exit 1
ajv validate -s /schema.json -d ${json} || exit 1
rm ${json}
cols=$(tput cols)
lines=$(tput lines)
ANSIBLE_STDOUT_CALLBACK=unixy ansible-playbook -l 127.0.0.1 /playbook/playbook.yml || exit 1
syslogd
crond -b
while true; do
cols=$(tput cols)
lines=$(tput lines)
result=$(dialog --keep-window \
--begin 0 $(expr ${cols} / 4) --tailboxbg /var/log/messages ${lines} $(expr ${cols} \* 3 / 4)\
--and-widget --keep-tite --keep-window \
--begin 0 0 --no-shadow --menu "Action" 11 $(expr ${cols} / 4) 11 \
"M" "Check mail" \
"R" "Reload configuration" \
"S" "Shell" \
"Q" "Quit" \
--output-fd 1)
case "${result}" in
Q)
clear
exit 0
;;
R)
clear
exec startup
;;
M)
check-email &
;;
S)
bash
;;
*) echo
;;
esac
done