mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
Merge branch 'testing'
This commit is contained in:
commit
148f8bc220
4 changed files with 20 additions and 16 deletions
|
@ -6,7 +6,7 @@
|
||||||
"en": "Backup your server with restic.",
|
"en": "Backup your server with restic.",
|
||||||
"fr": "Sauvegardez votre serveur avec restic."
|
"fr": "Sauvegardez votre serveur avec restic."
|
||||||
},
|
},
|
||||||
"version": "0.9.6~ynh3",
|
"version": "0.9.6~ynh4",
|
||||||
"url": "https://restic.net/",
|
"url": "https://restic.net/",
|
||||||
"license": "BSD 2-Clause \"Simplified\" License",
|
"license": "BSD 2-Clause \"Simplified\" License",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -28,11 +28,12 @@ install_restic () {
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_${arch}.bz2 -O /tmp/restic.bz2
|
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_${arch}.bz2 -O /tmp/restic.bz2 2>&1 >/dev/null
|
||||||
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/SHA256SUMS -O /tmp/restic-sha256sums
|
wget https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/SHA256SUMS -O /tmp/restic-sha256sums 2>&1 >/dev/null
|
||||||
expected_sum=$(grep restic_${RESTIC_VERSION}_linux_${arch}.bz2 /tmp/restic-sha256sums | awk '{print $1}')
|
expected_sum=$(grep restic_${RESTIC_VERSION}_linux_${arch}.bz2 /tmp/restic-sha256sums | awk '{print $1}')
|
||||||
sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}')
|
sum=$(sha256sum /tmp/restic.bz2 | awk '{print $1}')
|
||||||
if [ "$sum" == "$expected_sum" ];then
|
if [ "$sum" == "$expected_sum" ];then
|
||||||
|
pkill restic || true
|
||||||
bunzip2 /tmp/restic.bz2 -f -c > /usr/local/bin/restic
|
bunzip2 /tmp/restic.bz2 -f -c > /usr/local/bin/restic
|
||||||
chmod +x /usr/local/bin/restic
|
chmod +x /usr/local/bin/restic
|
||||||
else
|
else
|
||||||
|
|
|
@ -33,29 +33,29 @@ ynh_save_args server port ssh_user backup_path passphrase on_calendar check_on_c
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Installing dependencies"
|
ynh_script_progression --message="Installing dependencies" --weight=7
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_print_info --message="Installing restic binary"
|
ynh_script_progression --message="Installing restic binary" --weight=4
|
||||||
install_restic
|
install_restic
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE BACKUP METHODS
|
# ACTIVATE BACKUP METHODS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Activating backup methods"
|
ynh_script_progression --message="Activating backup methods"
|
||||||
mkdir -p /etc/yunohost/hooks.d/backup_method
|
mkdir -p /etc/yunohost/hooks.d/backup_method
|
||||||
mkdir -p /usr/share/yunohost/backup_method
|
mkdir -p /usr/share/yunohost/backup_method
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP THE BACKUP METHOD
|
# SETUP THE BACKUP METHOD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Setting up backup methods"
|
ynh_script_progression --message="Setting up backup methods"
|
||||||
ynh_configure backup_method "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
ynh_configure backup_method "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
||||||
ynh_configure check_method "${final_path}/check_method"
|
ynh_configure check_method "${final_path}/check_method"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE CRON
|
# CONFIGURE CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Configuring cron"
|
ynh_script_progression --message="Configuring cron" --weight=5
|
||||||
ynh_configure backup-with-restic "/usr/local/bin/backup-with-${app}"
|
ynh_configure backup-with-restic "/usr/local/bin/backup-with-${app}"
|
||||||
ynh_configure backup-with-restic-answerbot "/usr/local/bin/backup-with-${app}-answerbot"
|
ynh_configure backup-with-restic-answerbot "/usr/local/bin/backup-with-${app}-answerbot"
|
||||||
ynh_configure check-restic "${final_path}/check-${app}"
|
ynh_configure check-restic "${final_path}/check-${app}"
|
||||||
|
@ -79,14 +79,14 @@ systemctl start ${app}_check_read_data.timer
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERATE SSH KEY
|
# GENERATE SSH KEY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Generating private key"
|
ynh_script_progression --message="Generating private key"
|
||||||
private_key="/root/.ssh/id_${app}_ed25519"
|
private_key="/root/.ssh/id_${app}_ed25519"
|
||||||
test -f $private_key || ssh-keygen -q -t ed25519 -N "" -f $private_key
|
test -f $private_key || ssh-keygen -q -t ed25519 -N "" -f $private_key
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERATE SSH CONFIG
|
# GENERATE SSH CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Generating ssh config for ${server}"
|
ynh_script_progression --message="Generating ssh config for ${server}"
|
||||||
grep -q "${server}" /root/.ssh/config 2>/dev/null || cat << EOCONF >> ~/.ssh/config
|
grep -q "${server}" /root/.ssh/config 2>/dev/null || cat << EOCONF >> ~/.ssh/config
|
||||||
Host ${server}
|
Host ${server}
|
||||||
Hostname ${server}
|
Hostname ${server}
|
||||||
|
@ -101,14 +101,14 @@ EOCONF
|
||||||
# Display key
|
# Display key
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="You should now allow the following public key for user ${ssh_user} on server ${server}:
|
ynh_script_progression --message="You should now allow the following public key for user ${ssh_user} on server ${server}:
|
||||||
$(cat ${private_key}.pub)"
|
$(cat ${private_key}.pub)"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Sending post-installation instructions to admin"
|
ynh_script_progression --message="Sending post-installation instructions to admin" --last
|
||||||
ynh_print_OFF
|
ynh_print_OFF
|
||||||
message="You should now allow the following public key for user ${ssh_user} on server ${server}:
|
message="You should now allow the following public key for user ${ssh_user} on server ${server}:
|
||||||
$(cat ${private_key}.pub)
|
$(cat ${private_key}.pub)
|
||||||
|
|
|
@ -14,15 +14,18 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
export final_path="/opt/yunohost/${app}"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing dependencies" --weight=4
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE FILES
|
# REMOVE FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing files" --weight=2
|
||||||
systemctl stop ${app}.timer
|
systemctl stop ${app}.timer
|
||||||
systemctl disable ${app}.timer
|
systemctl disable ${app}.timer
|
||||||
ynh_remove_systemd_config --service=${app}
|
ynh_remove_systemd_config --service=${app}
|
||||||
|
@ -32,13 +35,13 @@ ynh_secure_remove "/etc/systemd/system/${app}.timer"
|
||||||
ynh_secure_remove "/etc/systemd/system/${app}_check.timer"
|
ynh_secure_remove "/etc/systemd/system/${app}_check.timer"
|
||||||
ynh_secure_remove "/etc/systemd/system/${app}_check_read_data.timer"
|
ynh_secure_remove "/etc/systemd/system/${app}_check_read_data.timer"
|
||||||
ynh_secure_remove "/usr/local/bin/backup-with-${app}"
|
ynh_secure_remove "/usr/local/bin/backup-with-${app}"
|
||||||
ynh_secure_remove "/usr/local/bin/check-${app}"
|
|
||||||
ynh_secure_remove "/usr/local/bin/check-read-data-${app}"
|
|
||||||
ynh_secure_remove "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
ynh_secure_remove "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
||||||
ynh_secure_remove "/etc/yunohost/hooks.d/backup_method/05-${app}_check_app"
|
ynh_secure_remove "${final_path}/check_method"
|
||||||
ynh_secure_remove "/etc/yunohost/hooks.d/backup_method/05-${app}_check_read_data_app"
|
ynh_secure_remove "${final_path}/check-${app}"
|
||||||
|
ynh_secure_remove "${final_path}"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SSH CONFIG
|
# REMOVE SSH CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing ssh config" --last
|
||||||
sed -e "/Host ${server}/,+6d" /root/.ssh/config -i || true
|
sed -e "/Host ${server}/,+6d" /root/.ssh/config -i || true
|
||||||
|
|
Loading…
Add table
Reference in a new issue