install.sh 2 KB
Newer Older
Igor Pečovnik's avatar
Igor Pečovnik committed
1
2
#!/bin/bash
#
Igor Pečovnik's avatar
Igor Pečovnik committed
3
# Debian micro home server installation(c) Igor Pecovnik
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
#
# This file is a part of https://github.com/igorpecovnik/Debian-micro-home-server
#


# Read functions
source "functions.sh"

Igor Pečovnik's avatar
Igor Pečovnik committed
18

Igor Pečovnik's avatar
Igor Pečovnik committed
19
20
# Check if user is root
if [ $(id -u) != "0" ]; then
21
22
	dialog --msgbox "Error: You must be root to run this script, please use the root user to install the software." 7 70
	exit 1
Igor Pečovnik's avatar
Igor Pečovnik committed
23
24
fi

25

Igor Pečovnik's avatar
Igor Pečovnik committed
26
27
# Debian only
if [ ! -f /etc/debian_version ]; then 
28
	dialog --msgbox "Warning: Unsupported Linux Distribution, it might not install properly. Tailored for Debian. " 7 70
Igor Pečovnik's avatar
Igor Pečovnik committed
29
30
fi

31

Igor Pečovnik's avatar
Igor Pečovnik committed
32
33
# Ramlog must be disabled
if [ -f /run/ramlog.lock ]; then
34
	dialog --msgbox "Ramlog is running. Please disable before running (service ramlog disable). Reboot is required." 7 70
Igor Pečovnik's avatar
Igor Pečovnik committed
35
    exit 1
Igor Pečovnik's avatar
Igor Pečovnik committed
36
fi
Igor Pečovnik's avatar
Igor Pečovnik committed
37

38
39
# Choose what to install
what_to_install
Igor Pecovnik's avatar
Igor Pecovnik committed
40
before_install
41
for i in "${choice[@]}"
42
43
do	
    if [[ "$i" == ISPConfig* ]] ; then
44
		server_conf
Igor Pecovnik's avatar
bugfix    
Igor Pecovnik committed
45
		if [[ "$MYSQL_PASS" == "" ]]; then
46
47
48
49
50
51
52
			dialog --msgbox "Mysql password can't be blank. Exiting..." 7 70
			exit
		fi
		install_basic; install_DashNTP; install_MySQL; install_MySQLDovecot; install_Virus; install_$server
		create_ispconfig_configuration; install_PureFTPD; install_Fail2BanDovecot; install_Fail2BanRulesDovecot; 
		install_ISPConfig
    fi
53
	if [[ "$i" == Samba* ]] ; then
54
55
		install_samba
	fi
56
	if [[ "$i" == *headend* ]] ; then
Igor Pecovnik's avatar
tvhead    
Igor Pecovnik committed
57
		install_tvheadend
58
	fi
59
	if [[ "$i" == Syncthing* ]] ; then
Igor Pečovnik's avatar
Igor Pečovnik committed
60
61
		install_syncthing
	fi
62
	if [[ "$i" == CUPS* ]] ; then
Igor Pečovnik's avatar
CUPS    
Igor Pečovnik committed
63
64
		install_cups
	fi
65
	if [[ "$i" == *server* ]] ; then
Igor Pecovnik's avatar
Igor Pecovnik committed
66
67
		install_vpn_server
	fi	
68
	if [[ "$i" == Scanner* ]] ; then
Igor Pečovnik's avatar
scanner    
Igor Pečovnik committed
69
70
		install_scaner_and_scanbuttons
	fi
71
	if [[ "$i" == *monitor* ]] ; then
Igor Pečovnik's avatar
Igor Pečovnik committed
72
73
		install_rpimonitor
	fi
74
	if [[ "$i" == *hole* ]] ; then
Igor Pečovnik's avatar
pi hole    
Igor Pečovnik committed
75
		curl -L install.pi-hole.net | bash
76
77
	fi
	if	[[ "$i" == Transmission* ]] ; then
78
79
80
		install_transmission
	fi
	
Igor Pečovnik's avatar
Igor Pečovnik committed
81

82
done