Skip to content

Commit

Permalink
Continue Standardization and Rewrite
Browse files Browse the repository at this point in the history
This contains further rewrites that improve the consistency of the
codebase. These were made in addition to the changes that were first
started in openhab#938.

Related openhab#937

Signed-off-by: Ethan Dye <mrtops03@gmail.com>
  • Loading branch information
ecdye committed Jul 21, 2020
1 parent 1a8d936 commit 8fcc068
Show file tree
Hide file tree
Showing 33 changed files with 1,382 additions and 988 deletions.
3 changes: 1 addition & 2 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Please be as detailed as possible to help us help you. Also, please be sure to
check that your issue has not already been observed and reported to the GitHub
issue tracker (you should remove the `is:open` filter from the search
bar to let you see closed issues). Please follow the guidelines outlined in the
[openHAB community](https://community.openhab.org/t/how-to-ask-a-good-question-help-us-help-you/58396)
on how to help us help you.
[openHAB community](https://community.openhab.org/t/how-to-ask-a-good-question-help-us-help-you/58396) on how to help us help you.

## Debug information:
Please provide all of the output provided by utilizing the `debugmode=maximum`
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ Universally formatted code promotes ease of writing, reading, and maintenance.
* When a function is used across many files, include it in the `helpers.bash`
file.

* Functions should be named using underscores. For example, `new_function`, or
`openhabian_update`.

* Variables should be named using camelCase. For example, `newVariable`, or
`requestedArch`.

* Always refuse to allow the running of package setup scripts that require
user input in unattended mode.

Expand Down
4 changes: 1 addition & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Internet Systems Consortium license
===================================

Copyright (c) 2020 Thomas Dietrich [thomas@nurzen.de](mailto:thomas@nurzen.de)
Markus Storm [markus.storm@gmx.net](mailto:markus.storm@gmx.net)
and others
Copyright (c) 2010-2020 Contributors to the openHAB project

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
Expand Down
13 changes: 6 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ lookup.
### Wireguard VPN (ALPHA)
Wireguard can be deployed to enable for VPN access to your openHABian box when
it's located in some remote location.
You need to install the Wireguard client from http://www.wireguard.com/install
You need to install the Wireguard client from <http://www.wireguard.com/install>
to your local PC or mobile device that you want to use for access.
Copy the configuration file /etc/wireguard/wg0-client.conf from this box to load
the tunnel.
Copy the configuration file '/etc/wireguard/wg0-client.conf' from this box or
transmit QR code to load the tunnel.
Note this is an ALPHA test so don't expect it to work out of the box.
Any feedback is highly appreciated on the forum.

### New Java providers now out of beta
Java 11 has proven to work with 2.5
Java 11 has been proven to work with openHAB 2.5.


## June 17, 2020
Expand All @@ -28,6 +28,5 @@ In short, PINE A64 is no longer supported and OS releases other than the current
work or not.

The current and previous Debian / Raspberry Pi OS (previously called Raspbian)
releases are 10 ("buster") and 9 ("stretch"). Most current Ubuntu LTS releases
are 20.04 ("focal") and 18.04 ("bionic").

releases are 10 ("buster") and 9 ("stretch"). The most current Ubuntu LTS
releases are 20.04 ("focal") and 18.04 ("bionic").
32 changes: 16 additions & 16 deletions build-image/first-boot.bash
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if [[ -z $wifi_ssid ]]; then
# Actually check if ethernet is working
echo -n "$(timestamp) [openHABian] Setting up Ethernet connection... "
if grep -q "up" /sys/class/net/eth0/operstate; then echo "OK"; else echo "FAILED"; fi
elif grep -q "openHABian" /etc/wpa_supplicant/wpa_supplicant.conf && ! grep -q "^[[:space:]]*dtoverlay=disable-wifi" /boot/config.txt; then
elif grep -q "openHABian" /etc/wpa_supplicant/wpa_supplicant.conf && ! grep -qsE "^[[:space:]]*dtoverlay=(pi3-)?disable-wifi" /boot/config.txt; then
echo -n "$(timestamp) [openHABian] Setting up Wi-Fi connection... "
if iwlist wlan0 scanning |& grep -q "Interface doesn't support scanning"; then
# wifi might be blocked
Expand Down Expand Up @@ -132,7 +132,7 @@ fi


echo -n "$(timestamp) [openHABian] Ensuring network connectivity... "
if tryUntil "ping -c1 9.9.9.9 > /dev/null || wget -S -t 3 --waitretry=4 http://www.msftncsi.com/ncsi.txt |& grep -q 'Microsoft NCSI'" 30 1; then
if tryUntil "ping -c1 www.example.com &> /dev/null || curl --silent --head http://www.example.com |& grep -qs 'HTTP/1.1 200 OK'" 30 1; then
echo "FAILED"
if grep -q "openHABian" /etc/wpa_supplicant/wpa_supplicant.conf && iwconfig |& grep -q "ESSID:off"; then
echo "$(timestamp) [openHABian] I was not able to connect to the configured Wi-Fi. Please check your signal quality. Reachable Wi-Fi networks are:"
Expand All @@ -152,12 +152,12 @@ echo -n "$(timestamp) [openHABian] Waiting for dpkg/apt to get ready... "
if wait_for_apt_to_be_ready; then echo "OK"; else echo "FAILED"; fi

echo -n "$(timestamp) [openHABian] Updating repositories and upgrading installed packages... "
apt-get --yes --fix-broken install &> /dev/null
apt-get install --fix-broken --yes &> /dev/null
if [[ $(eval "$(apt-get --yes upgrade &> /dev/null)") -eq 100 ]]; then
cond_echo "CONTINUING... ${COL_DEF}\c"
dpkg --configure -a &> /dev/null
apt-get --yes --fix-broken install &> /dev/null
if apt-get --yes upgrade &> /dev/null; then echo "OK"; else echo "FAILED"; fi
echo -n "CONTINUING... "
dpkg --configure --pending &> /dev/null
apt-get install --fix-broken --yes &> /dev/null
if apt-get upgrade --yes &> /dev/null; then echo "OK"; else echo "FAILED"; fi
else
echo "OK"
fi
Expand All @@ -170,7 +170,7 @@ if ! dpkg -s 'git' &> /dev/null; then
fi

# shellcheck disable=SC2154
echo -n "$(timestamp) [openHABian] Cloning myself from ${repositoryurl:-https://github.com/openhab/openhabian.git}, ${clonebranch:-stable} branch... "
echo -n "$(timestamp) [openHABian] Updating myself from ${repositoryurl:-https://github.com/openhab/openhabian.git}, ${clonebranch:-stable} branch... "
type openhabian_update &> /dev/null && if ! openhabian_update &> /dev/null; then
echo "FAILED"
echo "$(timestamp) [openHABian] The git repository on the public internet is not reachable."
Expand All @@ -181,20 +181,20 @@ fi
ln -sfn /opt/openhabian/openhabian-setup.sh /usr/local/bin/openhabian-config

# shellcheck disable=SC2154
echo "$(timestamp) [openHABian] Executing openhabian-setup.sh unattended..."
if (bash /opt/openhabian/openhabian-setup.sh unattended); then
echo "$(timestamp) [openHABian] Starting execution of 'openhabian-config unattended'... OK"
if (openhabian-config unattended); then
rm -f /opt/openHABian-install-inprogress
touch /opt/openHABian-install-successful
else
echo "$(timestamp) [openHABian] We tried to get your system installed, but without proper internet connectivity this is not guaranteed to work."
echo "$(timestamp) [openHABian] We tried to get your system installed, but without proper internet connectivity this may not have worked properly."
#fail_inprogress
fi
echo "$(timestamp) [openHABian] Execution of 'openhabian-setup.sh unattended' completed."
echo "$(timestamp) [openHABian] Execution of 'openhabian-config unattended' completed."

echo -n "$(timestamp) [openHABian] Waiting for openHAB to become ready on ${HOSTNAME}... "
echo -n "$(timestamp) [openHABian] Waiting for openHAB to become ready on ${HOSTNAME:-openhab}... "

# this took ~130 seconds on a RPi2
if ! tryUntil "wget -S --spider -t 3 --waitretry=4 http://${HOSTNAME}:8080/start/index |& grep -q 'HTTP/1.1 200 OK'" 20 10; then echo "OK"; else echo "FAILED"; exit 1; fi
if ! tryUntil "curl --silent --head http://${HOSTNAME:-openhab}:8080/start/index |& grep -qs 'HTTP/1.1 200 OK'" 20 10; then echo "OK"; else echo "FAILED"; exit 1; fi

echo "$(timestamp) [openHABian] Visit the openHAB dashboard now: http://${HOSTNAME:-openhab}:8080"
echo "$(timestamp) [openHABian] To gain access to a console, simply reconnect."
Expand All @@ -204,9 +204,9 @@ if [[ -x $(command -v python3) ]]; then bash /boot/webif.bash inst_done; fi
sleep 12

if running_in_docker; then
PID="${OPENHAB_USERDATA}"/tmp/karaf.pid
PID="/var/lib/openhab2/tmp/karaf.pid"
echo -e "\\n${COL_CYAN}Memory usage:" && free -m
if [[ -d "$PID" ]]; then
if [[ -f "$PID" ]]; then
ps -auxq "$(cat "$PID")" | awk '/openhab/ {print "size/res="$5"/"$6" KB"}'
else
echo -e "\\n${COL_RED}Karaf PID missing, openHAB process not running (yet?)."
Expand Down
11 changes: 4 additions & 7 deletions build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ else
exit 0
fi

# Check if a specific repository shall be included
# Check if a specific repository should be included
if [ "$2" == "dev-git" ]; then # Use current git repo and branch as a development image
file_tag="custom"
get_git_repo
Expand Down Expand Up @@ -291,12 +291,9 @@ if [[ $hw_platform == "pi-raspios32" ]] || [[ $hw_platform == "pi-raspios64beta"
fi

echo_process "Verifying signature of downloaded image... "
curl -s "$zipurl".sig -o "$buildfolder"/"$zipfile".sig
# verify signature with key from website - this is probably not the safest way to obtain the key,
# but at least it is on a different download site
curl -s -o "$buildfolder"/raspberrypi_downloads.gpg.key https://www.raspberrypi.org/raspberrypi_downloads.gpg.key
gpg -q --no-default-keyring --keyring "$buildfolder"/raspberrypiorg_downloads.keyring --import "$buildfolder"/raspberrypi_downloads.gpg.key 2> /dev/null || true
gpg -q --trust-model always --no-default-keyring --keyring "$buildfolder"/raspberrypiorg_downloads.keyring --verify "$buildfolder/$zipfile".sig "$buildfolder/$zipfile" 2> /dev/null || exit 1
curl -s "$zipurl".sig -o "$buildfolder"/"$zipfile".sig
if ! gpg -q --keyserver keyserver.ubuntu.com --recv-key 0x8738CD6B956F460C; then echo "FAILED (download public key)"; exit 1; fi
if gpg -q --trust-model always --verify "$buildfolder/$zipfile".sig "$buildfolder/$zipfile"; then echo "OK"; else echo "FAILED (signature)"; exit 1; fi

echo_process "Unpacking image... "
unzip -q "$buildfolder/$zipfile" -d $buildfolder
Expand Down
4 changes: 2 additions & 2 deletions docker-tests/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function start_udev()
if [ "$UDEV" == "on" ]; then
if $PRIVILEGED; then
mount_dev
if command -v udevd &>/dev/null; then
if command -v udevd &> /dev/null; then
unshare --net udevd --daemon &> /dev/null
else
unshare --net /lib/systemd/systemd-udevd --daemon &> /dev/null
Expand All @@ -50,7 +50,7 @@ function start_udev()
function init()
{
# echo error message, when executable file doesn't exist.
if CMD=$(command -v "$1" 2>/dev/null); then
if CMD=$(command -v "$1" 2> /dev/null); then
shift
exec "$CMD" "$@"
else
Expand Down
12 changes: 6 additions & 6 deletions docs/NEWSLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
### Wireguard VPN (ALPHA)
Wireguard can be deployed to enable for VPN access to your openHABian box when
it's located in some remote location.
You need to install the Wireguard client from http://www.wireguard.com/install
You need to install the Wireguard client from <http://www.wireguard.com/install>
to your local PC or mobile device that you want to use for access.
Copy the configuration file /etc/wireguard/wg0-client.conf from this box to load
the tunnel.
Copy the configuration file '/etc/wireguard/wg0-client.conf' from this box or
transmit QR code to load the tunnel.
Note this is an ALPHA test so don't expect it to work out of the box.
Any feedback is highly appreciated on the forum.

### New Java providers now out of beta
Java 11 has proven to work with 2.5.
Java 11 has been proven to work with openHAB 2.5.


## June 17, 2020
Expand All @@ -23,8 +23,8 @@ In short, PINE A64 is no longer supported and OS releases other than the current
work or not.

The current and previous Debian / Raspberry Pi OS (previously called Raspbian)
releases are 10 ("buster") and 9 ("stretch"). Most current Ubuntu LTS releases
are 20.04 ("focal") and 18.04 ("bionic").
releases are 10 ("buster") and 9 ("stretch"). The most current Ubuntu LTS
releases are 20.04 ("focal") and 18.04 ("bionic").


## June 10, 2020
Expand Down
28 changes: 13 additions & 15 deletions docs/exim.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ When you choose the "Mail Transfer Agent" install option in openhabian-config me
In case you enter anything wrong you can re-initiate the installation process from the openHABian menu
Here's what you will need to enter:

* Mail server type: mail sent by smarthost (received via SMTP or fetchmail)
* System mail name: FQDN (your full hostname including the domain part)
* IPs that should be allowed by the server: 127.0.0.1; ::1; 192.168.xxx.yyy (replace with your hosts's IP)
* Other destinations for which mail is accepted: `<hostname> <hostname>.<domainname> <domainname>`
* Machines to relay mail for: Leave empty
* IP address or host name of the outgoing smarthost: `smtp.gmail.com::587`
* Hide local mail name in outgoing mail: No
* Keep number of DNS-queries minimal: No
* Delivery method: Select: Maildir format in home directory
* Split configuration into small files: Yes
* List of smarthost(s) to use your account for: `*`
* Mail username of the public service to relay all outgoing mail to:
Your username for the mail relay service to use such as `my_id@gmail.com`


* Mail server type: mail sent by smarthost (received via SMTP or fetchmail)
* System mail name: FQDN (your full hostname including the domain part)
* IPs that should be allowed by the server: 127.0.0.1; ::1; 192.168.xxx.yyy (replace with your hosts's IP)
* Other destinations for which mail is accepted: `<hostname> <hostname>.<domainname> <domainname>`
* Machines to relay mail for: Leave empty
* IP address or host name of the outgoing smarthost: `smtp.gmail.com::587`
* Hide local mail name in outgoing mail: No
* Keep number of DNS-queries minimal: No
* Delivery method: Select: Maildir format in home directory
* Split configuration into small files: Yes
* List of smarthost(s) to use your account for: `*`
* Mail username of the public service to relay all outgoing mail to:
Your username for the mail relay service to use such as `my_id@gmail.com`

0 comments on commit 8fcc068

Please sign in to comment.