Kaynağa Gözat

Merge pull request #29 from YunoHost-Apps/compression

Fix YunoHost 4.1
Maniack Crudelis 4 yıl önce
ebeveyn
işleme
49ed7ae339
8 değiştirilmiş dosya ile 73 ekleme ve 6 silme
  1. 12 0
      CHANGELOG.md
  2. 1 1
      README.md
  3. 1 1
      README_fr.md
  4. 2 2
      conf/app.src
  5. 13 0
      config_panel.toml
  6. 1 1
      manifest.json
  7. 1 1
      scripts/_variables
  8. 42 0
      scripts/config

+ 12 - 0
CHANGELOG.md

@@ -4,6 +4,18 @@ Changelog
 ## Unreleased
 ## Unreleased
 - Nothing for now...
 - Nothing for now...
 
 
+## [1.1~ynh1](https://github.com/YunoHost-Apps/archivist_ynh/pull/29) - 2021-01-12
+
+#### Added
+- [Allow to choose compression algorithms](https://github.com/YunoHost-Apps/archivist_ynh/pull/29)
+
+#### Fixed
+- [Fix YunoHost 4.1 support](https://github.com/YunoHost-Apps/archivist_ynh/pull/29)
+
+#### Changed
+- [Force compression for YunoHost backups](https://github.com/YunoHost-Apps/archivist_ynh/pull/29)
+
+
 ## [1.0.1~ynh2](https://github.com/YunoHost-Apps/archivist_ynh/pull/25) - 2020-01-04
 ## [1.0.1~ynh2](https://github.com/YunoHost-Apps/archivist_ynh/pull/25) - 2020-01-04
 
 
 #### Fixed
 #### Fixed

+ 1 - 1
README.md

@@ -15,7 +15,7 @@ It can also makes backups of specified directories.
 Your backups can be send to many other places, local or distant.  
 Your backups can be send to many other places, local or distant.  
 Archivist is automatically launched periodicaly to update your backups and send the modifications to the other places.
 Archivist is automatically launched periodicaly to update your backups and send the modifications to the other places.
 
 
-**Shipped version:** 1.0.1
+**Shipped version:** 1.1
 
 
 ## Screenshots
 ## Screenshots
 
 

+ 1 - 1
README_fr.md

@@ -15,7 +15,7 @@ Il peut également faire des sauvegardes de répertoires spécifiques.
 Vos sauvegardes peuvent être envoyées à de nombreux autres endroits, locaux ou distants.  
 Vos sauvegardes peuvent être envoyées à de nombreux autres endroits, locaux ou distants.  
 Archivist est automatiquement lancé périodiquement pour mettre à jour vos sauvegardes et envoyer les modifications aux autres emplacements.
 Archivist est automatiquement lancé périodiquement pour mettre à jour vos sauvegardes et envoyer les modifications aux autres emplacements.
 
 
-**Version embarquée:** 1.0.1
+**Version embarquée:** 1.1
 
 
 ## Captures d'écran
 ## Captures d'écran
 
 

+ 2 - 2
conf/app.src

@@ -1,5 +1,5 @@
-SOURCE_URL=https://github.com/maniackcrudelis/archivist/archive/v1.0.1.tar.gz
-SOURCE_SUM=56ec81447b7eb6d34c4af213b48530dc
+SOURCE_URL=https://github.com/maniackcrudelis/archivist/archive/v1.1.tar.gz
+SOURCE_SUM=f612de7b58366df437cbe228c4b934d1
 SOURCE_SUM_PRG=md5sum
 SOURCE_SUM_PRG=md5sum
 SOURCE_FORMAT=tar.gz
 SOURCE_FORMAT=tar.gz
 SOURCE_IN_SUBDIR=true
 SOURCE_IN_SUBDIR=true

+ 13 - 0
config_panel.toml

@@ -18,6 +18,19 @@ name = "Archivist configuration"
         optional = true
         optional = true
         help = "A password is needed if encryption is activated."
         help = "A password is needed if encryption is activated."
 
 
+    [main.compression]
+    name = "Compression algorithm"
+
+        [main.compression.ynh]
+        ask = "Choose the compression algorithm for YunoHost backups"
+        choices = ["gzip", "lzop", "zstd", "bzip2", "lzma", "lzip", "xz", "No compression"]
+        default = "gzip"
+
+        [main.compression.files]
+        ask = "Choose the compression algorithm for files and directories backups"
+        choices = ["gzip", "lzop", "zstd", "bzip2", "lzma", "lzip", "xz", "No compression"]
+        default = "gzip"
+
     [main.backup_types]
     [main.backup_types]
     name = "Backup"
     name = "Backup"
 
 

+ 1 - 1
manifest.json

@@ -6,7 +6,7 @@
         "en": "Automatic backups.",
         "en": "Automatic backups.",
         "fr": "Sauvegardes automatiques."
         "fr": "Sauvegardes automatiques."
     },
     },
-    "version": "1.0.1~ynh3",
+    "version": "1.1~ynh1",
     "url": "https://github.com/maniackcrudelis/archivist",
     "url": "https://github.com/maniackcrudelis/archivist",
     "license": "GPL-3.0",
     "license": "GPL-3.0",
     "maintainer": {
     "maintainer": {

+ 1 - 1
scripts/_variables

@@ -1,4 +1,4 @@
 #!/bin/bash
 #!/bin/bash
 
 
 # Dependencies
 # Dependencies
-app_depencencies="rsync encfs sshpass ccrypt"
+app_depencencies="rsync encfs sshpass ccrypt lzop zstd lzip"

+ 42 - 0
scripts/config

@@ -51,6 +51,14 @@ old_encrypt_password="$(cat $passkey)"
 encrypt_password="${YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPTION_PWD:-$old_encrypt_password}"
 encrypt_password="${YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPTION_PWD:-$old_encrypt_password}"
 ynh_print_ON
 ynh_print_ON
 
 
+# Compression algorithms
+old_ynh_compression="$(get_config_value ynh_compression_mode)"
+old_ynh_compression=${old_ynh_compression:-gzip}
+ynh_compression="${YNH_CONFIG_MAIN_COMPRESSION_YNH:-$old_ynh_compression}"
+old_files_compression="$(get_config_value files_compression_mode)"
+old_files_compression=${old_files_compression:-gzip}
+files_compression="${YNH_CONFIG_MAIN_COMPRESSION_FILES:-$old_files_compression}"
+
 # ynh_core_backup
 # ynh_core_backup
 old_ynh_core_backup="$(get_config_value ynh_core_backup)"
 old_ynh_core_backup="$(get_config_value ynh_core_backup)"
 ynh_core_backup="${YNH_CONFIG_MAIN_BACKUP_TYPES_CORE_BACKUP:-$old_ynh_core_backup}"
 ynh_core_backup="${YNH_CONFIG_MAIN_BACKUP_TYPES_CORE_BACKUP:-$old_ynh_core_backup}"
@@ -91,6 +99,9 @@ show_config() {
     ynh_return "YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPT=$encrypt"
     ynh_return "YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPT=$encrypt"
     ynh_return "YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPTION_PWD="
     ynh_return "YNH_CONFIG_MAIN_ENCRYPTION_ENCRYPTION_PWD="
 
 
+    ynh_return "YNH_CONFIG_MAIN_COMPRESSION_YNH=$ynh_compression"
+    ynh_return "YNH_CONFIG_MAIN_COMPRESSION_FILES=$files_compression"
+
     ynh_return "YNH_CONFIG_MAIN_BACKUP_TYPES_CORE_BACKUP=$ynh_core_backup"
     ynh_return "YNH_CONFIG_MAIN_BACKUP_TYPES_CORE_BACKUP=$ynh_core_backup"
     ynh_return "YNH_CONFIG_MAIN_BACKUP_TYPES_APPS_BACKUP=$ynh_app_backup"
     ynh_return "YNH_CONFIG_MAIN_BACKUP_TYPES_APPS_BACKUP=$ynh_app_backup"
 
 
@@ -136,6 +147,37 @@ apply_config() {
     # MODIFY SETTINGS
     # MODIFY SETTINGS
     #=================================================
     #=================================================
 
 
+    # Change the compression algorithms
+    # Replace "No compression" by "none" for the config file
+    if [ "$ynh_compression" == "No compression" ]; then
+        ynh_compression=none
+    fi
+    if [ "$ynh_compression" != "$old_ynh_compression" ]
+    then
+        # Update the config, or add the config if not yet existing
+        if grep "^ynh_compression_mode=" "$config_file"
+        then
+            ynh_replace_string --match_string="^ynh_compression_mode=.*" --replace_string="ynh_compression_mode=$ynh_compression" --target_file="$config_file"
+        else
+            echo "ynh_compression_mode=$ynh_compression" >> "$config_file"
+        fi
+    fi
+    # Replace "No compression" by "none" for the config file
+    if [ "$files_compression" == "No compression" ]; then
+        files_compression=none
+    fi
+    if [ "$files_compression" != "$old_files_compression" ]
+    then
+        # Update the config, or add the config if not yet existing
+        if grep "^files_compression_mode=" "$config_file"
+        then
+            ynh_replace_string --match_string="^files_compression_mode=.*" --replace_string="files_compression_mode=$files_compression" --target_file="$config_file"
+        else
+            echo "files_compression_mode=$files_compression" >> "$config_file"
+        fi
+        
+    fi
+
     # Change ynh_core_backup in the config file
     # Change ynh_core_backup in the config file
     ynh_replace_string --match_string="^ynh_core_backup=.*" --replace_string="ynh_core_backup=$ynh_core_backup" --target_file="$config_file"
     ynh_replace_string --match_string="^ynh_core_backup=.*" --replace_string="ynh_core_backup=$ynh_core_backup" --target_file="$config_file"