From 8a5e3a647b17e5cebcc1ff2cf2d2cbdd1c4cd1a8 Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Sun, 10 Aug 2025 19:07:45 +0200 Subject: [PATCH] Initial smarthome collection setup --- .gitmodules | 30 +++++++++++++ Makefile | 103 ++++++++++++++++++++++++++++++++++++++++++++ ambient_info | 1 + bt-audio | 1 + home_emulation | 1 + leyk | 1 + mpd | 1 + powerplug-energenie | 1 + remote_control | 1 + smart_brain | 1 + smart_brain_test | 1 + spotify | 1 + 12 files changed, 143 insertions(+) create mode 100644 .gitmodules create mode 100644 Makefile create mode 160000 ambient_info create mode 160000 bt-audio create mode 160000 home_emulation create mode 160000 leyk create mode 160000 mpd create mode 160000 powerplug-energenie create mode 160000 remote_control create mode 160000 smart_brain create mode 160000 smart_brain_test create mode 160000 spotify diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7c96a6c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,30 @@ +[submodule "ambient_info"] + path = ambient_info + url = https://git.mount-mockery.de/smarthome/ambient_info.git +[submodule "bt-audio"] + path = bt-audio + url = https://git.mount-mockery.de/smarthome/bt-audio.git +[submodule "home_emulation"] + path = home_emulation + url = https://git.mount-mockery.de/smarthome/home_emulation.git +[submodule "leyk"] + path = leyk + url = https://git.mount-mockery.de/smarthome/leyk.git +[submodule "mpd"] + path = mpd + url = https://git.mount-mockery.de/smarthome/mpd.git +[submodule "powerplug-energenie"] + path = powerplug-energenie + url = https://git.mount-mockery.de/smarthome/powerplug-energenie.git +[submodule "remote_control"] + path = remote_control + url = https://git.mount-mockery.de/smarthome/remote_control.git +[submodule "smart_brain"] + path = smart_brain + url = https://git.mount-mockery.de/smarthome/smart_brain.git +[submodule "smart_brain_test"] + path = smart_brain_test + url = https://git.mount-mockery.de/smarthome/smart_brain_test.git +[submodule "spotify"] + path = spotify + url = https://git.mount-mockery.de/smarthome/spotify.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a2417f5 --- /dev/null +++ b/Makefile @@ -0,0 +1,103 @@ +# git helper Makefile: Version 2.2 (2025-08-10) +default: help + +.ONESHELL: +SHELL = /usr/bin/bash +MAKEFLAGS += --no-print-directory +.SILENT: + +-include __make.d__/*.mk + +GIT_FLAG = ./.git +VENV_FLAG = ./.venv_required +VENV_FOLDER = ./venv + +localhelp: + +help: + echo "Possible common options are:" + echo " - init - Initialise the repository and all folders below with a Makefile" + echo " - giti - Get the git status of all submodules including their submodules" + echo " - update_submodules - Set all submodules to remote master" + echo " - venv_flag - Set the venev flag for the base folder. A venv will be generated" + echo " - clean - clean up" + echo " - deepclean - clean up this and all Makefiles below" + $(MAKE) localhelp + echo "You are able to create files make.d/*.mk and add local rules there. " + echo " - localinit: print_head - Will be executed as last step in the init process." + echo " - localhelp: print_head - Will be executed in th middle of the help text generation" + echo " - localclean:print_head - Will be executed before the clean rule" + +localinit: + +init: print_head + # Init git repo + if [[ -e $(GIT_FLAG) ]]; then + echo -e "\033[1;33mInitialising git submodules...\e[0m" + git submodule init + git submodule update + fi + # Init submodules + SUBDIRS=$$(find . -maxdepth 2 -mindepth 2 -name Makefile | sort) + for subdir in $$SUBDIRS; do + $(MAKE) --no-print-directory -C $$(dirname $$subdir) init + done + if [[ $$SUBDIRS ]]; then + $(MAKE) print_head + fi + # Create venv if needed + if [[ -e $(VENV_FLAG) ]]; then + if [[ ! -e $(VENV_FOLDER) ]]; then + echo -e "\033[1;33mCreating virtual env...\e[0m" + mkvenv + fi + fi + # Start local init + echo -e "\033[1;33mDoing localinit...\e[0m" + $(MAKE) localinit + +update_submodules: + git submodule foreach "git fetch && git checkout master && git pull && git submodule init && git submodule update" + +giti_this: print_head + giti + echo " Submodules:" + git submodule --quiet foreach "echo -n ' ' && giti" + +giti: + git submodule --quiet foreach "[ -e Makefile ] && make --no-print-directory giti_this || :" + +localclean: + +clean: localclean + if [[ ! -e $(VENV_FLAG) ]]; then + if [[ -d $(VENV_FOLDER) ]]; then + rm -rf $(VENV_FOLDER) + fi + fi + +cleanall: clean + for subdir in $$(find . -maxdepth 2 -mindepth 2 -name Makefile | sort); do + $(MAKE) --no-print-directory -C $$(dirname $$subdir) cleanall + done + + +venv_flag: + if [[ ! -e $(VENV_FLAG) ]]; then + touch $(VENV_FLAG) + if [[ -e $(GIT_FLAG) ]]; then + git add $(VENV_FLAG) + fi + fi + +print_head: + DIRNAME=$$(basename $$(pwd)) + DIRLENGTH=$${#DIRNAME} + echo -ne "\n\n\033[1;34m╔═" + for i in $$(seq 1 $$DIRLENGTH); do echo -n "═"; done + echo -e "═╗" + echo -e "║ $$DIRNAME ║" + echo -ne "╚═" + for i in $$(seq 1 $$DIRLENGTH); do echo -n "═"; done + echo -e "═╝\033[00m" + diff --git a/ambient_info b/ambient_info new file mode 160000 index 0000000..2021a0f --- /dev/null +++ b/ambient_info @@ -0,0 +1 @@ +Subproject commit 2021a0f5bb2fba4d7349a0eba0c41b9880146df5 diff --git a/bt-audio b/bt-audio new file mode 160000 index 0000000..d8b8b7d --- /dev/null +++ b/bt-audio @@ -0,0 +1 @@ +Subproject commit d8b8b7d9ff4b74c74204b224e6804bf0a36f08c1 diff --git a/home_emulation b/home_emulation new file mode 160000 index 0000000..7053173 --- /dev/null +++ b/home_emulation @@ -0,0 +1 @@ +Subproject commit 7053173e871c4f3c057935aa6c0c540a0a6861ea diff --git a/leyk b/leyk new file mode 160000 index 0000000..dfc9b86 --- /dev/null +++ b/leyk @@ -0,0 +1 @@ +Subproject commit dfc9b8687f5506127b0728098579c0da6cff1a88 diff --git a/mpd b/mpd new file mode 160000 index 0000000..f85fbcf --- /dev/null +++ b/mpd @@ -0,0 +1 @@ +Subproject commit f85fbcff40a247a343128b25e1f7494b8baadd14 diff --git a/powerplug-energenie b/powerplug-energenie new file mode 160000 index 0000000..6913de7 --- /dev/null +++ b/powerplug-energenie @@ -0,0 +1 @@ +Subproject commit 6913de74df5e082d98005823d24c39fea61d0e4f diff --git a/remote_control b/remote_control new file mode 160000 index 0000000..04b589a --- /dev/null +++ b/remote_control @@ -0,0 +1 @@ +Subproject commit 04b589ac9034b7f0606b6b3cec043ea3451a9b6f diff --git a/smart_brain b/smart_brain new file mode 160000 index 0000000..23a7f83 --- /dev/null +++ b/smart_brain @@ -0,0 +1 @@ +Subproject commit 23a7f8333d66a922561bc07d9b75ce7297ce35d9 diff --git a/smart_brain_test b/smart_brain_test new file mode 160000 index 0000000..d538cba --- /dev/null +++ b/smart_brain_test @@ -0,0 +1 @@ +Subproject commit d538cba7e97a8da315b32f2e60f28eac3373b69b diff --git a/spotify b/spotify new file mode 160000 index 0000000..1cae13a --- /dev/null +++ b/spotify @@ -0,0 +1 @@ +Subproject commit 1cae13a47136d069954ac9255bd3e179d566ede9