This commit is contained in:
Richard Sperry 2025-04-15 20:59:04 -07:00
parent 8b733268ba
commit e406bbbce5
2 changed files with 30 additions and 29 deletions

View file

@ -8,6 +8,7 @@ codenotary: codenotary@frenck.dev
ingress: true ingress: true
ingress_port: 1337 ingress_port: 1337
ingress_stream: true ingress_stream: true
panel_admin: true
panel_icon: mdi:microsoft-visual-studio-code panel_icon: mdi:microsoft-visual-studio-code
startup: services startup: services
init: false init: false

View file

@ -12,69 +12,69 @@ readonly ZSH_HISTORY_PERSISTANT_FILE=/data/.zsh_history
# Links some common directories to the user's home folder for convenience # Links some common directories to the user's home folder for convenience
for dir in "${DIRECTORIES[@]}"; do for dir in "${DIRECTORIES[@]}"; do
ln -sn "/${dir}" "${HOME}/${dir}" \ ln -sn "/${dir}" "${HOME}/${dir}" ||
|| bashio::log.warning "Failed linking common directory: ${dir}" bashio::log.warning "Failed linking common directory: ${dir}"
done done
# Some links to old locations, to not mess with the user's muscle memory # Some links to old locations, to not mess with the user's muscle memory
ln -sn "/config" "${HOME}/config" \ # ln -sn "/config" "${HOME}/config" \
|| bashio::log.warning "Failed linking common directory: ${HOME}/config" # || bashio::log.warning "Failed linking common directory: ${HOME}/config"
ln -sn "/config" "/homeassistant" \ # ln -sn "/config" "/homeassistant" \
|| bashio::log.warning "Failed linking common directory: /homeassistant" # || bashio::log.warning "Failed linking common directory: /homeassistant"
# 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
mkdir -p "${SSH_USER_PATH}" \ mkdir -p "${SSH_USER_PATH}" ||
|| bashio::exit.nok 'Failed to create a persistent .ssh folder' bashio::exit.nok 'Failed to create a persistent .ssh folder'
chmod 700 "${SSH_USER_PATH}" \ chmod 700 "${SSH_USER_PATH}" ||
|| bashio::exit.nok \ bashio::exit.nok \
'Failed setting permissions on persistent .ssh folder' 'Failed setting permissions on persistent .ssh folder'
fi fi
ln -sn "${SSH_USER_PATH}" ~/.ssh || bashio::log.warning "Failed linking .ssh" ln -sn "${SSH_USER_PATH}" ~/.ssh || bashio::log.warning "Failed linking .ssh"
# Sets up ZSH shell # Sets up ZSH shell
touch "${ZSH_HISTORY_PERSISTANT_FILE}" \ touch "${ZSH_HISTORY_PERSISTANT_FILE}" ||
|| bashio::exit.nok 'Failed creating a persistent ZSH history file' bashio::exit.nok 'Failed creating a persistent ZSH history file'
chmod 600 "$ZSH_HISTORY_PERSISTANT_FILE" \ chmod 600 "$ZSH_HISTORY_PERSISTANT_FILE" ||
|| bashio::exit.nok \ bashio::exit.nok \
'Failed setting the correct permissions to the ZSH history file' 'Failed setting the correct permissions to the ZSH history file'
ln -s -f "$ZSH_HISTORY_PERSISTANT_FILE" "$ZSH_HISTORY_FILE" \ ln -s -f "$ZSH_HISTORY_PERSISTANT_FILE" "$ZSH_HISTORY_FILE" ||
|| bashio::exit.nok 'Failed linking the persistant ZSH history file' bashio::exit.nok 'Failed linking the persistant ZSH history file'
# Store user GIT settings in add-on data folder # Store user GIT settings in add-on data folder
if ! bashio::fs.directory_exists "${GIT_USER_PATH}"; then if ! bashio::fs.directory_exists "${GIT_USER_PATH}"; then
mkdir -p "${GIT_USER_PATH}" \ mkdir -p "${GIT_USER_PATH}" ||
|| bashio::exit.nok 'Failed to create a persistent git folder' bashio::exit.nok 'Failed to create a persistent git folder'
chmod 700 "${GIT_USER_PATH}" \ chmod 700 "${GIT_USER_PATH}" ||
|| bashio::exit.nok \ bashio::exit.nok \
'Failed setting permissions on persistent git folder' 'Failed setting permissions on persistent git folder'
fi fi
if ! bashio::fs.file_exists "${GIT_USER_PATH}/.gitconfig"; then if ! bashio::fs.file_exists "${GIT_USER_PATH}/.gitconfig"; then
touch "${GIT_USER_PATH}/.gitconfig" \ touch "${GIT_USER_PATH}/.gitconfig" ||
|| bashio::exit.nok 'Failed to create .gitconfig' bashio::exit.nok 'Failed to create .gitconfig'
fi fi
ln -s "${GIT_USER_PATH}/.gitconfig" ~/.gitconfig || bashio::log.warning "Failed linking .gitconfig" ln -s "${GIT_USER_PATH}/.gitconfig" ~/.gitconfig || bashio::log.warning "Failed linking .gitconfig"
# Install user configured/requested packages # Install user configured/requested packages
if bashio::config.has_value 'packages'; then if bashio::config.has_value 'packages'; then
apt update \ apt update ||
|| bashio::exit.nok 'Failed updating Ubuntu packages repository indexes' bashio::exit.nok 'Failed updating Ubuntu packages repository indexes'
for package in $(bashio::config 'packages'); do for package in $(bashio::config 'packages'); do
apt-get install -y "$package" \ apt-get install -y "$package" ||
|| bashio::exit.nok "Failed installing package ${package}" bashio::exit.nok "Failed installing package ${package}"
done done
fi fi
# Executes user configured/requested commands on startup # Executes user configured/requested commands on startup
if bashio::config.has_value 'init_commands'; then if bashio::config.has_value 'init_commands'; then
while read -r cmd; do while read -r cmd; do
eval "${cmd}" \ eval "${cmd}" ||
|| bashio::exit.nok "Failed executing init command: ${cmd}" bashio::exit.nok "Failed executing init command: ${cmd}"
done <<< "$(bashio::config 'init_commands')" done <<<"$(bashio::config 'init_commands')"
fi fi