mirror of
https://github.com/YunoHost-Apps/mautrix_signal_ynh.git
synced 2024-09-03 19:46:07 +02:00
Split pre-0.5 upgrade script, check version before executing
This commit is contained in:
parent
b619888179
commit
f6941f1e7f
2 changed files with 36 additions and 21 deletions
27
scripts/upgrade
Normal file → Executable file
27
scripts/upgrade
Normal file → Executable file
|
@ -38,28 +38,13 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
# TODO: check if there are some file that need some chown chmod
|
# TODO: check if there are some file that need some chown chmod
|
||||||
# TODO: look at whatsapp to compare
|
# TODO: look at whatsapp to compare
|
||||||
|
|
||||||
#=================================================
|
# Check if an old version of the bridge is in use
|
||||||
# MIGRATION 1 : PYTHON TO GO BRIDGE
|
# In this case it needs to be upgraded from python to go
|
||||||
#=================================================
|
# Note that 0.5.0 was never released, but it makes for a good cut-off
|
||||||
|
if ynh_compare_current_package_version --comparison lt --version 0.5.0~ynh1
|
||||||
# Version 0.5.1 of Mautrix Signal Bridge is written in Go, whereas previous versions
|
then
|
||||||
# were written in Python. Also signald data is not needed anymore.
|
source upgrade-pre-0.5.sh
|
||||||
|
|
||||||
# Remove rustup
|
|
||||||
export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin"
|
|
||||||
|
|
||||||
if [ -e "$install_dir/.rustup" ]; then
|
|
||||||
ynh_exec_as "$app" env "PATH=$PATH" rustup self uninstall
|
|
||||||
fi
|
fi
|
||||||
# Remove signald executable
|
|
||||||
ynh_remove_systemd_config --service="signald"
|
|
||||||
ynh_secure_remove --file="$signald_exe"
|
|
||||||
|
|
||||||
# Remove signald data
|
|
||||||
ynh_secure_remove --file="$signald_data"
|
|
||||||
# Remove signald system user
|
|
||||||
ynh_system_user_delete --username=$signald_user
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
|
30
scripts/upgrade-pre-0.5.sh
Executable file
30
scripts/upgrade-pre-0.5.sh
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script is intended to handle the upgrade from python to go.
|
||||||
|
# It should be ran exactly once, when installing a post-v5.0 version onto a pre-v5.0 version.
|
||||||
|
#
|
||||||
|
# This script is intended to be sourced from the main upgrade script, in order to retain variables
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MIGRATION 1 : PYTHON TO GO BRIDGE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Version 0.5.1 of Mautrix Signal Bridge is written in Go, whereas previous versions
|
||||||
|
# were written in Python. Also signald data is not needed anymore.
|
||||||
|
|
||||||
|
# Remove rustup
|
||||||
|
export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin"
|
||||||
|
|
||||||
|
if [ -e "$install_dir/.rustup" ]; then
|
||||||
|
ynh_exec_as "$app" env "PATH=$PATH" rustup self uninstall
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove signald executable
|
||||||
|
ynh_remove_systemd_config --service="signald"
|
||||||
|
ynh_secure_remove --file="$signald_exe"
|
||||||
|
|
||||||
|
# Remove signald data
|
||||||
|
ynh_secure_remove --file="$signald_data"
|
||||||
|
# Remove signald system user
|
||||||
|
ynh_system_user_delete --username=$signald_user
|
||||||
|
|
Loading…
Add table
Reference in a new issue