Skip to content

Commit

Permalink
Clean up and organize repository files
Browse files Browse the repository at this point in the history
Signed-off-by: Ethan Dye <mrtops03@gmail.com>
  • Loading branch information
ecdye committed May 6, 2021
1 parent 3c15b67 commit 288de33
Show file tree
Hide file tree
Showing 28 changed files with 27 additions and 194 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Expand Up @@ -164,13 +164,13 @@ C) _Static analysis using the ShellCheck linter_
### Test installation
Test installations are done continuously using Docker on GitHub and by testing on actual hardware, eg. Raspberry Pi.
A Docker installation can be performed by three commands.
Firstly a Docker image is built where the `openhabian` code is injected (see `Dockerfile.*` for details).
Firstly a Docker image is built where the `openhabian` code is injected (see `tests/Dockerfile.*` for details).

To begin, first make a Docker container for your platform.
An example Docker container build for `amd64` would look like:

``` bash
docker build --tag openhabian/install-openhabian -f Dockerfile.amd64-installation .
docker build --tag openhabian/install-openhabian -f ./tests/Dockerfile.amd64-installation .
```

While not a problem in the final container-less deployment, with more than one container running, all but one of them will have a `systemd` running with a PID other than 1.
Expand Down Expand Up @@ -206,8 +206,8 @@ For example, code would reside in `helpers.bash` with tests in `helpers.bats`.
To begin, first make a Docker container for your platform.
An example Docker container build for `amd64` would look like:

```
docker build --tag openhabian/bats-openhabian -f Dockerfile.ubuntu-BATS .
``` bash
docker build --tag openhabian/bats-openhabian -f ./tests/Dockerfile.ubuntu-BATS .
docker run --privileged --rm --name "openhabian-bats" -d openhabian/bats-openhabian
```

Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
@@ -1,5 +1,5 @@
Hit tab to unselect buttons and scroll through the text using UP/DOWN or PGUP/PGDN.
All announcements are stored in `/opt/openhabian/docs/NEWSLOG.md` for you to lookup.
All announcements are stored in `/opt/openhabian/docs/CHANGELOG.md` for you to lookup.

## Bintray shutdown ## May 3, 2021
Bintray, the hosting service formerly used for the openHAB stable distribution,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -8,7 +8,7 @@
![Installation](https://github.com/openhab/openhabian/workflows/Installation/badge.svg)
![Build](https://github.com/openhab/openhabian/workflows/Build/badge.svg)

<img align="right" width="220" src="./logo.svg" />
<img align="right" width="220" src="./docs/images/logo.svg" />

Setting up a fully working Linux system with all needed packages and useful tooling is a boring, lengthy albeit challenging task.
Fortunately,
Expand Down
74 changes: 0 additions & 74 deletions Vagrantfile

This file was deleted.

4 changes: 2 additions & 2 deletions build-image/openhabian.conf
@@ -1,7 +1,7 @@
# Origin: openhabian.pi-raspios32.conf
# Origin: openhabian.conf
#
# Modify your openHABian settings
# Handle with care, only touch if you need to !
# Handle with care, only touch if you need to!
# This file will only be used on unattended initial install.
# If you want to change anything after unattended install completed, use menu in openhabian-config.

Expand Down
2 changes: 1 addition & 1 deletion build-image/openhabian.pi-raspios32.conf
@@ -1,7 +1,7 @@
# Origin: openhabian.pi-raspios32.conf
#
# Modify your openHABian settings
# Handle with care, only touch if you need to !
# Handle with care, only touch if you need to!
# This file will only be used on unattended initial install.
# If you want to change anything after unattended install completed, use menu in openhabian-config.

Expand Down
2 changes: 1 addition & 1 deletion build-image/openhabian.pi-raspios64beta.conf
@@ -1,7 +1,7 @@
# Origin: openhabian.pi-raspios64beta.conf
#
# Modify your openHABian settings
# Handle with care, only touch if you need to!!
# Handle with care, only touch if you need to!
# This file will only be used on unattended initial install.
# If you want to change anything after unattended install completed, use menu in openhabian-config.

Expand Down
4 changes: 2 additions & 2 deletions build-image/webserver.bash
Expand Up @@ -12,7 +12,7 @@ isWebRunning="$(ps -ef | pgrep python3)"
if [[ "$1" = "start" ]]; then
mkdir -p "${TMPDIR:-/tmp}"/webserver
ln -sf /boot/first-boot.log "${TMPDIR:-/tmp}"/webserver/first-boot.txt
cp /opt/openhabian/includes/install-log.html "${TMPDIR:-/tmp}"/webserver/index.html
cp /opt/openhabian/includes/webserver/install-log.html "${TMPDIR:-/tmp}"/webserver/index.html
(cd "${TMPDIR:-/tmp}"/webserver || exit 1; python3 -m http.server "$port" &> /dev/null &)
fi

Expand All @@ -24,7 +24,7 @@ fi

if [[ $1 == "inst_done" ]]; then
mkdir -p "${TMPDIR:-/tmp}"/webserver
sed 's|%HOSTNAME|'"${HOSTNAME:-openhabian}"'|g' /opt/openhabian/includes/install-complete.html > "${TMPDIR:-/tmp}"/webserver/index.html
sed 's|%HOSTNAME|'"${HOSTNAME:-openhabian}"'|g' /opt/openhabian/includes/webserver/install-complete.html > "${TMPDIR:-/tmp}"/webserver/index.html
fi

if [[ $1 == "cleanup" ]]; then
Expand Down
File renamed without changes.
File renamed without changes
2 changes: 1 addition & 1 deletion docs/openhabian.md
Expand Up @@ -195,7 +195,7 @@ apt-get install git
# download, link and create config file
git clone -b openHAB3 https://github.com/openhab/openhabian.git /opt/openhabian
ln -s /opt/openhabian/openhabian-setup.sh /usr/local/bin/openhabian-config
cp /opt/openhabian/openhabian.conf.dist /etc/openhabian.conf
cp /opt/openhabian/build-image/openhabian.conf /etc/openhabian.conf
```

Edit `/etc/openhabian.conf` to match your needs, then finally use
Expand Down
2 changes: 1 addition & 1 deletion functions/config.bash
Expand Up @@ -24,7 +24,7 @@ load_create_config() {
else
echo -n "$(timestamp) [openHABian] Setting up and loading configuration file '$configFile' in manual setup... "
if input="$(whiptail --title "openHABian Configuration Tool - Manual Setup" --inputbox "$questionText" 14 80 3>&1 1>&2 2>&3)" && id -u "$input" &> /dev/null; then
if ! cond_redirect cp "${BASEDIR:-/opt/openhabian}"/openhabian.conf.dist "$configFile"; then echo "FAILED (copy configuration)"; exit 1; fi
if ! cond_redirect cp "${BASEDIR:-/opt/openhabian}"/build-image/openhabian.conf "$configFile"; then echo "FAILED (copy configuration)"; exit 1; fi
if ! cond_redirect sed -i -e 's|^username=.*$|username='"${input}"'|g' "$configFile"; then echo "FAILED (configure admin username)"; exit 1; fi
else
echo "FAILED"
Expand Down
2 changes: 1 addition & 1 deletion functions/menu.bash
Expand Up @@ -15,7 +15,7 @@ Menu 50 provides options to backup and restore either your openHAB configuration
Note backups are NOT active per default so remember to set them up right at the beginning of your journey.
\\nVisit these sites for more information:
- Documentation: https://www.openhab.org/docs/installation/openhabian.html
- Development: http://github.com/openhab/openhabian
- Development: https://github.com/openhab/openhabian
- Discussion: https://community.openhab.org/t/13379" 25 116
RET=$?
if [ $RET -eq 255 ]; then
Expand Down
3 changes: 1 addition & 2 deletions functions/openhab.bash
Expand Up @@ -111,7 +111,7 @@ openhab_setup() {

openhab_misc
create_systemd_dependencies
if ! [[ "$1" == "openHAB3" ]]; then
if ! [[ $ohPkgName == "openhab" ]]; then
delayed_rules "yes"
fi
dashboard_add_tile "openhabiandocs"
Expand Down Expand Up @@ -314,4 +314,3 @@ fix_openhab_repo() {
cond_redirect rm -f /etc/apt/sources.list.d/openhab2.list
sed -ie 's#https://dl.bintray.com/openhab/apt-repo2#https://openhab.jfrog.io/artifactory/openhab-linuxpkg#g' /etc/apt/sources.list.d/openhab.list
}

8 changes: 4 additions & 4 deletions functions/openhabian.bash
Expand Up @@ -38,7 +38,7 @@ openhabian_announcements() {
local readNews

newsFile="${BASEDIR:-/opt/openhabian}/NEWS.md"
readNews="${BASEDIR:-/opt/openhabian}/docs/LASTNEWS.md"
readNews="${BASEDIR:-/opt/openhabian}/docs/CHANGELOG.md"

if ! cmp --silent "$newsFile" "$readNews" &> /dev/null; then
# shellcheck disable=SC2086
Expand Down Expand Up @@ -75,16 +75,16 @@ store_in_conf() {
sed -i "s|^${1}=.*$|$1=${!1}|g" "$configFile"
}

## Check openhabian.conf against openhabian.conf.dist for need to add parameters
## Check openhabian.conf against build-image/openhabian.conf for need to add parameters
## Add a parameter if it's missing or keep it if user provided.
## Cycling through openhabian.conf.dist will ensure all current and future params are checked for
## Cycling through build-image/openhabian.conf will ensure all current and future params are checked for
## Run on every start (to ensure params are up to date at any time)
##
## update_openhabian_conf()
##
update_openhabian_conf() {
local configFile="/etc/openhabian.conf"
local referenceConfig="/opt/openhabian/openhabian.conf.dist"
local referenceConfig="/opt/openhabian/build-image/openhabian.conf"

cp $configFile ${configFile}.BAK
while read -r line; do
Expand Down
4 changes: 2 additions & 2 deletions functions/packages.bash
Expand Up @@ -82,11 +82,11 @@ firemotd_setup() {

echo -n "$(timestamp) [openHABian] Setting up FireMotD apt updates count service... "
cond_echo "\\nMake FireMotD check for new updates every night... "
if ! cond_redirect install -m 644 "${BASEDIR:-/opt/openhabian}"/includes/firemotd.* "$targetDir"; then echo "FAILED (install service/timer)"; return 1; fi
if ! cond_redirect install -m 644 "${BASEDIR:-/opt/openhabian}"/includes/firemotd/firemotd.* "$targetDir"; then echo "FAILED (install service/timer)"; return 1; fi
if ! cond_redirect systemctl -q daemon-reload &> /dev/null; then echo "FAILED (daemon-reload)"; return 1; fi
if ! cond_redirect systemctl enable --now firemotd.timer &> /dev/null; then echo "FAILED (service enable)"; return 1; fi
cond_echo "\\nMake FireMotD check for new updates after using apt... "
if ! cond_redirect install -m 644 "${BASEDIR:-/opt/openhabian}"/includes/15firemotd /etc/apt/apt.conf.d/; then echo "FAILED (apt configuration)"; return 1; fi
if ! cond_redirect install -m 644 "${BASEDIR:-/opt/openhabian}"/includes/firemotd/15firemotd /etc/apt/apt.conf.d/; then echo "FAILED (apt configuration)"; return 1; fi
cond_echo "\\nInitial FireMotD updates check"
if cond_redirect FireMotD -S; then echo "OK"; else echo "FAILED"; return 1; fi
}
Expand Down
8 changes: 4 additions & 4 deletions functions/system.bash
Expand Up @@ -120,7 +120,7 @@ setup_ntp() {

if [[ $1 == "enable" ]]; then
echo -n "$(timestamp) [openHABian] Enabling time synchronization using NTP... "
if ! cond_redirect cp "${BASEDIR:-/opt/openhabian}"/includes/50-timesyncd.conf /lib/dhcpcd/dhcpcd-hooks/; then echo "FAILED (copy)"; return 1; fi
if ! cond_redirect cp "${BASEDIR:-/opt/openhabian}"/includes/generic/50-timesyncd.conf /lib/dhcpcd/dhcpcd-hooks/; then echo "FAILED (copy)"; return 1; fi
if cond_redirect timedatectl set-ntp true; then echo "OK"; else echo "FAILED (enable)"; return 1; fi
elif [[ $1 == "disable" ]]; then
echo -n "$(timestamp) [openHABian] Disabling time synchronization using NTP... "
Expand Down Expand Up @@ -208,9 +208,9 @@ hostname_change() {
##
bashrc_copy() {
echo -n "$(timestamp) [openHABian] Adding slightly tuned bash configuration files to system... "
if ! cp "${BASEDIR:-/opt/openhabian}"/includes/bash.bashrc /etc/bash.bashrc; then echo "FAILED (user bashrc)"; return 1; fi
if ! cp "${BASEDIR:-/opt/openhabian}"/includes/bashrc-root /root/.bashrc; then echo "FAILED (root bashrc)"; return 1; fi
if ! cp "${BASEDIR:-/opt/openhabian}"/includes/bash_profile /home/"${username:-openhabian}"/.bash_profile; then echo "FAILED (user bash_profile)"; return 1; fi
if ! cp "${BASEDIR:-/opt/openhabian}"/includes/generic/bash.bashrc /etc/bash.bashrc; then echo "FAILED (user bashrc)"; return 1; fi
if ! cp "${BASEDIR:-/opt/openhabian}"/includes/generic/bashrc-root /root/.bashrc; then echo "FAILED (root bashrc)"; return 1; fi
if ! cp "${BASEDIR:-/opt/openhabian}"/includes/generic/bash_profile /home/"${username:-openhabian}"/.bash_profile; then echo "FAILED (user bash_profile)"; return 1; fi
if chown "${username:-openhabian}:${username:-openhabian}" /home/"${username:-openhabian}"/.bash_profile; then echo "OK"; else echo "FAILED (permissions)"; return 1; fi
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion openhabian-setup.sh
Expand Up @@ -11,7 +11,7 @@

configFile="/etc/openhabian.conf"
if ! [[ -f $configFile ]]; then
cp /opt/openhabian/openhabian.conf.dist "$configFile"
cp /opt/openhabian/build-image/openhabian.conf "$configFile"
fi

# Find the absolute script location dir (e.g. BASEDIR=/opt/openhabian)
Expand Down
92 changes: 0 additions & 92 deletions openhabian.conf.dist

This file was deleted.

0 comments on commit 288de33

Please sign in to comment.