mirror of
https://github.com/YunoHost-Apps/homeassistant_ynh.git
synced 2024-09-03 19:26:16 +02:00
Fix
This commit is contained in:
parent
8b2a3b9fd7
commit
cffb4a63ef
2 changed files with 5 additions and 14 deletions
|
@ -13,19 +13,6 @@ PKG_DEPENDENCIES="python3 python3-dev python3-venv python3-pip libffi-dev libssl
|
||||||
# Pyhton 3.9.2 will be shiped with bullseye
|
# Pyhton 3.9.2 will be shiped with bullseye
|
||||||
PY_REQUIRED_VERSION=3.9.2
|
PY_REQUIRED_VERSION=3.9.2
|
||||||
|
|
||||||
# Execute a command as another user
|
|
||||||
# usage: exec_as USER COMMAND [ARG ...]
|
|
||||||
exec_as() {
|
|
||||||
local USER=$1
|
|
||||||
shift 1
|
|
||||||
|
|
||||||
if [[ $USER = $(whoami) ]]; then
|
|
||||||
eval "$@"
|
|
||||||
else
|
|
||||||
sudo -u "$USER" "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if directory/file already exists (path in argument)
|
# Check if directory/file already exists (path in argument)
|
||||||
myynh_check_path () {
|
myynh_check_path () {
|
||||||
[ -z "$1" ] && ynh_die "No argument supplied"
|
[ -z "$1" ] && ynh_die "No argument supplied"
|
||||||
|
@ -146,7 +133,7 @@ myynh_install_homeassistant () {
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
exec_as $app -H -s /bin/bash -c " \
|
ynh_exec_as $app -H -s /bin/bash -c " \
|
||||||
echo 'create the virtual environment' \
|
echo 'create the virtual environment' \
|
||||||
&& $MY_PYTHON -m venv "$final_path" \
|
&& $MY_PYTHON -m venv "$final_path" \
|
||||||
&& echo 'activate the virtual environment' \
|
&& echo 'activate the virtual environment' \
|
||||||
|
|
|
@ -67,7 +67,9 @@ 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..."
|
||||||
|
ynh_print_info --message="$(whoami)"
|
||||||
ynh_exec_fully_quiet myynh_install_homeassistant --path="$data_path"
|
ynh_exec_fully_quiet myynh_install_homeassistant --path="$data_path"
|
||||||
|
ynh_print_info --message="$(whoami)"
|
||||||
|
|
||||||
# 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..."
|
||||||
|
@ -77,12 +79,14 @@ ynh_replace_string --match_string="__DATAPATH__" --replace_string="$data_path" -
|
||||||
cp -r "../conf/homeassistant_conf_files/." "$data_path/.$app/"
|
cp -r "../conf/homeassistant_conf_files/." "$data_path/.$app/"
|
||||||
chown -R $app: "$data_path/.$app"
|
chown -R $app: "$data_path/.$app"
|
||||||
chmod -R +x "$data_path/.$app/bin/"
|
chmod -R +x "$data_path/.$app/bin/"
|
||||||
|
ynh_print_info --message="$(whoami)"
|
||||||
|
|
||||||
# setup up systemd service
|
# setup up systemd service
|
||||||
ynh_script_progression --message="Adding the dedicated service..."
|
ynh_script_progression --message="Adding the dedicated service..."
|
||||||
ynh_replace_string --match_string="__DATAPATH__" --replace_string="$data_path" --target_file="../conf/systemd.service"
|
ynh_replace_string --match_string="__DATAPATH__" --replace_string="$data_path" --target_file="../conf/systemd.service"
|
||||||
ynh_replace_string --match_string="__LOGFILE__" --replace_string="$log_file" --target_file="../conf/systemd.service"
|
ynh_replace_string --match_string="__LOGFILE__" --replace_string="$log_file" --target_file="../conf/systemd.service"
|
||||||
ynh_add_systemd_config --service="$app"
|
ynh_add_systemd_config --service="$app"
|
||||||
|
ynh_print_info --message="$(whoami)"
|
||||||
|
|
||||||
## add service in admin panel
|
## add service in admin panel
|
||||||
yunohost service add "$app" --log "$log_file" --description "Home Assistant server" --needs_exposed_ports $port
|
yunohost service add "$app" --log "$log_file" --description "Home Assistant server" --needs_exposed_ports $port
|
||||||
|
|
Loading…
Add table
Reference in a new issue