forked from openhab/openhabian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenhabian-setup.sh
executable file
·99 lines (87 loc) · 2.56 KB
/
openhabian-setup.sh
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env bash
# openHABian - hassle-free openHAB 2 installation and configuration tool
# for the Raspberry Pi and other Linux systems
#
# Documentation: https://www.openhab.org/docs/installation/openhabian.html
# Development: http://github.com/openhab/openhabian
# Discussion: https://community.openhab.org/t/13379
#
# Find the absolute script location dir (e.g. BASEDIR=/opt/openhabian)
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
BASEDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$BASEDIR/$SOURCE"
done
BASEDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SCRIPTNAME="$(basename $SOURCE)"
REPOSITORYURL="https://github.com/openhab/openhabian"
CONFIGFILE="/etc/openhabian.conf"
# Trap CTRL+C, CTRL+Z and quit singles
trap '' SIGINT SIGQUIT SIGTSTP
# Log with timestamp
timestamp() { date +"%F_%T_%Z"; }
# Make sure only root can run our script
echo -n "$(timestamp) [openHABian] Checking for root privileges... "
if [[ $EUID -ne 0 ]]; then
echo ""
echo "This script must be run as root. Did you mean 'sudo openhabian-config'?" 1>&2
echo "More info: https://www.openhab.org/docs/installation/openhabian.html"
exit 1
else
echo "OK"
fi
# script will be called with 'unattended' argument by openHABian images
if [[ "$1" = "unattended" ]]; then
UNATTENDED=1
SILENT=1
elif [[ "$1" = "unattended_debug" ]]; then
UNATTENDED=1
else
INTERACTIVE=1
fi
# Include all subscripts
# shellcheck source=/dev/null
for shfile in $BASEDIR/functions/*.bash; do source "$shfile"; done
if [[ -n "$UNATTENDED" ]]; then
# apt/dpkg commands will not try interactive dialogs
export DEBIAN_FRONTEND=noninteractive
load_create_config
timezone_setting
locale_setting
hostname_change
if is_pi; then memory_split; enable_rpi_audio; fi
if is_pine64; then pine64_platform_scripts; fi
if is_pine64; then pine64_fixed_mac; fi
if is_pine64; then pine64_fix_systeminfo_binding; fi
basic_packages
needed_packages
bashrc_copy
vimrc_copy
firemotd_setup
java_zulu
openhab2_setup
vim_openhab_syntax
nano_openhab_syntax
multitail_openhab_scheme
srv_bind_mounts
permissions_corrections
misc_system_settings
samba_setup
clean_config_userpw
nodejs_setup
frontail_setup
else
whiptail_check
load_create_config
openhabian_hotfix
ua-netinst_check
openhabian_console_check
openhabian_update_check
while show_main_menu; do
true
done
system_check_default_password
echo -e "$(timestamp) [openHABian] We hope you got what you came for! See you again soon ;)"
fi
# vim: filetype=sh