diff --git a/install.sh b/install.sh index b02a2a7..b987586 100755 --- a/install.sh +++ b/install.sh @@ -6,21 +6,26 @@ # get architecture arc=$(uname -m) +if [ ! -f "wordpress.conf" ]; then + cp openhab.conf.example openhab.conf -# create directories -mkdir -p data/conf -mkdir -p data/userdata -mkdir -p data/addons + # create directories + mkdir -p data/conf + mkdir -p data/userdata + mkdir -p data/addons -# replace uid and gid in config file -sed -i "/^OPENHAB_USER/c\\\OPENHAB_USER_ID=${uid}" openhab.conf + # replace uid and gid in config file + sed -i "/^OPENHAB_USER/c\\\OPENHAB_USER_ID=${uid}" openhab.conf -# replace architecture -if [[ $arc == "x86_64" ]]; then - sed -i "/^OPENHAB_ARCH=/c\\\OPENHAB_ARCH=amd64" openhab.conf -elif [[ $arc == *"armv"* ]]; then - sed -i "/^OPENHAB_ARCH=/c\\\OPENHAB_ARCH=armhf" openhab.conf + # replace architecture + if [[ $arc == "x86_64" ]]; then + sed -i "/^OPENHAB_ARCH=/c\\\OPENHAB_ARCH=amd64" openhab.conf + elif [[ $arc == *"armv"* ]]; then + sed -i "/^OPENHAB_ARCH=/c\\\OPENHAB_ARCH=armhf" openhab.conf + else + echo "unsupportet architecture" + exit 1 + fi else - echo "unsupportet architecture" - exit 1 + echo "Config already exists!" fi diff --git a/openhab.conf b/openhab.conf deleted file mode 100644 index 71ecd8c..0000000 --- a/openhab.conf +++ /dev/null @@ -1,25 +0,0 @@ -# system architecture -# amd64, armhf, arm64 -# look at https://hub.docker.com/r/openhab/openhab/ for more details -OPENHAB_ARCH=amd64 - -# user configuration -# http://docs.openhab.org/installation/docker.html -# please add user like UID:GID -OPENHAB_USER_ID=1000 - -# network configuration -OPENHAB_HTTP_BIND=127.0.0.1 -OPENHAB_HTTP_PORT=8080 - -OPENHAB_HTTPS_BIND=127.0.0.1 -OPENHAB_HTTPS_PORT=8443 - -OPENHAB_OSGI_BIND=127.0.0.1 -OPENHAB_OSGI_PORT=5555 - -# timezone -TZ=Europe/Berlin - -# language -OPENHAB_LANG=de_DE.UTF-8 diff --git a/openhab.conf.example b/openhab.conf.example new file mode 100644 index 0000000..71ecd8c --- /dev/null +++ b/openhab.conf.example @@ -0,0 +1,25 @@ +# system architecture +# amd64, armhf, arm64 +# look at https://hub.docker.com/r/openhab/openhab/ for more details +OPENHAB_ARCH=amd64 + +# user configuration +# http://docs.openhab.org/installation/docker.html +# please add user like UID:GID +OPENHAB_USER_ID=1000 + +# network configuration +OPENHAB_HTTP_BIND=127.0.0.1 +OPENHAB_HTTP_PORT=8080 + +OPENHAB_HTTPS_BIND=127.0.0.1 +OPENHAB_HTTPS_PORT=8443 + +OPENHAB_OSGI_BIND=127.0.0.1 +OPENHAB_OSGI_PORT=5555 + +# timezone +TZ=Europe/Berlin + +# language +OPENHAB_LANG=de_DE.UTF-8