forked from iiab/iiab-admin-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·64 lines (50 loc) · 1.55 KB
/
install
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
#!/bin/bash -e
if [ -f /etc/iiab/iiab.env ]
then
. /etc/iiab/iiab.env
else
echo "IIAB Config not found."
echo "Please install Internet in a Box before installing the Admin Console."
echo "Exiting."
exit
fi
PLAYBOOK="iiab-admin.yml"
INVENTORY="ansible_hosts"
IIAB_ADMIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ ! -f $IIAB_ADMIN_DIR/$PLAYBOOK ]; then
echo "Admin Console Playbook not found."
echo "Please make sure you have cloned the iiab-admin git repo."
echo "Exiting."
exit
fi
cd $IIAB_ADMIN_DIR
# facts file for admin console, assumes iiab created directory
cp ./scripts/admin_facts.fact /etc/ansible/facts.d/admin_facts.fact
echo "Running local playbooks! "
# ARGS="--extra-vars '{\"target_base\":\"$IIAB_DIR\"}'"
#ARGS="target_base=$IIAB_DIR"
export ANSIBLE_LOG_PATH="$IIAB_ADMIN_DIR/admin-install.log"
#ansible-playbook -i $INVENTORY $PLAYBOOK --extra-vars "${ARGS}" --connection=local
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local
# Start CMDSRV
echo "(Re)Starting CMDSRV"
systemctl enable iiab-cmdsrv
systemctl restart iiab-cmdsrv
if [[ "$1" == "-n" ]]; then
echo "WARNING: THIS CAN CAUSE PROBLEMS"
echo "Only do this if a full install has already completed"
echo "Skipping data setup"
else
# Run various utilites to setup initial data
echo "Downloading Catalogs and Building Local Data Files."
iiab-get-kiwix-cat -v
iiab-get-oer2go-cat
if [ -f /usr/bin/iiab-make-kiwix-lib ]
then
iiab-make-kiwix-lib
fi
iiab-update-menus
fi
# Restart CMDSRV
echo "(Restarting CMDSRV"
systemctl restart iiab-cmdsrv