mirror of
https://github.com/YunoHost-Apps/homeassistant_ynh.git
synced 2024-09-03 19:26:16 +02:00
Update
This commit is contained in:
parent
6c4ffa1e83
commit
d3dfc8b7d1
9 changed files with 123 additions and 59 deletions
|
@ -34,8 +34,8 @@ How to configure this app: From an admin panel
|
||||||
|
|
||||||
#### Multi-user support
|
#### Multi-user support
|
||||||
|
|
||||||
* Are LDAP and HTTP auth supported?
|
* Are LDAP and HTTP auth supported? LDAP=Yes | HTTP auth=No
|
||||||
* Can the app be used by multiple users?
|
* Can the app be used by multiple users? Yes
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
|
|
|
@ -2,30 +2,24 @@
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
|
; Actions
|
||||||
|
is_public=1|0
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
setup_root=1
|
setup_root=1
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
setup_private=0
|
setup_private=1
|
||||||
setup_public=0
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
upgrade=1 from_commit=b07405d0f885f28764031dd80d27af84a90007b1
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
incorrect_path=0
|
|
||||||
port_already_use=1
|
port_already_use=1
|
||||||
change_url=0
|
change_url=1
|
||||||
|
actions=1
|
||||||
|
config_panel=0
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 5=auto
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
Level 4=na
|
|
||||||
Level 5=1
|
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Notification=all
|
||||||
Notification=none
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ PKG_DEPENDENCIES="python3 python3-dev python3-venv python3-pip libffi-dev libssl
|
||||||
|
|
||||||
# Requirements (Major.Minor.Patch)
|
# Requirements (Major.Minor.Patch)
|
||||||
# PY_VERSION=$(curl -s "https://www.python.org/ftp/python/" | grep ">3.8" | tail -n1 | cut -d '/' -f 2 | cut -d '>' -f 2)
|
# PY_VERSION=$(curl -s "https://www.python.org/ftp/python/" | grep ">3.8" | tail -n1 | cut -d '/' -f 2 | cut -d '>' -f 2)
|
||||||
PY_VERSION=3.8.6
|
PY_REQUIRED_VERSION=3.8.6
|
||||||
|
|
||||||
# Execute a command as another user
|
# Execute a command as another user
|
||||||
# usage: exec_as USER COMMAND [ARG ...]
|
# usage: exec_as USER COMMAND [ARG ...]
|
||||||
|
@ -56,7 +56,16 @@ myynh_version_compare () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Package dependencies
|
# Package dependencies
|
||||||
|
# usage: myynh_install_dependencies --python="3.8.6"
|
||||||
|
# | arg: -p, --python= - the python version to install
|
||||||
myynh_install_dependencies () {
|
myynh_install_dependencies () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=u
|
||||||
|
local -A args_array=( [p]=python= )
|
||||||
|
local python
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
# Install main dependencies from apt
|
# Install main dependencies from apt
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
ynh_install_app_dependencies "${PKG_DEPENDENCIES}"
|
ynh_install_app_dependencies "${PKG_DEPENDENCIES}"
|
||||||
|
@ -65,15 +74,15 @@ myynh_install_dependencies () {
|
||||||
local PY_APT_VERSION=$(python3 --version | cut -d ' ' -f 2)
|
local PY_APT_VERSION=$(python3 --version | cut -d ' ' -f 2)
|
||||||
|
|
||||||
# Check existing built version of python in /usr/local/bin
|
# Check existing built version of python in /usr/local/bin
|
||||||
if [ -e "/usr/local/bin/python${PY_VERSION:0:3}" ]; then
|
if [ -e "/usr/local/bin/python${python:0:3}" ]; then
|
||||||
local PY_BUILT_VERSION=$(/usr/local/bin/python${PY_VERSION:0:3} --version \
|
local PY_BUILT_VERSION=$(/usr/local/bin/python${python:0:3} --version \
|
||||||
| cut -d ' ' -f 2)
|
| cut -d ' ' -f 2)
|
||||||
else
|
else
|
||||||
local PY_BUILT_VERSION=0
|
local PY_BUILT_VERSION=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compare version
|
# Compare version
|
||||||
if [ $(myynh_version_compare $PY_APT_VERSION $PY_VERSION) -le 1 ]; then
|
if [ $(myynh_version_compare $PY_APT_VERSION $python) -le 1 ]; then
|
||||||
# APT >= Required
|
# APT >= Required
|
||||||
ynh_script_progression --message="Using provided python3..."
|
ynh_script_progression --message="Using provided python3..."
|
||||||
MY_PYTHON="python3"
|
MY_PYTHON="python3"
|
||||||
|
@ -82,31 +91,37 @@ myynh_install_dependencies () {
|
||||||
ynh_script_progression --message="Installing additional dependencies..."
|
ynh_script_progression --message="Installing additional dependencies..."
|
||||||
PKG_DEPENDENCIES="${PKG_DEPENDENCIES} tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libbz2-dev libexpat1-dev liblzma-dev wget tar"
|
PKG_DEPENDENCIES="${PKG_DEPENDENCIES} tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libbz2-dev libexpat1-dev liblzma-dev wget tar"
|
||||||
ynh_install_app_dependencies "${PKG_DEPENDENCIES}"
|
ynh_install_app_dependencies "${PKG_DEPENDENCIES}"
|
||||||
if [ $(myynh_version_compare $PY_BUILT_VERSION $PY_VERSION) -le 1 ]; then
|
if [ $(myynh_version_compare $PY_BUILT_VERSION $python) -le 1 ]; then
|
||||||
# Built >= Required
|
# Built >= Required
|
||||||
ynh_script_progression --message="Using already used python3 built version..."
|
ynh_script_progression --message="Using already used python3 built version..."
|
||||||
MY_PYTHON="/usr/local/bin/python${PY_BUILT_VERSION:0:3}"
|
MY_PYTHON="/usr/local/bin/python${PY_BUILT_VERSION:0:3}"
|
||||||
else
|
else
|
||||||
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
|
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
|
||||||
ynh_script_progression --message="Building python (may take a while)..."
|
ynh_script_progression --message="Building python (may take a while)..."
|
||||||
|
# Store current direcotry
|
||||||
|
local MY_DIR=$(pwd)
|
||||||
# Download
|
# Download
|
||||||
wget -O "/tmp/Python-$PY_VERSION.tar.xz" "https://www.python.org/ftp/python/$PY_VERSION/Python-$PY_VERSION.tar.xz"
|
wget -O "/tmp/Python-$python.tar.xz" "https://www.python.org/ftp/python/$python/Python-$python.tar.xz"
|
||||||
# Extract
|
# Extract
|
||||||
cd /tmp
|
cd /tmp
|
||||||
tar xf "Python-$PY_VERSION.tar.xz"
|
tar xf "Python-$python.tar.xz"
|
||||||
# Install
|
# Install
|
||||||
cd "Python-$PY_VERSION"
|
cd "Python-$python"
|
||||||
./configure --enable-optimizations
|
./configure --enable-optimizations
|
||||||
make -j4
|
make -j4
|
||||||
make altinstall
|
make altinstall
|
||||||
# Clean
|
# Clean
|
||||||
cd ..
|
cd ..
|
||||||
ynh_secure_remove "Python-$PY_VERSION"
|
ynh_secure_remove "Python-$python"
|
||||||
ynh_secure_remove "Python-$PY_VERSION.tar.xz"
|
ynh_secure_remove "Python-$python.tar.xz"
|
||||||
# Set version
|
# Set version
|
||||||
MY_PYTHON="/usr/local/bin/python${PY_VERSION:0:3}"
|
MY_PYTHON="/usr/local/bin/python${python:0:3}"
|
||||||
|
# Go back to working directory
|
||||||
|
cd $MY_DIR
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Save python version in settings
|
||||||
|
ynh_app_setting_set $app python "$python"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install/Upgrade Homeassistant in virtual environement
|
# Install/Upgrade Homeassistant in virtual environement
|
||||||
|
|
|
@ -10,7 +10,7 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
# retrieve arguments
|
# retrieve arguments
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
|
|
||||||
# definie useful vars
|
# definie useful vars
|
||||||
final_path="/opt/yunohost/$app"
|
final_path="/opt/yunohost/$app"
|
||||||
|
|
45
scripts/change_url
Normal file
45
scripts/change_url
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# retrieve arguments
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
|
new_domain=$YNH_APP_NEW_DOMAIN
|
||||||
|
|
||||||
|
# load settings
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
old_nginx_conf="/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
||||||
|
new_nginx_conf="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
|
# manage script failure
|
||||||
|
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
# check which parts should be changed
|
||||||
|
change_domain=0
|
||||||
|
if [ "$old_domain" != "$new_domain" ]; then
|
||||||
|
change_domain=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Change the domain for nginx
|
||||||
|
if [ $change_domain -eq 1 ]; then
|
||||||
|
ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1
|
||||||
|
# Delete file checksum for the old conf file location
|
||||||
|
ynh_delete_file_checksum --file="$old_nginx_conf"
|
||||||
|
mv "$old_nginx_conf" "$new_nginx_conf"
|
||||||
|
# Store file checksum for the new config file location
|
||||||
|
ynh_store_file_checksum --file="$new_nginx_conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# reload nginx
|
||||||
|
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
|
@ -18,26 +18,26 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
final_path="/opt/yunohost/$app"
|
final_path="/opt/yunohost/$app"
|
||||||
home_path="/home/$app"
|
home_path="/home/$app"
|
||||||
data_path="/home/$app/.$app"
|
data_path="/home/$app/.$app"
|
||||||
|
path_url=$(ynh_normalize_url_path --path_url="/")
|
||||||
|
|
||||||
# check domain/path availability
|
# check domain/path availability
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
ynh_script_progression --message="Validating installation parameters..."
|
||||||
path_url=$(ynh_normalize_url_path "/")
|
[ ! -d "$final_path" ] || ynh_die --message="This path already contains a folder"
|
||||||
ynh_webpath_available "$domain" "$path_url" || ynh_die "$domain/$path_url is not available, please use an other domain."
|
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url"
|
||||||
ynh_webpath_register $app "$domain" "$path_url"
|
|
||||||
|
|
||||||
# save app settings
|
# save app settings
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
ynh_script_progression --message="Storing installation settings..."
|
||||||
ynh_app_setting_set $app domain "$domain"
|
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
||||||
|
|
||||||
# find a free port & open it
|
# find a free port & open it
|
||||||
ynh_script_progression --message="Looking for a free port and opening it..."
|
ynh_script_progression --message="Looking for a free port and opening it..."
|
||||||
port=$(ynh_find_port 8123)
|
port=$(ynh_find_port 8123)
|
||||||
ynh_app_setting_set $app port $port
|
ynh_app_setting_set --app="$app" --key=port --value="$port"
|
||||||
ynh_exec_fully_quiet yunohost firewall allow TCP $port
|
ynh_exec_fully_quiet yunohost firewall allow TCP "$port"
|
||||||
|
|
||||||
# create a dedicated system user
|
# create a dedicated system user
|
||||||
ynh_script_progression --message="Creating dedicated user, rights and folders..."
|
ynh_script_progression --message="Creating dedicated user, rights and folders..."
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create --username="$app"
|
||||||
## grant sudo permissions to the user to manage his own systemd service
|
## grant sudo permissions to the user to manage his own systemd service
|
||||||
myynh_create_dir "/etc/sudoers.d"
|
myynh_create_dir "/etc/sudoers.d"
|
||||||
cp "../conf/sudoers" "/etc/sudoers.d/$app"
|
cp "../conf/sudoers" "/etc/sudoers.d/$app"
|
||||||
|
@ -49,7 +49,7 @@ myynh_create_dir "$data_path"
|
||||||
chown -R $app: "$home_path"
|
chown -R $app: "$home_path"
|
||||||
|
|
||||||
# build (if needed) & install Pyhton
|
# build (if needed) & install Pyhton
|
||||||
myynh_install_dependencies
|
myynh_install_dependencies --python="$PY_REQUIRED_VERSION"
|
||||||
|
|
||||||
# installation in a virtual environment
|
# installation in a virtual environment
|
||||||
ynh_script_progression --message="Installing Home Assistant in a virtual environment..."
|
ynh_script_progression --message="Installing Home Assistant in a virtual environment..."
|
||||||
|
@ -57,7 +57,7 @@ myynh_install_homeassistant
|
||||||
|
|
||||||
# set default configuration files and move all homeassistant_conf_files
|
# set default configuration files and move all homeassistant_conf_files
|
||||||
ynh_script_progression --message="Configuring the installation..."
|
ynh_script_progression --message="Configuring the installation..."
|
||||||
ynh_replace_string "__PORT__" "$port" "../conf/homeassistant_conf_files/configuration.yaml"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/homeassistant_conf_files/configuration.yaml"
|
||||||
cp -r "../conf/homeassistant_conf_files/." "$data_path/"
|
cp -r "../conf/homeassistant_conf_files/." "$data_path/"
|
||||||
chown -R $app: "$data_path"
|
chown -R $app: "$data_path"
|
||||||
chmod -R +x "$data_path/bin/"
|
chmod -R +x "$data_path/bin/"
|
||||||
|
@ -72,7 +72,7 @@ yunohost service add "$app@$app" --log "$data_path/home-assistant.log" --descrip
|
||||||
ynh_script_progression --message="Starting the Home Assistant server..."
|
ynh_script_progression --message="Starting the Home Assistant server..."
|
||||||
ynh_systemd_action --service_name="$app@$app" --action=start --line_match="Home Assistant initialized" --log_path="systemd" --timeout=3600
|
ynh_systemd_action --service_name="$app@$app" --action=start --line_match="Home Assistant initialized" --log_path="systemd" --timeout=3600
|
||||||
# remove --verbose from service
|
# remove --verbose from service
|
||||||
ynh_replace_string " --verbose" "" "/etc/systemd/system/$app@$app.service"
|
ynh_replace_string --match_string=" --verbose" --replace_string="" --target_file="/etc/systemd/system/$app@$app.service"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
ynh_systemd_action --service_name="$app@$app" --action=restart
|
ynh_systemd_action --service_name="$app@$app" --action=restart
|
||||||
|
|
||||||
|
@ -84,6 +84,6 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
# unprotect app access if public (needed for Android app to work)
|
# unprotect app access if public (needed for Android app to work)
|
||||||
ynh_script_progression --message="Configuring permissions..."
|
ynh_script_progression --message="Configuring permissions..."
|
||||||
[ $is_public -eq 1 ] && ynh_permission_update --permission "main" --add "visitors"
|
[ $is_public -eq 1 ] && ynh_permission_update --permission="main" --add="visitors"
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -40,7 +40,7 @@ ynh_secure_remove --file="/etc/systemd/system/$app@$app.service"
|
||||||
ynh_exec_fully_quiet yunohost firewall disallow TCP $port
|
ynh_exec_fully_quiet yunohost firewall disallow TCP $port
|
||||||
|
|
||||||
# delete a system user
|
# delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
ynh_system_user_delete --username="$app"
|
||||||
|
|
||||||
# remove sudoers file
|
# remove sudoers file
|
||||||
ynh_secure_remove --file="/etc/sudoers.d/$app"
|
ynh_secure_remove --file="/etc/sudoers.d/$app"
|
||||||
|
|
|
@ -15,20 +15,18 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
# retrieve arguments
|
# retrieve arguments
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
|
|
||||||
# definie useful vars
|
# definie useful vars
|
||||||
final_path="/opt/yunohost/$app"
|
final_path="/opt/yunohost/$app"
|
||||||
home_path="/home/$app"
|
home_path="/home/$app"
|
||||||
data_path="/home/$app/.$app"
|
data_path="/home/$app/.$app"
|
||||||
|
path_url=$(ynh_normalize_url_path --path_url="/")
|
||||||
|
|
||||||
# check domain/path availability
|
# check domain/path availability
|
||||||
path_url=$(ynh_normalize_url_path "/")
|
[ ! -d "$final_path" ] || ynh_die --message="This path already contains a folder"
|
||||||
ynh_webpath_available $domain $path_url || ynh_die "$domain/$path_url is not available, please use an other domain."
|
ynh_webpath_available --domain="$domain" --path_url="$path_url" || ynh_die "$domain/$path_url is not available, please use an other domain."
|
||||||
|
|
||||||
# add required packages
|
|
||||||
myynh_install_dependencies
|
|
||||||
|
|
||||||
# restore dedicated system user
|
# restore dedicated system user
|
||||||
ynh_system_user_create --username="$app"
|
ynh_system_user_create --username="$app"
|
||||||
|
@ -41,6 +39,9 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app@$app.service"
|
||||||
# restore source
|
# restore source
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
|
# add required packages
|
||||||
|
myynh_install_dependencies --python=$("$final_path/bin/python" --version | cut -d ' ' -f 2)
|
||||||
|
|
||||||
# restore data
|
# restore data
|
||||||
ynh_restore_file --origin_path="$home_path"
|
ynh_restore_file --origin_path="$home_path"
|
||||||
chown -R $app: "$home_path"
|
chown -R $app: "$home_path"
|
||||||
|
@ -53,8 +54,17 @@ ynh_exec_fully_quiet yunohost firewall allow TCP $port
|
||||||
# add service in admin panel
|
# add service in admin panel
|
||||||
yunohost service add "$app@$app" --log "$data_path/home-assistant.log" --description "Home Assistant server" --needs_exposed_ports $port
|
yunohost service add "$app@$app" --log "$data_path/home-assistant.log" --description "Home Assistant server" --needs_exposed_ports $port
|
||||||
|
|
||||||
# start systemd service
|
|
||||||
ynh_systemd_action --service_name="$app@$app" --action=start
|
# add --verbose to service
|
||||||
|
sed --in-place "/ExecStart/s/$/ --verbose/" "/etc/systemd/system/$app@$app.service"
|
||||||
|
|
||||||
|
# start
|
||||||
|
ynh_systemd_action --service_name="$app@$app" --action=start --line_match="Home Assistant initialized" --log_path="systemd" --timeout=3600
|
||||||
|
|
||||||
|
# remove --verbose from service and restart
|
||||||
|
ynh_replace_string --match_string=" --verbose" --replace_string="" --target_file="/etc/systemd/system/$app@$app.service"
|
||||||
|
systemctl daemon-reload
|
||||||
|
ynh_systemd_action --service_name="$app@$app" --action=restart
|
||||||
|
|
||||||
# reload nginx
|
# reload nginx
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
|
@ -11,15 +11,15 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
# retrieve arguments
|
# retrieve arguments
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
ynh_script_progression --message="Cleaning legacy permissions..."
|
ynh_script_progression --message="Cleaning legacy permissions..."
|
||||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
|
||||||
if [ -n "$is_public" ]; then
|
if [ -n "$is_public" ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app="$app" --key=is_public
|
||||||
ynh_app_setting_delete --app=$app --key=unprotected_uris
|
ynh_app_setting_delete --app="$app" --key=unprotected_uris
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# definie useful vars
|
# definie useful vars
|
||||||
|
@ -42,7 +42,7 @@ myynh_create_dir "/etc/sudoers.d"
|
||||||
cp "../conf/sudoers" "/etc/sudoers.d/$app"
|
cp "../conf/sudoers" "/etc/sudoers.d/$app"
|
||||||
|
|
||||||
# build (if needed) & install Pyhton
|
# build (if needed) & install Pyhton
|
||||||
myynh_install_dependencies
|
myynh_install_dependencies --python="$PY_REQUIRED_VERSION"
|
||||||
|
|
||||||
# stop systemd service
|
# stop systemd service
|
||||||
ynh_script_progression --message="Stoping service..."
|
ynh_script_progression --message="Stoping service..."
|
||||||
|
@ -68,7 +68,7 @@ yunohost service add "$app@$app" --log "$data_path/home-assistant.log" --descrip
|
||||||
ynh_script_progression --message="Starting the Home Assistant server..."
|
ynh_script_progression --message="Starting the Home Assistant server..."
|
||||||
ynh_systemd_action --service_name="$app@$app" --action=start --line_match="Home Assistant initialized" --log_path="systemd" --timeout=3600
|
ynh_systemd_action --service_name="$app@$app" --action=start --line_match="Home Assistant initialized" --log_path="systemd" --timeout=3600
|
||||||
# remove --verbose from service
|
# remove --verbose from service
|
||||||
ynh_replace_string " --verbose" "" "/etc/systemd/system/$app@$app.service"
|
ynh_replace_string --match_string=" --verbose" --replace_string="" --target_file="/etc/systemd/system/$app@$app.service"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
ynh_systemd_action --service_name="$app@$app" --action=restart
|
ynh_systemd_action --service_name="$app@$app" --action=restart
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue