Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 58 lines (48 sloc) 2.071 kB
1d99531 @lofi42 Version 0.2.0
authored
1 #!/bin/sh
2
3 ####################################################
4 #
6e1fc04 @lofi42 Version 0.2.2
authored
5 # Install Script for matomat Version 0.2.2
1d99531 @lofi42 Version 0.2.0
authored
6 #
7 ####################################################
8
9 CFG_DIR=/etc/
10 DATA_DIR=/var/
11 BIN_DIR=/usr/local/bin/
c55823b @lofi42 Version 0.2.2
authored
12 LIB_DIR=/usr/lib/perl5/site_perl
1d99531 @lofi42 Version 0.2.0
authored
13
14 if [ "$(id -u)" != "0" ]; then
15 echo "This script must be run as root" 1>&2
16 exit 1
17 fi
18
19 if [ -f "$CFG_DIR/matomat.cfg" ]
20 then echo "[-] Matomat Config already exists."
21 else
22 cp matomat.cfg $CFG_DIR/matomat.cfg
23 echo "[+] Config file created."
24 fi
25
c55823b @lofi42 Version 0.2.2
authored
26 if [ -d "$LIB_DIR/Matomat" ]
27 then echo "[-] Matomat Perl Module Directory already exists."
28 else
29 cp -r Matomat $LIB_DIR
30 echo "[+] Matomat Perl Modules created."
31 fi
32
1d99531 @lofi42 Version 0.2.0
authored
33 if [ -d "$DATA_DIR/matomat" ]
34 then echo "[-] Matomat Data Directory already exists."
35 else
36 mkdir $DATA_DIR/matomat/
37 cp CHANGELOG.md $DATA_DIR/matomat/CHANGELOG.md
38 cp README.md $DATA_DIR/matomat/README.md
39 cp standard.flf $DATA_DIR/matomat/standard.flf
40 echo "[+] Data Directory created."
41
6e1fc04 @lofi42 Version 0.2.2
authored
42 sqlite3 $DATA_DIR/matomat/matomat.db "CREATE TABLE user (userid INTEGER PRIMARY KEY, username TEXT UNIQUE, pw_hash TEXT, pw_change INT, rfid_id INT UNIQUE, privs INT, credits INT);"
43 sqlite3 $DATA_DIR/matomat/matomat.db "INSERT INTO user (username, pw_hash, pw_change, rfid_id, privs, credits) VALUES ('admin','$xlx37Vm8heXo192iixKl89vB6ZkFygnWBctLHy4vlSjXoAkfo4SDsGefEvocbjhBHmJdRVJXj53aoqZpjfq1ESq0IsXGimKveaXZu2ak9PzYVC6Iawz3wP8xnqnAYC1Uz$WLHrV6B/9Cpa0jrfEv1wtLz4AoifIWEXlcFeOHNnbmLW8K/qUhF//odu9T44RwZ7zeJSeuDA2CPwSZ12phcu5g',0,1000,1,0);"
1d99531 @lofi42 Version 0.2.0
authored
44 sqlite3 $DATA_DIR/matomat/matomat.db "CREATE TABLE drinks (drinkid INTEGER PRIMARY KEY, name TEXT UNIQUE, price INT, active INT,fixed INT,t2s TEXT);"
5868f8d @lofi42 Version 0.2.2 create user table fix
authored
45 sqlite3 $DATA_DIR/matomat/matomat.db "CREATE TABLE plugins (name TXT UNIQUE, filename TXT UNIQUE, active INT);"
1d99531 @lofi42 Version 0.2.0
authored
46 chmod 666 $DATA_DIR/matomat/matomat.db
47 chmod 777 $DATA_DIR/matomat/
48 echo "[+] Matomat.db created."
49 fi
50
51 if [ -f "$BIN_DIR/matomat.pl" ]
52 then echo "[-] Matomat binary already exists."
53 else
54 cp matomat.pl $BIN_DIR/matomat.pl
55 echo "[+] Matomat binary created."
56 fi
57
Something went wrong with that request. Please try again.