mirror of
https://github.com/YunoHost-Apps/homeassistant_ynh.git
synced 2024-09-03 19:26:16 +02:00
Update to packaging v2
This commit is contained in:
parent
75a59d7e6c
commit
992c8941a5
13 changed files with 190 additions and 515 deletions
|
@ -1,27 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
is_public=1
|
||||
home="Home"
|
||||
latitude="32.87336"
|
||||
longitude="117.22743"
|
||||
elevation="430"
|
||||
unit_system="metric"
|
||||
currency="USD"
|
||||
country="US"
|
||||
time_zone="America/Los_Angeles"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=1
|
||||
change_url=1
|
||||
;;; Options
|
||||
Notification=all
|
||||
;;; Upgrade options
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
# define usefull variables
|
||||
app="homeassistant"
|
||||
final_path="/var/www/$app"
|
||||
data_path="/home/yunohost.app/$app"
|
||||
install_dir="/var/www/$app"
|
||||
data_dir="/home/yunohost.app/$app"
|
||||
|
||||
########## END OF CONFIGURATION ##########
|
||||
|
||||
|
@ -28,36 +28,32 @@ if [ ! -z "$DEBUG" ]; then
|
|||
fi
|
||||
|
||||
# upgrade the virtual environment
|
||||
MY_PYTHON=$(readlink -e "$final_path/bin/python")
|
||||
MY_PYTHON=$(readlink -e "$install_dir/bin/python")
|
||||
[ ! -z "$DEBUG" ] && log "Using pyhton '$MY_PYTHON'."
|
||||
$MY_PYTHON -m venv --upgrade "$final_path"
|
||||
$MY_PYTHON -m venv --upgrade "$install_dir"
|
||||
|
||||
# Run source in a 'sub shell'
|
||||
(
|
||||
# activate the virtual environment
|
||||
set +o nounset
|
||||
[ ! -z "$DEBUG" ] && log "Activate the virtual environment"
|
||||
source "$final_path/bin/activate"
|
||||
source "$install_dir/bin/activate"
|
||||
set -o nounset
|
||||
|
||||
# add pip
|
||||
[ ! -z "$DEBUG" ] && log "Upgrade pip"
|
||||
"$final_path/bin/python3" -m ensurepip --upgrade
|
||||
"$install_dir/bin/python3" -m ensurepip --upgrade
|
||||
|
||||
local VERBOSE
|
||||
[ ! -z "$DEBUG" ] && VERBOSE="--log $LOG_FILE"
|
||||
|
||||
# install last version of wheel
|
||||
[ ! -z "$DEBUG" ] && log "Install latest pip version of wheel"
|
||||
"$final_path/bin/pip3" --cache-dir "$data_path/.cache" install --upgrade wheel $VERBOSE
|
||||
|
||||
# install last version of mysqlclient
|
||||
[ ! -z "$DEBUG" ] && log "Install latest pip version of mysqlclient"
|
||||
"$final_path/bin/pip3" --cache-dir "$data_path/.cache" install --upgrade mysqlclient $VERBOSE
|
||||
# install last version of wheel, pip & mysqlclient
|
||||
[ ! -z "$DEBUG" ] && log "Install latest pip version of wheel, pip & mysqlclient"
|
||||
"$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade wheel pip mysqlclient $VERBOSE
|
||||
|
||||
# upgrade homeassistant python package
|
||||
[ ! -z "$DEBUG" ] && log "Install latest pip version of $app"
|
||||
"$final_path/bin/pip3" --cache-dir "$data_path/.cache" install --upgrade $app $VERBOSE
|
||||
"$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade $app $VERBOSE
|
||||
)
|
||||
|
||||
# restart homeassistant systemd service
|
||||
|
|
|
@ -10,7 +10,7 @@ homeassistant:
|
|||
external_url: "https://__DOMAIN__"
|
||||
auth_providers:
|
||||
- type: command_line
|
||||
command: __DATA_PATH__/bin/ynh_ldap-auth.sh
|
||||
command: __DATA_DIR__/bin/ynh_ldap-auth.sh
|
||||
meta: true
|
||||
|
||||
http:
|
||||
|
@ -36,5 +36,5 @@ switch:
|
|||
- platform: command_line
|
||||
switches:
|
||||
upgrade_homeassistant:
|
||||
command_on: "nohup bash -c __DATA_PATH__/bin/upgrade_homeassistant.sh $1 > /dev/null 2>&1 &"
|
||||
command_on: "nohup bash -c __DATA_DIR__/bin/upgrade_homeassistant.sh $1 > /dev/null 2>&1 &"
|
||||
friendly_name: Upgrade Home Assistant
|
||||
|
|
|
@ -5,8 +5,8 @@ After=network.target mysql.service
|
|||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
WorkingDirectory=__DATA_PATH__
|
||||
ExecStart=__FINALPATH__/bin/hass --config "__DATA_PATH__" --log-file "__LOG_FILE__" --verbose
|
||||
WorkingDirectory=__DATA_DIR__
|
||||
ExecStart=__INSTALL_DIR__/bin/hass --config "__DATA_DIR__" --log-file "__LOG_FILE__" --verbose
|
||||
RestartForceExitStatus=100
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
|
115
manifest.json
115
manifest.json
|
@ -1,115 +0,0 @@
|
|||
{
|
||||
"name": "Home Assistant",
|
||||
"id": "homeassistant",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Home automation platform",
|
||||
"fr": "Plateforme domotique"
|
||||
},
|
||||
"version": "2023.2.3~ynh1",
|
||||
"url": "https://github.com/home-assistant/home-assistant",
|
||||
"upstream": {
|
||||
"license": "Apache-2.0",
|
||||
"website": "https://www.home-assistant.io",
|
||||
"demo": "https://demo.home-assistant.io",
|
||||
"admindoc": "https://www.home-assistant.io/docs/",
|
||||
"code": "https://github.com/home-assistant/core"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"maintainer": {
|
||||
"name": "ewilly",
|
||||
"email": "ewilly@ewilly.fr"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.0.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
"en": "If not public, Smartphone app will not work",
|
||||
"fr": "Dans le cas contraire, l'application sur Smartphone ne fonctionnera pas"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "home",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Name of the location where Home Assistant is running."
|
||||
},
|
||||
"default": "Home"
|
||||
},
|
||||
{
|
||||
"name": "latitude",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Latitude of your location required to calculate the time the sun rises and sets--> https://www.openstreetmap.org"
|
||||
},
|
||||
"default": 32.87336
|
||||
},
|
||||
{
|
||||
"name": "longitude",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Longitude of your location required to calculate the time the sun rises and sets --> https://www.openstreetmap.org"
|
||||
},
|
||||
"default": 117.22743
|
||||
},
|
||||
{
|
||||
"name": "elevation",
|
||||
"type": "number",
|
||||
"ask": {
|
||||
"en": "Altitude above sea level in meters. Impacts sunrise data."
|
||||
},
|
||||
"default": 430
|
||||
},
|
||||
{
|
||||
"name": "unit_system",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "metric for Metric, us_customary for US Customary. This also sets temperature_unit, Celsius for Metric and Fahrenheit for US Customary."
|
||||
},
|
||||
"choices": [
|
||||
"metric",
|
||||
"us_customary"
|
||||
],
|
||||
"default": "metric"
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Pick your currency code from the column Code of Wikipedia’s list of ISO 4217 active codes --> https://en.wikipedia.org/wiki/ISO_4217#Active_codes"
|
||||
},
|
||||
"default": "USD"
|
||||
},
|
||||
{
|
||||
"name": "country",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Country in which Home Assistant is running. This may, for example, influence radio settings to comply with local regulations. The country should be specified as an ISO 3166.1 alpha-2 code. Pick your country from the column Code of Wikipedia’s list of ISO 31661 alpha-2 officially assigned code --> https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements"
|
||||
},
|
||||
"default": "US"
|
||||
},
|
||||
{
|
||||
"name": "time_zone",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Pick your time zone from the column TZ of Wikipedia’s list of tz database time zones --> https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"
|
||||
},
|
||||
"default": "America/Los_Angeles"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
87
manifest.toml
Normal file
87
manifest.toml
Normal file
|
@ -0,0 +1,87 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "homeassistant"
|
||||
name = "Home Assistant"
|
||||
description.en = "Home automation platform"
|
||||
description.fr = "Plateforme domotique"
|
||||
|
||||
version = "2023.2.3~ynh1"
|
||||
|
||||
maintainers = ["ewilly"]
|
||||
|
||||
[upstream]
|
||||
license = "Apache-2.0"
|
||||
website = "https://www.home-assistant.io"
|
||||
demo = "https://demo.home-assistant.io"
|
||||
admindoc = "https://www.home-assistant.io/docs/"
|
||||
code = "https://github.com/home-assistant/core"
|
||||
cpe = "cpe:2.3:a:home-assistant:home-assistant"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.0.0"
|
||||
architectures = "all"
|
||||
multi_instance = false
|
||||
ldap = true
|
||||
sso = false
|
||||
disk = "2G"
|
||||
ram.build = "2G"
|
||||
ram.runtime = "2G"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
full_domain = true
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.home]
|
||||
ask.en = "Name of the location where Home Assistant is running."
|
||||
type = "string"
|
||||
default = "Home"
|
||||
|
||||
[install.latitude]
|
||||
ask.en = "Latitude of your location required to calculate the time the sun rises and sets--> https://www.openstreetmap.org"
|
||||
type = "string"
|
||||
default = 32.87336
|
||||
|
||||
[install.longitude]
|
||||
ask.en = "Longitude of your location required to calculate the time the sun rises and sets --> https://www.openstreetmap.org"
|
||||
type = "string"
|
||||
default = 117.22743
|
||||
|
||||
[install.elevation]
|
||||
ask.en = "Altitude above sea level in meters. Impacts sunrise data."
|
||||
type = "number"
|
||||
default = 430
|
||||
|
||||
[install.unit_system]
|
||||
ask.en = "metric for Metric, us_customary for US Customary. This also sets temperature_unit, Celsius for Metric and Fahrenheit for US Customary."
|
||||
type = "string"
|
||||
choices = ["metric", "us_customary"]
|
||||
default = "metric"
|
||||
|
||||
[install.currency]
|
||||
ask.en = "Pick your currency code from the column Code of Wikipedia’s list of ISO 4217 active codes --> https://en.wikipedia.org/wiki/ISO_4217#Active_codes"
|
||||
type = "string"
|
||||
default = "USD"
|
||||
|
||||
[install.country]
|
||||
ask.en = "Country in which Home Assistant is running. This may, for example, influence radio settings to comply with local regulations. The country should be specified as an ISO 3166.1 alpha-2 code. Pick your country from the column Code of Wikipedia’s list of ISO 31661 alpha-2 officially assigned code --> https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements"
|
||||
type = "string"
|
||||
default = "US"
|
||||
|
||||
[install.time_zone]
|
||||
ask.en = "Pick your time zone from the column TZ of Wikipedia’s list of tz database time zones --> https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"
|
||||
type = "string"
|
||||
default = "America/Los_Angeles"
|
||||
|
||||
[resources]
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.data_dir]
|
||||
|
||||
[resources.permissions]
|
|
@ -7,9 +7,6 @@
|
|||
# Release to install
|
||||
app_version=2023.2.3
|
||||
|
||||
# Package dependencies
|
||||
pkg_dependencies="python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0 libmariadb-dev libmariadb-dev-compat rustc"
|
||||
|
||||
# Requirements (Major.Minor.Patch)
|
||||
# PY_VERSION=$(curl -s "https://www.python.org/ftp/python/" | grep ">3.9" | tail -n1 | cut -d '/' -f 2 | cut -d '>' -f 2)
|
||||
# Pyhton 3.9.2 will be shiped with bullseye
|
||||
|
@ -19,16 +16,6 @@ py_required_version=3.10.9
|
|||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Create homeassistant user
|
||||
mynh_system_user_create () {
|
||||
user_groups=""
|
||||
[ $(getent group dialout) ] && user_groups="${user_groups} dialout"
|
||||
[ $(getent group gpio) ] && user_groups="${user_groups} gpio"
|
||||
[ $(getent group i2c) ] && user_groups="${user_groups} i2c"
|
||||
ynh_system_user_create --username=$app --groups="$user_groups" --home_dir="$data_path"
|
||||
}
|
||||
|
||||
|
||||
# Check if directory/file already exists (path in argument)
|
||||
myynh_check_path () {
|
||||
[ -z "$1" ] && ynh_die "No argument supplied"
|
||||
|
@ -85,11 +72,6 @@ myynh_install_python () {
|
|||
py_app_version="/usr/local/bin/python${py_built_version%.*}"
|
||||
|
||||
else
|
||||
ynh_print_info --message="Installing additional dependencies to build python..."
|
||||
|
||||
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 libnss3-dev libreadline-dev"
|
||||
ynh_install_app_dependencies "${pkg_dependencies}"
|
||||
|
||||
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
|
||||
ynh_print_info --message="Building python (may take a while)..."
|
||||
|
||||
|
@ -130,41 +112,41 @@ myynh_install_python () {
|
|||
# Install/Upgrade Homeassistant in virtual environement
|
||||
myynh_install_homeassistant () {
|
||||
# Create the virtual environment
|
||||
ynh_exec_as $app $py_app_version -m venv --without-pip "$final_path"
|
||||
ynh_exec_as $app $py_app_version -m venv --without-pip "$install_dir"
|
||||
|
||||
# Run source in a 'sub shell'
|
||||
(
|
||||
# activate the virtual environment
|
||||
set +o nounset
|
||||
source "$final_path/bin/activate"
|
||||
source "$install_dir/bin/activate"
|
||||
set -o nounset
|
||||
|
||||
# add pip
|
||||
ynh_exec_as $app "$final_path/bin/python3" -m ensurepip
|
||||
ynh_exec_as $app "$install_dir/bin/python3" -m ensurepip
|
||||
|
||||
# install last version of wheel, pip & mysqlclient
|
||||
ynh_exec_as $app "$final_path/bin/pip3" --cache-dir "$data_path/.cache" install --upgrade wheel pip mysqlclient
|
||||
ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade wheel pip mysqlclient
|
||||
|
||||
# install Home Assistant
|
||||
ynh_exec_as $app "$final_path/bin/pip3" --cache-dir "$data_path/.cache" install --upgrade $app==$app_version
|
||||
ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade $app==$app_version
|
||||
)
|
||||
}
|
||||
|
||||
# Upgrade the virtual environment directory
|
||||
myynh_upgrade_venv_directory () {
|
||||
ynh_exec_as $app $py_app_version -m venv --upgrade "$final_path"
|
||||
ynh_exec_as $app $py_app_version -m venv --upgrade "$install_dir"
|
||||
}
|
||||
|
||||
# Set permissions
|
||||
myynh_set_permissions () {
|
||||
chown -R $app: "$final_path"
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app: "$install_dir"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
|
||||
chown -R $app: "$data_path"
|
||||
chmod 750 "$data_path"
|
||||
chmod -R o-rwx "$data_path"
|
||||
chmod -R +x "$data_path/bin/"
|
||||
chown -R $app: "$data_dir"
|
||||
chmod 750 "$data_dir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chmod -R +x "$data_dir/bin/"
|
||||
|
||||
chown -R $app: "$(dirname "$log_file")"
|
||||
|
||||
|
|
|
@ -12,28 +12,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
log_file=$(ynh_app_setting_get --app=$app --key=log_file)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
||||
python=$(ynh_app_setting_get --app=$app --key=python)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -44,13 +22,13 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$data_path" --is_big
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
121
scripts/install
121
scripts/install
|
@ -9,107 +9,40 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
home=$YNH_APP_ARG_HOME
|
||||
latitude=$YNH_APP_ARG_LATITUDE
|
||||
longitude=$YNH_APP_ARG_LONGITUDE
|
||||
elevation=$YNH_APP_ARG_ELEVATION
|
||||
unit_system=$YNH_APP_ARG_UNIT_SYSTEM
|
||||
currency=$YNH_APP_ARG_CURRENCY
|
||||
country=$YNH_APP_ARG_COUNTRY
|
||||
time_zone=$YNH_APP_ARG_TIME_ZONE
|
||||
|
||||
#=================================================
|
||||
# DEFINE USEFULL VARS
|
||||
#=================================================
|
||||
|
||||
final_path="/var/www/$app"
|
||||
data_path="/home/yunohost.app/$app"
|
||||
log_file="/var/log/$app/$app.log"
|
||||
path_url="/"
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
[ ! -d "$final_path" ] || ynh_die --message="There is already a directory: $final_path "
|
||||
ynh_webpath_register --app=$app --domain="$domain" --path_url="$path_url"
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
ynh_app_setting_set --app=$app --key=domain --value="$domain"
|
||||
ynh_app_setting_set --app=$app --key=final_path --value="$final_path"
|
||||
ynh_app_setting_set --app=$app --key=data_path --value="$data_path"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=log_file --value="$log_file"
|
||||
ynh_app_setting_set --app=$app --key=path_url --value="$path_url"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
# CHECK PYTHON VERSION AND COMPILE IF NEEDED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..."
|
||||
|
||||
port=$(ynh_find_port 8123)
|
||||
ynh_app_setting_set --app=$app --key=port --value="$port"
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_script_progression --message="Check Python version & compile the required one if needed..." --weight=1
|
||||
myynh_install_python --python="$py_required_version"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
mynh_system_user_create
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..."
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
|
||||
# create a directory for the installation of Home Assistant
|
||||
myynh_create_dir "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
myynh_create_dir "$install_dir"
|
||||
chown -R $app: "$install_dir"
|
||||
|
||||
# create a directory for the datas of Home Assistant
|
||||
myynh_create_dir "$data_path/.cache"
|
||||
chown -R $app: "$data_path"
|
||||
myynh_create_dir "$data_dir/.cache"
|
||||
chown -R $app: "$data_dir"
|
||||
|
||||
# installation in a virtual environment
|
||||
ynh_script_progression --message="Installing Home Assistant in a virtual environment..."
|
||||
|
@ -118,8 +51,8 @@ myynh_install_homeassistant
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
|
@ -130,19 +63,19 @@ ynh_add_nginx_config
|
|||
myynh_create_dir "/etc/sudoers.d"
|
||||
ynh_add_config --template="../conf/sudoers" --destination="/etc/sudoers.d/$app"
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
cp -r "../conf/homeassistant_conf_files/." "$data_path/"
|
||||
ynh_add_config --template="../conf/homeassistant_conf_files/configuration.yaml" --destination="$data_path/configuration.yaml"
|
||||
cp -r "../conf/homeassistant_conf_files/." "$data_dir/"
|
||||
ynh_add_config --template="../conf/homeassistant_conf_files/configuration.yaml" --destination="$data_dir/configuration.yaml"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
|
||||
# setup up systemd service
|
||||
ynh_script_progression --message="Adding the dedicated service..."
|
||||
ynh_add_systemd_config
|
||||
|
||||
|
@ -151,27 +84,28 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
ynh_use_logrotate --logfile="$log_file"
|
||||
|
||||
#=================================================
|
||||
# SET FILE OWNERSHIP / PERMISSIONS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring files permissions..."
|
||||
myynh_set_permissions
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
# add service in admin panel
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# start systemd service with --verbose
|
||||
|
@ -186,27 +120,10 @@ ynh_systemd_action --service_name=$app --action=restart
|
|||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring Fail2Ban..." --weight=1
|
||||
|
||||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config --logpath="$log_file" --failregex="Login attempt or request with invalid authentication from <HOST>"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
[ $is_public -eq 1 ] && ynh_permission_update --permission="main" --add="visitors"
|
||||
# Allow the web UI to use its own API without Yunohost/SSOWat interfering with it. Home Assistant authentication should still be in effect.
|
||||
ynh_permission_create --permission="api" --label="api" --url="/api" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -11,23 +11,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
log_file=$(ynh_app_setting_get --app=$app --key=log_file)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
||||
python=$(ynh_app_setting_get --app=$app --key=python)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
|
@ -42,61 +25,29 @@ fi
|
|||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
ynh_remove_systemd_config --service=$app
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing logrotate configuration..."
|
||||
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..."
|
||||
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory..."
|
||||
ynh_secure_remove --file="$data_path"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated Fail2Ban config
|
||||
ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=1
|
||||
ynh_remove_fail2ban_config
|
||||
|
||||
#=================================================
|
||||
|
@ -104,23 +55,11 @@ ynh_remove_fail2ban_config
|
|||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
|
||||
# remove sudoers file
|
||||
ynh_secure_remove --file="/etc/sudoers.d/$app"
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="$(dirname "$log_file")"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -14,76 +14,33 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
log_file=$(ynh_app_setting_get --app=$app --key=log_file)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
||||
python=$(ynh_app_setting_get --app=$app --key=python)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
[ ! -d "$final_path" ] || ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
|
||||
mynh_system_user_create
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$data_path" --not_mandatory
|
||||
|
||||
mkdir -p $data_path
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
mkdir -p $data_dir
|
||||
|
||||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1
|
||||
|
||||
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
@ -91,36 +48,32 @@ ynh_systemd_action --action=restart --service_name=fail2ban
|
|||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
# CHECK PYTHON VERSION AND COMPILE IF NEEDED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_script_progression --message="Restoring Python..." --weight=1
|
||||
myynh_install_python --python="$python"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..."
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd="$db_pwd"
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoring various files..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/sudoers.d/$app"
|
||||
|
||||
ynh_restore_file --origin_path="$(dirname "$log_file")"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
# add --verbose to track restart
|
||||
sed -i 's/ExecStart=.*/& --verbose/g' "/etc/systemd/system/$app.service"
|
||||
|
@ -129,15 +82,15 @@ systemctl enable $app.service --quiet
|
|||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# IF NEEDED UPDATE THE PYHTON LINK IN THE VIRUTAL ENV.
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating the pyhton link in the pyhton virtual environment..."
|
||||
|
||||
ynh_script_progression --message="Updating the pyhton link in the pyhton virtual environment..."
|
||||
hass_python_link=$(head -1 /var/www/homeassistant/bin/hass | sed 's/#!//')
|
||||
if [ ! -e "$hass_python_link" ] ; then
|
||||
hass_python_new_dest=$(which `basename "$hass_python_link"`)
|
||||
|
@ -148,23 +101,23 @@ fi
|
|||
# SET FILE OWNERSHIP / PERMISSIONS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring files permissions..."
|
||||
myynh_set_permissions
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
# start systemd service with --verbose
|
||||
ynh_systemd_action --service_name=$app --action=start --line_match="Home Assistant initialized" --log_path="$log_file" --timeout=3600
|
||||
|
||||
# remove --verbose from service
|
||||
ynh_replace_string --match_string=" --verbose" --replace_string="" --target_file="/etc/systemd/system/$app.service"
|
||||
ynh_store_file_checksum --file="/etc/systemd/system/$app.service"
|
||||
|
@ -176,8 +129,8 @@ ynh_systemd_action --service_name=$app --action=restart
|
|||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -9,65 +9,21 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
log_file=$(ynh_app_setting_get --app=$app --key=log_file)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
||||
python=$(ynh_app_setting_get --app=$app --key=python)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="api"; then
|
||||
ynh_permission_create --permission="api" --label="api" --url="/api" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
mynh_system_user_create
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -84,39 +40,31 @@ fi
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
cp -r "../conf/homeassistant_conf_files/bin/." "$data_path/bin/"
|
||||
|
||||
cp -r "../conf/homeassistant_conf_files/bin/." "$data_dir/bin/"
|
||||
ynh_add_config --template="../conf/sudoers" --destination="/etc/sudoers.d/$app"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1
|
||||
|
||||
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1
|
||||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config --logpath="$log_file" --failregex="Login attempt or request with invalid authentication from <HOST>"
|
||||
|
||||
|
@ -125,26 +73,28 @@ ynh_add_fail2ban_config --logpath="$log_file" --failregex="Login attempt or requ
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
ynh_use_logrotate --logfile="$log_file" --non-append
|
||||
|
||||
#=================================================
|
||||
# SET FILE OWNERSHIP / PERMISSIONS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring files permissions..."
|
||||
myynh_set_permissions
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# start systemd service with --verbose
|
||||
|
@ -156,13 +106,6 @@ ynh_store_file_checksum --file="/etc/systemd/system/$app.service"
|
|||
systemctl daemon-reload
|
||||
ynh_systemd_action --service_name=$app --action=restart
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
22
test.toml
Normal file
22
test.toml
Normal file
|
@ -0,0 +1,22 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
|
||||
|
||||
# -------------------------------
|
||||
# Default args to use for install
|
||||
# -------------------------------
|
||||
|
||||
|
||||
|
||||
# -------------------------------
|
||||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
|
||||
test_upgrade_from.c1690e4.name = "Upgrade from 2023.1.7~ynh2"
|
||||
|
Loading…
Reference in a new issue