This commit is contained in:
Richard Sperry 2025-04-17 14:10:37 -07:00
parent 3752d1a730
commit 9b46b2a4be
5 changed files with 70 additions and 4 deletions

View file

@ -9,6 +9,7 @@
source "/etc/s6-overlay/s6-rc.d/paths.sh" source "/etc/s6-overlay/s6-rc.d/paths.sh"
run() { run() {
show_vars
setup_ssh setup_ssh
setup_zsh setup_zsh
setup_git setup_git
@ -16,6 +17,14 @@ run() {
exec_config_cmds exec_config_cmds
} }
show_vars() {
bashio::log.info "BASH VARS:"
set -o posix ; set | while IFS='' read -r line
do
bashio::log.info "$line"
done
}
setup_ssh() { setup_ssh() {
# Store SSH settings in add-on data folder # Store SSH settings in add-on data folder
if ! bashio::fs.directory_exists "${SSH_USER_PATH}"; then if ! bashio::fs.directory_exists "${SSH_USER_PATH}"; then

View file

@ -0,0 +1,52 @@
#!/usr/bin/env bash
# shellcheck source=./PATHS.sh
source "/etc/s6-overlay/s6-rc.d/paths.sh"
# Vars
ENABLE=false
PULL=true
openMQTT_git=https://github.com/1technophile/OpenMQTTGateway.git
openmqtt_src_files="$USER_CUSTOM_DIR"/OpenMQTTGateway
run (){
if [ "$ENABLE" = false ]; then
exit 0
fi
git_src
export -f mqtt_push
}
git_src() {
if [ ! -d "$openmqtt_src_files" ]; then
git clone "$openMQTT_git" "$openmqtt_src_files"|| bashio::log.warning "Failed to git clone"
else
if [ "$PULL" = true ]; then
cd "$openmqtt_src_files" || bashio::log.warning "Failed to change dir to $openmqtt_src_files"
git pull || bashio::log.warning "Failed to git pull"
cd "$CUSTOM_BASH_SCRIPTS_PATH" || "Failed to change dir back to boot scripts root"
fi
fi
}
mqtt_push() {
local reason=${1}
if test "$#" -ne 1; then
echo "Error: You must provide exactly 1 arguments."
exit 1
fi
cd "$openmqtt_src_files" || bashio::log.warning "Failed to change dir to $openmqtt_src_files"
git git add .
git commit -m "$reason"
git push
cd "$CUSTOM_BASH_SCRIPTS_PATH" || "Failed to change dir back to boot scripts root"
}
run

View file

@ -6,6 +6,7 @@ cert: false
disable-getting-started-override: true disable-getting-started-override: true
disable-update-check: true disable-update-check: true
disable-telemetry: true disable-telemetry: true
user-data-dir: "/config/addon_configs/vscode" # /data is persistant storage on the HA host
extensions-dir: "/var/lib/code-server/config/" user-data-dir: "/data/vscode/user"
extensions-dir: "/data/vscode/extensions"
log: warn log: warn

View file

@ -6,4 +6,8 @@ This directory is for shell scripts to be ran at boot time so you can add functi
## custom-template.sh ## custom-template.sh
This script is an example of a script that has an on/off switch that can allow you to add extra functionality when needed. To run it, This script is an example of a script that has an on/off switch that can allow you to add extra functionality when needed. To run it,
change ENABLED to true and restart the VS Code server instance. change ENABLE to true and restart the VS Code server instance.
## PATHS.sh
This shows all paths used at boot time. USER_CUSTOM_DIR is for storage of build sources, etc.

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
ENABLE=false ENABLE=false
# shellcheck source=../paths.sh # shellcheck source=./PATHS.sh
source "/etc/s6-overlay/s6-rc.d/paths.sh" source "/etc/s6-overlay/s6-rc.d/paths.sh"
if [ "$ENABLE" = true ]; then if [ "$ENABLE" = true ]; then