Skip to content

Commit 32cd65d

Browse files
authored
Refactor: openHAB (#9060)
1 parent 681932c commit 32cd65d

File tree

2 files changed

+30
-35
lines changed

2 files changed

+30
-35
lines changed

ct/openhab.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ color
2020
catch_errors
2121

2222
function update_script() {
23-
header_info
24-
check_container_storage
25-
check_container_resources
26-
if [[ ! -f /etc/apt/sources.list.d/openhab.list ]]; then
27-
msg_error "No ${APP} Installation Found!"
28-
exit
29-
fi
30-
msg_info "Updating ${APP} LXC"
31-
$STD apt update
32-
$STD apt -y upgrade
33-
msg_ok "Updated successfully!"
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -f /usr/lib/systemd/system/openhab.service ]]; then
27+
msg_error "No ${APP} Installation Found!"
3428
exit
29+
fi
30+
msg_info "Updating ${APP} LXC"
31+
$STD apt update
32+
$STD apt upgrade -y
33+
msg_ok "Updated successfully!"
34+
exit
3535
}
3636

3737
start

install/openhab-install.sh

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,30 @@ setting_up_container
1313
network_check
1414
update_os
1515

16-
msg_info "Installing Dependencies"
17-
$STD apt install -y \
18-
ca-certificates \
19-
apt-transport-https
20-
msg_ok "Installed Dependencies"
21-
2216
JAVA_VERSION="21" setup_java
2317

2418
msg_info "Installing openHAB"
25-
curl -fsSL "https://openhab.jfrog.io/artifactory/api/gpg/key/public" | gpg --dearmor -o /usr/share/keyrings/openhab.gpg
26-
chmod u=rw,g=r,o=r /usr/share/keyrings/openhab.gpg
27-
cat <<EOF >/etc/apt/sources.list.d/openhab.sources
28-
Types: deb
29-
URIs: https://openhab.jfrog.io/artifactory/openhab-linuxpkg
30-
Suites: stable
31-
Components: main
32-
Signed-By: /usr/share/keyrings/openhab.gpg
33-
EOF
34-
$STD apt update
35-
$STD apt -y install openhab
19+
setup_deb822_repo \
20+
"openhab" \
21+
"https://openhab.jfrog.io/artifactory/api/gpg/key/public" \
22+
"https://openhab.jfrog.io/artifactory/openhab-linuxpkg" \
23+
"stable" \
24+
"main"
25+
$STD apt install -y openhab
26+
msg_ok "Installed openHAB"
27+
28+
msg_info "Initializing openHAB directories"
29+
mkdir -p /var/lib/openhab/{tmp,etc,cache}
30+
mkdir -p /etc/openhab
31+
mkdir -p /var/log/openhab
32+
chown -R openhab:openhab /var/lib/openhab /etc/openhab /var/log/openhab
33+
msg_ok "Initialized openHAB directories"
34+
35+
msg_info "Starting Service"
3636
systemctl daemon-reload
3737
systemctl enable -q --now openhab
38-
msg_ok "Installed openHAB"
38+
msg_ok "Started Service"
3939

4040
motd_ssh
4141
customize
42-
43-
msg_info "Cleaning up"
44-
$STD apt -y autoremove
45-
$STD apt -y autoclean
46-
$STD apt -y clean
47-
msg_ok "Cleaned"
42+
cleanup_lxc

0 commit comments

Comments
 (0)