install.sh 4.3 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
42
for i in "${choice[@]}"
do
Igor Pečovnik's avatar
Igor Pečovnik committed
43
#--------------------------------------------------------------------------------------------------------------------------------
44
45
    if [ "$i" == "ISPConfig" ] ; then
		server_conf
Igor Pecovnik's avatar
bugfix    
Igor Pecovnik committed
46
		if [[ "$MYSQL_PASS" == "" ]]; then
47
48
49
50
51
52
53
54
55
56
57
			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
	if [ "$i" == "Samba" ] ; then
		install_samba
	fi
	if [ "$i" == "TV headend" ] ; then
Igor Pecovnik's avatar
Igor Pecovnik committed
58
		install_tvheadend "$tv_user" "$tv_pass"
59
	fi
Igor Pečovnik's avatar
Igor Pečovnik committed
60
61
62
	if [ "$i" == "Syncthing" ] ; then
		install_syncthing
	fi
Igor Pečovnik's avatar
CUPS    
Igor Pečovnik committed
63
64
65
	if [ "$i" == "CUPS" ] ; then
		install_cups
	fi
Igor Pecovnik's avatar
Igor Pecovnik committed
66
67
68
	if [ "$i" == "VPN server" ] ; then
		install_vpn_server
	fi	
Igor Pečovnik's avatar
scanner    
Igor Pečovnik committed
69
70
71
	if [ "$i" == "Scanner" ] ; then
		install_scaner_and_scanbuttons
	fi
Igor Pečovnik's avatar
Igor Pečovnik committed
72
73
74
	if [ "$i" == "Rpi monitor" ] ; then
		install_rpimonitor
	fi
Igor Pečovnik's avatar
Igor Pečovnik committed
75
	if [ "$i" == "Pi hole" ] ; then
Igor Pečovnik's avatar
pi hole    
Igor Pečovnik committed
76
		curl -L install.pi-hole.net | bash
Igor Pecovnik's avatar
Igor Pecovnik committed
77
		fi
Igor Pečovnik's avatar
scanner    
Igor Pečovnik committed
78
	if	[ "$i" == "Transmission" ] ; then
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
		install_transmission
	fi
	
#--------------------------------------------------------------------------------------------------------------------------------	
done






exit






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

Igor Pečovnik's avatar
Igor Pečovnik committed
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
SECTION="Basic configuration"
# Read IP address
#
#
# Read full qualified hostname

source "functions.sh"

whiptail --ok-button "Install" --title "Debian micro home server installation (c) Igor Pecovnik" --checklist --separate-output "\nIP:   $serverIP\nFQDN: $HOSTNAMEFQDN\n\nChoose what you want to install:" 20 78 9 \
"Samba" "Windows compatible file sharing        " off \
"TV headend" "TV streaming / proxy" off \
"BitTorrent Sync" "Personal cloud" off \
"SoftEther VPN server" "Advanced VPN solution" off \
"CUPS" "Printing" off \
"Scanner" "Control your scanner with buttons, OCR" off \
"Temper" "USB temperature sensor" off \
114
"Rpi monitor" "Status page and statistics" off \
Igor Pečovnik's avatar
Igor Pečovnik committed
115
116
117
118
119
120
121
122
123
124
125
126
"Transmission" "Torrent downloading" off \
"ISPConfig" "WWW, PHP, SQL, SMTP, IMAP, POP3" off 2>results
while read choice
do
   case $choice in
		   "Samba") 			ins_samba="true";;
                   "TV headend") 		ins_tvheadend="true";;
                   "BitTorrent Sync") 	  	ins_btsync="true";;
                   "SoftEther VPN server") 	ins_vpn_server="true";;
		   "CUPS") 			ins_cups="true";;
		   "Scanner") 			ins_scaner_and_scanbuttons="true";;
                   "Temper") 			ins_temper="true";;
127
				   "Rpi monitor") 			ins_rpimonitor="true";;
Igor Pečovnik's avatar
Igor Pečovnik committed
128
129
130
131
132
133
134
135
                   "Transmission")		ins_transmission="true";;
		   "ISPConfig")			ins_ispconfig="true";;
                *)
                ;;
        esac
done < results


136
137
if [[ "$ins_samba" == "true" ]]; 			then ; 			fi
if [[ "$ins_tvheadend" == "true" ]]; 			then ; 		fi
Igor Pečovnik's avatar
Igor Pečovnik committed
138
139
140
141
142
if [[ "$ins_btsync" == "true" ]]; 			then install_btsync; 			fi
if [[ "$ins_vpn_server" == "true" ]]; 			then install_vpn_server; 		fi
if [[ "$ins_cups" == "true" ]]; 			then install_cups; 			fi
if [[ "$ins_scanner_and_scanbuttons" == "true" ]];	then install_scaner_and_scanbuttons; 	fi
if [[ "$ins_temper" == "true" ]]; 			then install_temper; 			fi
143
if [[ "$ins_rpimonitor" == "true" ]]; 			then install_bmc180; install_tsl2561; install_rpimonitor;  			fi
144
if [[ "$ins_transmission" == "true" ]];                 then ;              fi