update packagingv2
This commit is contained in:
parent
1d0a98a754
commit
5aa88fcc34
6 changed files with 183 additions and 469 deletions
|
@ -4,88 +4,98 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
export appname="libreerp"
|
appname="libreerp"
|
||||||
export FORKNAME="odoo"
|
FORKNAME="odoo"
|
||||||
|
|
||||||
swap_needed=1024
|
swap_needed=1024
|
||||||
|
|
||||||
conf_file="/etc/$app/main.conf"
|
conf_file="/etc/$app/main.conf"
|
||||||
|
|
||||||
|
if [ "$app_version" = "9" ] || [ "$app_version" = "8" ]; then
|
||||||
|
bin_file="$install_dir/venv/bin/python3 $install_dir/$appname/$FORKNAME.py"
|
||||||
|
else
|
||||||
|
bin_file="$install_dir/venv/bin/python3 $install_dir/$appname/$FORKNAME-bin"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
function debranding() {
|
function debranding() {
|
||||||
# Remove Odoo references to avoid trademark issue
|
# Remove Odoo references to avoid trademark issue
|
||||||
if [ -d $install_dir/$appname/$FORKNAME ]; then
|
if [ -d "$install_dir/$appname/$FORKNAME" ]; then
|
||||||
python_app=$install_dir/$appname/$FORKNAME
|
python_app="$install_dir/$appname/$FORKNAME"
|
||||||
else
|
else
|
||||||
python_app=$install_dir/$appname/openerp
|
python_app="$install_dir/$appname/openerp"
|
||||||
fi
|
fi
|
||||||
find $install_dir/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <a[^>]*>Odoo<\/a>//g' {} \;
|
find "$install_dir/$appname" -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <a[^>]*>Odoo<\/a>//g' {} \;
|
||||||
find $install_dir/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/<a[^>]*>Powered by <[^>]*>Odoo<\/[^>]*><\/a>//g' {} \;
|
find "$install_dir/$appname" -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/<a[^>]*>Powered by <[^>]*>Odoo<\/[^>]*><\/a>//g' {} \;
|
||||||
find $install_dir/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>Odoo<\/[^>]*>//g' {} \;
|
find "$install_dir/$appname" -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>Odoo<\/[^>]*>//g' {} \;
|
||||||
find $install_dir/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*><img[^>]*Odoo[^>]*><\/a>//g' {} \;
|
find "$install_dir/$appname" -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*><img[^>]*Odoo[^>]*><\/a>//g' {} \;
|
||||||
if test -f "$install_dir/$appname/addons/web/static/src/xml/base.xml"; then
|
if test -f "$install_dir/$appname/addons/web/static/src/xml/base.xml"; then
|
||||||
sed -i 's/<a[^>]*>My Odoo.com account<\/a>//g' $install_dir/$appname/addons/web/static/src/xml/base.xml
|
sed -i 's/<a[^>]*>My Odoo.com account<\/a>//g' "$install_dir/$appname/addons/web/static/src/xml/base.xml"
|
||||||
sed -i 's/<a[^>]*>Documentation<\/a>//g' $install_dir/$appname/addons/web/static/src/xml/base.xml
|
sed -i 's/<a[^>]*>Documentation<\/a>//g' "$install_dir/$appname/addons/web/static/src/xml/base.xml"
|
||||||
sed -i 's/<a[^>]*>Support<\/a>//g' $install_dir/$appname/addons/web/static/src/xml/base.xml
|
sed -i 's/<a[^>]*>Support<\/a>//g' "$install_dir/$appname/addons/web/static/src/xml/base.xml"
|
||||||
fi
|
fi
|
||||||
cp ../conf/logo_type.png $python_app/addons/base/static/img/logo_white.png
|
cp ../conf/logo_type.png "$python_app/addons/base/static/img/logo_white.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_files() {
|
function setup_files() {
|
||||||
|
if [[ "$oca" -eq 0 ]]; then
|
||||||
if [[ $oca -eq 0 ]]; then
|
source_id="main_${app_version}"
|
||||||
ynh_setup_source $install_dir/$appname $app_version
|
|
||||||
else
|
else
|
||||||
ynh_setup_source $install_dir/$appname "oca-$app_version"
|
source_id="main_${app_version}-oca"
|
||||||
fi
|
fi
|
||||||
|
ynh_setup_source --source_id="$source_id" --dest_dir="$install_dir/$appname"
|
||||||
|
|
||||||
debranding
|
debranding
|
||||||
mkdir -p $install_dir/custom-addons
|
mkdir -p "$install_dir/custom-addons"
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:$app "$install_dir"
|
chown -R "$app:$app" "$install_dir"
|
||||||
touch /var/log/$app.log
|
|
||||||
chown $app:$app /var/log/$app.log
|
|
||||||
|
|
||||||
if [ ! -f $conf_file ]; then
|
touch "/var/log/$app.log"
|
||||||
ynh_configure server.conf $conf_file
|
chown "$app:$app" "/var/log/$app.log"
|
||||||
|
|
||||||
|
if [ ! -f "$conf_file" ]; then
|
||||||
|
ynh_configure server.conf "$conf_file"
|
||||||
chmod 400 "$conf_file"
|
chmod 400 "$conf_file"
|
||||||
chown $app:$app "$conf_file"
|
chown "$app:$app" "$conf_file"
|
||||||
|
|
||||||
# Autoinstall the LDAP auth module
|
# Autoinstall the LDAP auth module
|
||||||
if ls $install_dir/$appname/$FORKNAME-bin > /dev/null ; then
|
if [ -f "$install_dir/$appname/$FORKNAME-bin" ]; then
|
||||||
ynh_replace_string "^{$" "{'auto_install': True," $install_dir/$appname/addons/auth_ldap/__manifest__.py
|
ynh_replace_string --target_file="$install_dir/$appname/addons/auth_ldap/__manifest__.py" \
|
||||||
|
--match_string="^{$" --replace_string="{'auto_install': True,"
|
||||||
else
|
else
|
||||||
ynh_replace_string "'auto_install': False" "'auto_install': True" $install_dir/$appname/addons/auth_ldap/__openerp__.py
|
ynh_replace_string --target_file="$install_dir/$appname/addons/auth_ldap/__openerp__.py" \
|
||||||
|
--match_string="'auto_install': False" --replace_string="'auto_install': True"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_database() {
|
function setup_database() {
|
||||||
export preinstall=1
|
export preinstall=1
|
||||||
ynh_configure server.conf $conf_file
|
ynh_configure server.conf "$conf_file"
|
||||||
chown $app:$app $conf_file
|
chown "$app:$app" "$conf_file"
|
||||||
# Load translation
|
# Load translation
|
||||||
#param=" --without-demo True --addons-path $install_dir/$appname/addons --db_user $app --db_password $db_pwd --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app "
|
#param=" --without-demo True --addons-path $install_dir/$appname/addons --db_user $app --db_password $db_pwd --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app "
|
||||||
param=" -c $conf_file -d $app "
|
param=" -c $conf_file -d $app "
|
||||||
ynh_exec_as $app $bin_file -c $conf_file --stop-after-init -i base -d $app
|
ynh_exec_as "$app" "$bin_file" -c "$conf_file" --stop-after-init -i base -d "$app"
|
||||||
ynh_exec_as $app $bin_file -c $conf_file --stop-after-init -i auth_ldap -d $app
|
ynh_exec_as "$app" "$bin_file" -c "$conf_file" --stop-after-init -i auth_ldap -d "$app"
|
||||||
ynh_exec_as $app $bin_file -c $conf_file --stop-after-init --load-language $lang -d $app
|
ynh_exec_as "$app" "$bin_file" -c "$conf_file" --stop-after-init --load-language $lang -d "$app"
|
||||||
# Configure language, timezone and ldap
|
# Configure language, timezone and ldap
|
||||||
ynh_exec_as $app $bin_file shell -c $conf_file -d $app <<< \
|
ynh_exec_as "$app" "$bin_file" shell -c "$conf_file" -d "$app" <<< \
|
||||||
"
|
"
|
||||||
self.env['res.users'].search([['login', '=', 'admin']])[0].write({'password': '$admin_password'})
|
self.env['res.users'].search([['login', '=', 'admin']])[0].write({'password': '$admin_password'})
|
||||||
self.env.cr.commit()
|
self.env.cr.commit()
|
||||||
"
|
"
|
||||||
ynh_exec_as $app $bin_file shell -c $conf_file -d $app <<< \
|
ynh_exec_as "$app" "$bin_file" shell -c "$conf_file" -d "$app" <<< \
|
||||||
"
|
"
|
||||||
self.write({'tz':'$tz','lang':'$lang'})
|
self.write({'tz':'$tz','lang':'$lang'})
|
||||||
self.env.cr.commit()
|
self.env.cr.commit()
|
||||||
"
|
"
|
||||||
ynh_exec_as $app $bin_file shell -c $conf_file -d $app <<< \
|
ynh_exec_as "$app" "$bin_file" shell -c "$conf_file" -d "$app" <<< \
|
||||||
"
|
"
|
||||||
template=env['res.users'].create({
|
template=env['res.users'].create({
|
||||||
'login':'template',
|
'login':'template',
|
||||||
|
@ -108,8 +118,8 @@ self.company_id.ldaps.create({
|
||||||
self.env.cr.commit()
|
self.env.cr.commit()
|
||||||
"
|
"
|
||||||
export preinstall=0
|
export preinstall=0
|
||||||
ynh_configure server.conf $conf_file
|
ynh_configure server.conf "$conf_file"
|
||||||
chown $app:$app $conf_file
|
chown "$app:$app" "$conf_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
ynh_configure () {
|
ynh_configure () {
|
||||||
|
@ -118,12 +128,11 @@ ynh_configure () {
|
||||||
content=""
|
content=""
|
||||||
content2=""
|
content2=""
|
||||||
content3=""
|
content3=""
|
||||||
if [[ $preinstall == '1' ]]
|
if [[ $preinstall == '1' ]]; then
|
||||||
then
|
|
||||||
content="dbfilter = $db_name"
|
content="dbfilter = $db_name"
|
||||||
else
|
else
|
||||||
content="db_name = $db_name"
|
content="db_name = $db_name"
|
||||||
if [[ $app_version > 9 ]]
|
if [[ $app_version -gt 9 ]]
|
||||||
then
|
then
|
||||||
content2="dbfilter = False"
|
content2="dbfilter = False"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -10,28 +8,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Loading settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
conf_file=$(ynh_app_setting_get --app=$app --key=conf_file)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -41,29 +17,25 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path/$appname"
|
ynh_backup --src_path="$install_dir/$appname"
|
||||||
ynh_backup --src_path="$final_path/custom-addons"
|
ynh_backup --src_path="$install_dir/custom-addons"
|
||||||
ynh_backup --src_path="$final_path/.local"
|
ynh_backup --src_path="$install_dir/.local"
|
||||||
|
|
||||||
|
ynh_backup --src_path="$conf_file"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC BACKUP
|
|
||||||
#=================================================
|
|
||||||
# BACKUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$conf_file"
|
ynh_backup --src_path="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE POSTGRESQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
|
|
|
@ -11,16 +11,7 @@ source /usr/share/yunohost/helpers
|
||||||
# INITIALIZE AND STORE SETTINGS
|
# INITIALIZE AND STORE SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
export conf_file=/etc/$app/main.conf
|
preinstall=0
|
||||||
ynh_app_setting_set --app="$app" --key="conf_file" --value="$conf_file"
|
|
||||||
|
|
||||||
export preinstall=0
|
|
||||||
|
|
||||||
if [ "$app_version" = "9" ] || [ "$app_version" = "8" ]; then
|
|
||||||
bin_file="$install_dir/venv/bin/python3 $install_dir/$appname/$FORKNAME.py"
|
|
||||||
else
|
|
||||||
bin_file="$install_dir/venv/bin/python3 $install_dir/$appname/$FORKNAME-bin"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP
|
# ADD SWAP
|
||||||
|
@ -64,12 +55,12 @@ pushd "$install_dir"
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
venv/bin/pip3 install --upgrade pip
|
venv/bin/pip3 install --upgrade pip
|
||||||
venv/bin/pip3 install wheel
|
venv/bin/pip3 install wheel
|
||||||
venv/bin/pip3 install -r $appname/requirements.txt
|
venv/bin/pip3 install -r "$appname/requirements.txt"
|
||||||
else
|
else
|
||||||
virtualenv venv
|
virtualenv venv
|
||||||
venv/bin/pip3 install --upgrade pip
|
venv/bin/pip3 install --upgrade pip
|
||||||
venv/bin/pip install wheel
|
venv/bin/pip install wheel
|
||||||
venv/bin/pip install -r $appname/requirements.txt
|
venv/bin/pip install -r "$appname/requirements.txt"
|
||||||
fi
|
fi
|
||||||
ynh_secure_remove --file="$install_dir/.cargo"
|
ynh_secure_remove --file="$install_dir/.cargo"
|
||||||
ynh_secure_remove --file="$install_dir/.rustup"
|
ynh_secure_remove --file="$install_dir/.rustup"
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -10,73 +8,21 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
conf_file=$(ynh_app_setting_get --app=$app --key=conf_file)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
||||||
then
|
yunohost service remove "$app"
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
|
||||||
yunohost service remove $app
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STOP AND REMOVE SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
|
||||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE VARIOUS FILES
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -92,23 +38,11 @@ ynh_secure_remove --file="/var/log/$app.log"
|
||||||
# REMOVE SWAP
|
# REMOVE SWAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
if [ "${PACKAGE_CHECK_EXEC:-0}" -ne 1 ]; then
|
||||||
:
|
|
||||||
else
|
|
||||||
ynh_script_progression --message="Removing swap..." --weight=1
|
ynh_script_progression --message="Removing swap..." --weight=1
|
||||||
ynh_del_swap
|
ynh_del_swap
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username=$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
204
scripts/restore
204
scripts/restore
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -11,192 +9,94 @@ source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# ADD SWAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
if [ "${PACKAGE_CHECK_EXEC:-0}" -ne 1 ]; then
|
||||||
true
|
ynh_script_progression --message="Adding swap..." --weight=1
|
||||||
}
|
ynh_add_swap --size=$swap_needed
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
||||||
|
|
||||||
export app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
export domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
||||||
export app_version=$(ynh_app_setting_get --app=$app --key=app_version)
|
|
||||||
export oca=$(ynh_app_setting_get --app=$app --key=oca)
|
|
||||||
export port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
export port_chat=$(ynh_app_setting_get --app=$app --key=port_chat)
|
|
||||||
export db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
export db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
||||||
export final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
export conf_file=$(ynh_app_setting_get --app=$app --key=conf_file)
|
|
||||||
export bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME-bin"
|
|
||||||
if [ "$app_version" = "9" ]; then
|
|
||||||
bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME.py"
|
|
||||||
fi
|
fi
|
||||||
if [ "$app_version" = "8" ]; then
|
|
||||||
bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME.py"
|
|
||||||
fi
|
|
||||||
export preinstall=0
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD RESTORATION STEPS
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path/$appname"
|
ynh_restore_file --origin_path="$install_dir/$appname"
|
||||||
ynh_restore_file --origin_path="$final_path/custom-addons"
|
ynh_restore_file --origin_path="$install_dir/custom-addons"
|
||||||
ynh_restore_file --origin_path="$final_path/.local"
|
ynh_restore_file --origin_path="$install_dir/.local"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod -R o-rwx "$install_dir"
|
||||||
chmod -R o-rwx "$final_path"
|
chown -R "$app:$app" "$install_dir"
|
||||||
chown -R $app:$app "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
ynh_restore_file --origin_path="$conf_file"
|
||||||
# SPECIFIC RESTORATION
|
chmod 400 "$conf_file"
|
||||||
#=================================================
|
chown "$app:$app" "$conf_file"
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ADD SWAP
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
ynh_script_progression --message="Adding swap..." --weight=1
|
|
||||||
ynh_add_swap --size=$swap_needed
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BUILD APP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Building app..." --weight=1
|
|
||||||
|
|
||||||
if ! wkhtmltopdf --version | grep "wkhtmltopdf 0.12.4 (with patched qt)"; then
|
|
||||||
# The debian package has a bug so we deploy a more recent version
|
|
||||||
if [ -f '../manifest.json' ] ; then
|
|
||||||
ynh_setup_source /usr/
|
|
||||||
else
|
|
||||||
OLD_YNH_CWD=$YNH_CWD
|
|
||||||
YNH_CWD=$YNH_CWD/../settings/conf
|
|
||||||
ynh_setup_source /usr/
|
|
||||||
YNH_CWD=$OLD_YNH_CWD
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
pushd $final_path
|
|
||||||
ynh_exec_warn_less ynh_exec_as $app RUSTUP_HOME="$final_path"/.rustup CARGO_HOME="$final_path"/.cargo bash -c 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y'
|
|
||||||
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
|
||||||
if grep "python3" $final_path/$appname/$FORKNAME-bin ; then
|
|
||||||
python3 -m venv venv
|
|
||||||
venv/bin/pip3 install --upgrade pip
|
|
||||||
venv/bin/pip3 install wheel
|
|
||||||
venv/bin/pip3 install -r $appname/requirements.txt
|
|
||||||
else
|
|
||||||
virtualenv venv
|
|
||||||
venv/bin/pip3 install --upgrade pip
|
|
||||||
venv/bin/pip install wheel
|
|
||||||
venv/bin/pip install -r $appname/requirements.txt
|
|
||||||
fi
|
|
||||||
ynh_secure_remove --file="$final_path/.cargo"
|
|
||||||
ynh_secure_remove --file="$final_path/.rustup"
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
# Make sure that postgresql is installed and running
|
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
|
|
||||||
# Create the database
|
|
||||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
|
||||||
|
|
||||||
# Make sure that its encoding is UTF-8
|
# Make sure that its encoding is UTF-8
|
||||||
ynh_psql_execute_as_root --sql="update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = '$db_name'"
|
ynh_psql_execute_as_root --sql="update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = '$db_name'"
|
||||||
|
|
||||||
# Restore the database contents
|
# Restore the database contents
|
||||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BUILD APP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Building app..." --weight=1
|
||||||
|
|
||||||
|
pushd "$install_dir"
|
||||||
|
ynh_exec_warn_less ynh_exec_as "$app" \
|
||||||
|
RUSTUP_HOME="$install_dir/.rustup" \
|
||||||
|
CARGO_HOME="$install_dir/.cargo" \
|
||||||
|
bash -c 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y'
|
||||||
|
|
||||||
|
export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin"
|
||||||
|
|
||||||
|
if grep "python3" "$install_dir/$appname/$FORKNAME-bin" ; then
|
||||||
|
python3 -m venv venv
|
||||||
|
venv/bin/pip3 install --upgrade pip
|
||||||
|
venv/bin/pip3 install wheel
|
||||||
|
venv/bin/pip3 install -r "$appname/requirements.txt"
|
||||||
|
else
|
||||||
|
virtualenv venv
|
||||||
|
venv/bin/pip3 install --upgrade pip
|
||||||
|
venv/bin/pip install wheel
|
||||||
|
venv/bin/pip install -r "$appname/requirements.txt"
|
||||||
|
fi
|
||||||
|
ynh_secure_remove --file="$install_dir/.cargo"
|
||||||
|
ynh_secure_remove --file="$install_dir/.rustup"
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring various files..." --weight=1
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$conf_file"
|
ynh_restore_file --origin_path="/var/log/$app.log"
|
||||||
chmod 400 "$conf_file"
|
chown "$app:$app" "/var/log/$app.log"
|
||||||
chown $app:$app "$conf_file"
|
|
||||||
|
|
||||||
touch /var/log/$app.log
|
|
||||||
chown $app:$app /var/log/$app.log
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable "$app.service" --quiet
|
||||||
|
yunohost service add "$app" --log="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app.log"
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# START SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app.log"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
162
scripts/upgrade
162
scripts/upgrade
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -9,173 +7,83 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading settings..." --weight=1
|
|
||||||
|
|
||||||
export app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
export domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
||||||
export app_version=$(ynh_app_setting_get --app=$app --key=app_version)
|
|
||||||
export oca=$(ynh_app_setting_get --app=$app --key=oca)
|
|
||||||
export port=$(ynh_app_setting_get --app=$app --key=port)
|
|
||||||
export port_chat=$(ynh_app_setting_get --app=$app --key=port_chat)
|
|
||||||
export final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
||||||
export conf_file=$(ynh_app_setting_get --app=$app --key=conf_file)
|
|
||||||
export preinstall=0
|
export preinstall=0
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Checking version..." --weight=1
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
# ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
|
||||||
if ynh_legacy_permissions_exists; then
|
|
||||||
ynh_legacy_permissions_delete_all
|
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! ynh_permission_exists --permission="admin"; then
|
|
||||||
# Create the required permissions
|
|
||||||
ynh_permission_create --permission="admin" --url="/web/database/manager" --allowed="all_users"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
setup_files
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP
|
# ADD SWAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
if [ "${PACKAGE_CHECK_EXEC:-0}" -ne 1 ]; then
|
||||||
:
|
|
||||||
else
|
|
||||||
ynh_script_progression --message="Adding swap..." --weight=1
|
ynh_script_progression --message="Adding swap..." --weight=1
|
||||||
ynh_add_swap --size=$swap_needed
|
ynh_add_swap --size=$swap_needed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
setup_files
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILD APP
|
# BUILD APP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building app..." --weight=1
|
ynh_script_progression --message="Building app..." --weight=1
|
||||||
|
|
||||||
if ! wkhtmltopdf --version | grep "wkhtmltopdf 0.12.4 (with patched qt)"; then
|
pushd "$install_dir"
|
||||||
# The debian package has a bug so we deploy a more recent version
|
ynh_exec_warn_less ynh_exec_as "$app" \
|
||||||
if [ -f '../manifest.json' ] ; then
|
RUSTUP_HOME="$install_dir/.rustup" \
|
||||||
ynh_setup_source /usr/
|
CARGO_HOME="$install_dir/.cargo" \
|
||||||
else
|
bash -c 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y'
|
||||||
OLD_YNH_CWD=$YNH_CWD
|
|
||||||
YNH_CWD=$YNH_CWD/../settings/conf
|
export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin"
|
||||||
ynh_setup_source /usr/
|
|
||||||
YNH_CWD=$OLD_YNH_CWD
|
if grep "python3" "$install_dir/$appname/$FORKNAME-bin" ; then
|
||||||
fi
|
|
||||||
fi
|
|
||||||
pushd $final_path
|
|
||||||
ynh_exec_warn_less ynh_exec_as $app RUSTUP_HOME="$final_path"/.rustup CARGO_HOME="$final_path"/.cargo bash -c 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y'
|
|
||||||
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
|
|
||||||
if grep "python3" $final_path/$appname/$FORKNAME-bin ; then
|
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
venv/bin/pip3 install --upgrade pip
|
venv/bin/pip3 install --upgrade pip
|
||||||
venv/bin/pip3 install wheel
|
venv/bin/pip3 install wheel
|
||||||
venv/bin/pip3 install -r $appname/requirements.txt
|
venv/bin/pip3 install -r "$appname/requirements.txt"
|
||||||
else
|
else
|
||||||
virtualenv venv
|
virtualenv venv
|
||||||
venv/bin/pip3 install --upgrade pip
|
venv/bin/pip3 install --upgrade pip
|
||||||
venv/bin/pip install wheel
|
venv/bin/pip install wheel
|
||||||
venv/bin/pip install -r $appname/requirements.txt
|
venv/bin/pip install -r "$appname/requirements.txt"
|
||||||
fi
|
fi
|
||||||
ynh_secure_remove --file="$final_path/.cargo"
|
ynh_secure_remove --file="$install_dir/.cargo"
|
||||||
ynh_secure_remove --file="$final_path/.rustup"
|
ynh_secure_remove --file="$install_dir/.rustup"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app.log"
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
ynh_add_systemd_config
|
||||||
|
yunohost service add "$app" --log="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app.log"
|
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
Loading…
Reference in a new issue