install.sh 2.36 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
# Debian only
Igor Pecovnik's avatar
Igor Pecovnik committed
27
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
41
42
for menu_choice in "${choice[@]}"
do
	if [[ "$menu_choice" == ISPConfig* ]] ; then
43
		server_conf
Igor Pecovnik's avatar
bugfix    
Igor Pecovnik committed
44
		if [[ "$MYSQL_PASS" == "" ]]; then
45
46
47
48
			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
Igor Pecovnik's avatar
Igor Pecovnik committed
49
		create_ispconfig_configuration; install_PureFTPD; install_Fail2BanDovecot; install_Fail2BanRulesDovecot;
50
51
		install_ISPConfig
    fi
Igor Pecovnik's avatar
Igor Pecovnik committed
52
53
	if [[ "$menu_choice" == *Tasksel* ]] ; then
		tasksel
54
	fi
Igor Pecovnik's avatar
Igor Pecovnik committed
55
	if [[ "$menu_choice" == *headend* ]] ; then
Igor Pecovnik's avatar
tvhead    
Igor Pecovnik committed
56
		install_tvheadend
Igor Pecovnik's avatar
Igor Pecovnik committed
57
58
		check_port 9981
		echo $menu_choice;
59
	fi
Igor Pecovnik's avatar
Igor Pecovnik committed
60
	if [[ "$menu_choice" == *Syncthing* ]] ; then
Igor Pečovnik's avatar
Igor Pečovnik committed
61
		install_syncthing
Igor Pecovnik's avatar
Igor Pecovnik committed
62
		check_port 8384 "Syncthing"
Igor Pečovnik's avatar
Igor Pečovnik committed
63
	fi
Igor Pecovnik's avatar
Igor Pecovnik committed
64
	if [[ "$menu_choice" == CUPS* ]] ; then
Igor Pečovnik's avatar
CUPS    
Igor Pečovnik committed
65
66
		install_cups
	fi
Igor Pecovnik's avatar
Igor Pecovnik committed
67
	if [[ "$menu_choice" == *server* ]] ; then
Igor Pecovnik's avatar
Igor Pecovnik committed
68
		install_vpn_server
Igor Pecovnik's avatar
Igor Pecovnik committed
69
70
	fi
	if [[ "$menu_choice" == Scanner* ]] ; then
Igor Pečovnik's avatar
scanner    
Igor Pečovnik committed
71
72
		install_scaner_and_scanbuttons
	fi
Igor Pecovnik's avatar
Igor Pecovnik committed
73
74
75
76
77
	if [[ "$menu_choice" == *monitor* ]] ; then
		armbianmonitor -r
	fi
	if [[ "$menu_choice" == *OMV* ]] ; then
		install_omv
Igor Pečovnik's avatar
Igor Pečovnik committed
78
	fi
Igor Pecovnik's avatar
Igor Pecovnik committed
79
	if [[ "$menu_choice" == *hole* ]] ; then
Igor Pečovnik's avatar
pi hole    
Igor Pečovnik committed
80
		curl -L install.pi-hole.net | bash
81
	fi
Igor Pecovnik's avatar
Igor Pecovnik committed
82
83
84
85
86
	if [[ "$menu_choice" == *Minidlna* ]] ; then
		install_packet "minidlna" "Install lightweight DLNA/UPnP-AV server"
		check_port 8200
	fi
	if	[[ "$menu_choice" == *Transmission* ]] ; then
87
		install_transmission
Igor Pecovnik's avatar
Igor Pecovnik committed
88
		check_port 9091
89
	fi
90
done