Commit graph

81 commits

Author SHA1 Message Date
Josué Tille
140ae8e51a
Change the way to manage the jail and filter file and improve documentations
Using a template file make more easy to use a custom failregex.
It also give the possiblitity to use custom settings in the fail2ban config
2019-02-13 21:25:49 +01:00
Alexandre Aubin
fa2d80bce7
Remove sudo 2018-08-29 13:27:25 +02:00
Alexandre Aubin
62c8f577c9
Remove old sudo 2018-08-29 13:25:29 +02:00
Maniack Crudelis
7752bc0fb7
Update fail2ban helpers from experimental helpers. 2018-08-27 21:51:36 +02:00
Jimmy Monin
561f1aecb0 Update to latest version from Experimental_helpers 2018-05-19 10:11:16 +02:00
Jimmy Monin
35d4a1001f Add fail2ban helpers 2017-09-02 18:27:25 +02:00
ariasuni
8e45f960a7 [fix] Use --value="$3" syntax so that $3 can begin with a dash 2017-08-27 03:37:32 +02:00
Alexandre Aubin
88a6c3d83a Missing parenthesis in helper :| 2017-08-06 02:37:17 +02:00
Maniack Crudelis
f4fabe1edb Fix syntax error: unexpected end of file (#337) 2017-08-02 18:44:32 +02:00
Maniack Crudelis
8f173543bb Fix syntax error: unexpected end of file (#338) 2017-08-02 18:44:16 +02:00
Alexandre Aubin
3a777ccbc7 [microdecision] Renaming ynh_backup_after_failed_upgrade to ynh_restore_upgradebackup 2017-07-28 14:22:04 -04:00
Maniack Crudelis
a006868cbe New helpers ynh_add_systemd_config and ynh_remove_systemd_config (#287)
* New helpers ynh_add_systemd_config and ynh_remove_systemd_config
Standard file for systemd service.
* ynh_subsistute_char was renamed ynh_replace_string
* Upgrade helpers
* Add some description of which keywords are replaced by which variable
2017-07-28 19:21:22 +02:00
Maniack Crudelis
80242a8edc New helpers ynh_add_nginx_config and ynh_remove_nginx_config (#285)
* New helpers ynh_add_nginx_config and ynh_remove_nginx_config
Standard configuration of nginx
Use local files stored in conf/, so it's still possible to use a specific config
* ynh_substitute_char was renamed ynh_replace_string
* ynh_compare_checksum_config -> ynh_backup_if_checksum_is_different
* Upgrade helpers
* Add some description of which keywords are replaced by which variable
2017-07-28 19:11:28 +02:00
Maniack Crudelis
bf45cd7c4b New helpers ynh_backup_after_failed_upgrade and ynh_backup_before_upg… (#289)
* New helpers ynh_backup_after_failed_upgrade and ynh_backup_before_upgrade
Create a backup at the beginning of upgrade script.
Then, if the upgrade script failed, remove the app and restore it.
The backup is kept, to provide a way to restore if the upgrade is finally a bad thing.
* Implement @JimboJoe's comments
* Indentation
* --ignore-hooks -> --ignore-system
2017-07-28 18:53:43 +02:00
Maniack Crudelis
390835e96a [fix] Logrotate append (#328)
* [fix] Logrotate append
* Typo fix by JimboJoe
2017-07-24 02:50:48 +02:00
Laurent Peuch
f3a247442f Merge pull request #321 from YunoHost/helper_autopurge
[enh] New helper autopurge
2017-07-17 03:47:22 +02:00
Maniack Crudelis
9782f05887 New helpers ynh_add_fpm_config and ynh_remove_fpm_config (#284)
* New helpers ynh_add_fpm_config and ynh_remove_fpm_config
Standard configuration of php-fpm.
Use local files stored in conf/, so it's still possible to use a specific config
* ynh_substitute_char was renamed to ynh_replace_string
* Update checksum command and quiet the second secure_remove
* Fix helpers name
2017-07-10 17:48:32 +02:00
Maniack Crudelis
3320aee86e [enh] New helper autopurge
Add an autoremove with purge.
Some deb packages, like transmission let a lot of shit behind itself.
In case of remove then install, transmission doesn't work anymore.
2017-06-17 19:22:10 +02:00
Maniack Crudelis
a01f7ffd2b [Fix] Forgot an asterisk in logrotate helper (#320) 2017-06-13 22:18:48 +02:00
Maniack Crudelis
edcabddb63 [enh] Do not change the db_pwd (#319)
* [enh] Do not change the db_pwd
For restore script, do not change the password.
Keep the primary password and recreate a new database with it.
* A small comment ;)
Thanks, opi, sometimes I forget that's not so obvious.
And I don't want to someone has to search through internet to understand a helper.
2017-06-12 17:03:40 +02:00
Maniack Crudelis
de3a0b4f69 [fix] ynh_install_app_dependencies uses grep instead of python (#313)
Proposition to discuss
2017-06-09 00:46:36 +02:00
ljf (zamentur)
d3eeb4bbc7 [enh] Refactor backup management to pave the way to borg (#275)
* [enh] Use a csv to list file to backup
* [enh] Use csv python module
* [wip] Backup refactoring
* [wip] Backup class refactoring
* [enh] Add archivemount dependencies
* [wip] Restore refactoring
* [fix] Some error in this refactoring
* [fix] Missing backup key translation
* [fix] Bad YNH_CWD in hook backup
* [fix] App backup part was broken
* [fix] Restore operation was broken
* [fix] No compressed backup
* [fix] Don't commit backup path into csv if app backup fail
* [fix] Default backup collect_dir should be in tmp subdir
* [enh] Simplify a copy code
* [enh] Build backup info from properties
* [enh] Improve comments presentation
* Adding first tests for backup/restore
* Adding more backup/restore app test scenario
* [enh] Separate BackupMethods in distinct class
* Adding test of restoring a wordpress archive from 2.4
* [fix] Be able to delete backup link too
* [fix] Bad internationalization key
* [fix] Edge case with empty mysql pwd restore
* [fix] Unset var in restore
* [fix] Edge case with empty mysql pwd restore
* Adding test for backup crash handling
* Cleaning tests + checking tmp dir is empty
* [fix] Missing tmp in backup path
* [fix] Error on reading backup csv
* Adding test of failed restore
* Adding tests when not enough space available
* Simplifying tests using markers
* [fix] ynh backup/restore helpers with only one arg
* [fix] Unmount subdir with python
* [enh] Improve backup size management
* [fix] None object in backup
* [enh] Remove dead code
* [fix] Missing locales
* [enh] Adapat test about needed space
* [fix] Pass some test
* [enh] Remove dead code
* [enh] Pass all test
* [enh] Adding test that backups contains what's expected
* Fix typo in tests
* [fix] Bad documentation
* [enh] Add comment
* [enh] Use len in place of implicit {} == False
* [enh] Add comment
* [enh] Add comment
* [enh] Refactoring on _collect_app_files
* Adding skeleton for remaining tests to write
* [enh] Use a csv to list file to backup
* [enh] Use csv python module
* [wip] Backup refactoring
* [wip] Backup class refactoring
* [enh] Add archivemount dependencies
* [wip] Restore refactoring
* [fix] Some error in this refactoring
* [fix] Missing backup key translation
* [fix] Bad YNH_CWD in hook backup
* [fix] App backup part was broken
* [fix] Restore operation was broken
* [fix] No compressed backup
* [fix] Don't commit backup path into csv if app backup fail
* [fix] Default backup collect_dir should be in tmp subdir
* [enh] Simplify a copy code
* [enh] Build backup info from properties
* [enh] Improve comments presentation
* Adding first tests for backup/restore
* Adding more backup/restore app test scenario
* [enh] Separate BackupMethods in distinct class
* Adding test of restoring a wordpress archive from 2.4
* [fix] Be able to delete backup link too
* [fix] Bad internationalization key
* [fix] Edge case with empty mysql pwd restore
* [fix] Unset var in restore
* [fix] Edge case with empty mysql pwd restore
* Adding test for backup crash handling
* Cleaning tests + checking tmp dir is empty
* [fix] Missing tmp in backup path
* [fix] Error on reading backup csv
* Adding test of failed restore
* Adding tests when not enough space available
* Simplifying tests using markers
* [fix] ynh backup/restore helpers with only one arg
* [fix] Unmount subdir with python
* [enh] Improve backup size management
* [fix] None object in backup
* [enh] Remove dead code
* [fix] Missing locales
* [enh] Adapat test about needed space
* [fix] Pass some test
* [enh] Remove dead code
* [enh] Pass all test
* [enh] Adding test that backups contains what's expected
* Fix typo in tests
* [fix] Bad documentation
* Adding skeleton for remaining tests to write
* [enh] Add comment
* [enh] Use len in place of implicit {} == False
* [enh] Add comment
* [enh] Add comment
* [enh] Refactoring on _collect_app_files
* [fix] Replay e1a507 deleted by rebase
* [fix] ynh_restore helper
* Renaming 'hooks' terminology to 'system' where it makes sense
* Propagating new --system/--ignore-system to actionmap
* Adding more tests + clarifying some functions and messages
* Factorize out the definition and validation of backup/restore targets
* Add missing key
* Use list comprehension instead of dirty loops
* [enh] Add docstring in BackupManager
* [enh] Add docstring on BackupMethod(s)
* [fix] Remove deadcode
* [fix] Remove debug message
* [enh] Add comments on RestoreManager
* [enh] Add comments on backup constants
* Adding a proper report/result for each backup target
* Skipping tests not implemented yet
* Fixing little mistake from merging
* [fix] Support different fs or archivemount error
* [enh] Backup helpers readability
* [fix] Copy backup method
* [fix] Deprecated warning always displayed
* [enh] Retrieve info.json file inside tar.gz
* Trying to reorganize methods with sections for readability
* [enh] Support archivemount failure
* [fix] Missing env var for system part restore helpers
* Clarifying disk usage / free space computation
* [enh] Refactoring around backup set_targets()
* Clarifying structure of backup_create and backup_restore
* Move RestoreManager between BackupManager and BackupMethods
* [fix] Missing locales
* [fix] System part restore if archivemount failure
* [enh] Extract all conf instead of specific code
* [fix] Other output directory (compressed archive)
* [enh] Add test for uncompressed backup
* [fix] Compressed backup in an existing output directory
* [fix] Return size for retro-compatibility
* [fix] Mountpoint check aborting script when called with -eu
* [fix] Avoid failure test with set -eu
* [fix] locale strings missing/bad arguments
* Check free space before mount
* [fix] ynh_restore_helpers with existing archive path
* Adding skeletons for moar tests
* Fixing some weird bug in _get_archive_path
* Adding a regen-conf at the end of system restore
* Adding tests of system restore from 2.4
* Have a class dedicated to target management
* Cleaning tests
* Misc formatting
* More meaningful variable names inside app restore
* [fix] can't call source ../settings/scripts/_common.sh in app backup
* [fix] ynh_install_app_dependencies is not compatible with readonly mount
* [fix] Remove temporary file
2017-06-02 13:41:16 +02:00
Maniack Crudelis
c0a40dd2df New helpers ynh_store_file_checksum and ynh_backup_if_checksum_is_different (#286)
* New helpers ynh_store_checksum_config and ynh_compare_checksum_config

Helpers for avoid destruction of personalised config files.
If the config file was manually modified, make a backup of it.

The name of this backup is returned, so the packager can choose which of this both file will used by default.

* Implement @JimboJoe's comments.
* Setting local variables as local
* Adding warning about $app that should be defined
* Remove "globally" in comment to limit confusion
* Remove "globally" in comment to limit confusion
* Remove compress and use /home/yunohost.conf/backup
* Changing timestamp format to match regen-conf's
* Tested and fixed ;)
2017-05-22 15:24:16 +02:00
JimboJoe
fee4272eac Fix ynh_local_curl (#306)
POST arguments aren't given to the request if quotes are used.
2017-05-11 23:01:49 +02:00
Maniack Crudelis
dfee06404e Nouveaux helpers ynh_mysql_generate_db et ynh_mysql_remove_db (#236)
* Nouveaux helpers ynh_mysql_generate_db et ynh_mysql_remove_db
Helpers pour créer une base de donnée, son utilisateur et un mot de passe.
Et son pendant pour la supprimer.
* Separate corrections of names
* Grammar nazism
* Update according to comments
* Renaming ynh_make_valid_dbid to ynh_sanitize_dbid
* Fixing remaining make_valid_dbid
* Implement remaining comments
* Add a check that the user exist before deleting it
2017-05-08 19:05:49 +02:00
JimboJoe
c8647fc21f [fix] ynh_setup_source: use YNH_CWD instead of YNH_EXECUTION_DIR (#305)
Following this discussion: https://github.com/YunoHost/yunohost/pull/282#issuecomment-299637999
2017-05-07 19:05:42 +02:00
Maniack Crudelis
3571747718 Nouveau helper ynh_webpath_available et ynh_webpath_register (#235)
* Nouveau helper ynh_path_validity
Simplement un wrapper de yunohost app checkurl.
Peut-être une occasion de lui donner un autre nom plus parlant.
Il me semble justement qu'il en était question.
Conflicts:
	data/helpers.d/network
* Renaming ynh_path_validity to ynh_webpath_available
* Splitting domain and path
* Use the new url-available command instead of deprecated checkurl
* Adding ynh_webpath_register
* [enh] Check before register
- Need to be tested.
- And... probably lack a echo to inform in case of error.
* Fixing helper following discussion with Maniack
2017-05-06 16:53:54 +02:00
Maniack Crudelis
0e44a42274 New helper ynh_setup_source (#282)
* New helper ynh_setup_source
THE trollest helper :D
An helper to handle download, checksum, copy, patches, extra files and even a way to install without internet connection.
Really usefull to simplify this part of the packaging.
* [fix] Source id and pkg _dir missing, strip-components deactivation
* [fix] Replace tab by 4 spaces
* [fix] False default value in ynh_setup_source helpers
* [fix] Empty var failed on set -u into ynh_setup_source
* [fix] Multiple patch on setup sources helper
* [fix] Doc, patch and extra_file in ynh_setup helpers
* [enh] Allow to use ynh_setup_source in another dir
* [fix] Doc ynh_get_plain_key
* [fix] Missing default value in ynh_setup_source
* Missing closing } after merge with unstable ?
2017-05-03 19:19:41 +02:00
Maniack Crudelis
caa63f7022 Merge pull request #302 from YunoHost/curl_helper
[enh] Fix curl helper without POST data
2017-05-03 19:08:36 +02:00
Maniack Crudelis
47ce6d9e33 New helper ynh_secure_remove (#281)
* New helper ynh_secure_remove
A secure way to remove a file or directory.
Prevent to knew issues.
Tested with this paths:
- / -> Not removed
- /var -> Not removed
- /var/www -> Not removed
- /var/www/file -> Removed
- /opt -> Not removed
- /opt/file -> Removed
- /home/yunohost.app -> Not removed
- /home -> Not removed
- /home/ -> Not removed
- // -> Not removed
- /etc/cron.d/ -> Not removed
- /etc -> Not removed
- /etc/ -> Not removed
- /etc/X11 -> Removed
- /etc/X11/$var -> Removed (if $var is not empty)

* JimboJoe's typo fix
2017-04-30 22:37:52 +02:00
Maniack Crudelis
558323f6f2 [enh] Fix curl helper without POST data
- Allow to use this helper without any POST data
- Keep curl more quiet
2017-04-26 19:51:51 +02:00
ljf (zamentur)
c954429cca [fix] Avoid to remove a apt package accidentally (#292)
* [fix] Avoid to remove a apt package accidentally
* [fix] No need --no-remove option with apt update cmd
2017-04-06 15:34:17 +02:00
Maniack Crudelis
712e69d830 New helper ynh_local_curl (#288)
* New helper ynh_curl_abstract
Just an abstraction around curl command.
To prevent forgot arguments and simplify this difficult command.
* [enh] Switch args of ynh_curl_abstract
* [enh] Rename ynh_curl_abstract into ynh_local_curl
* Splitting the various key=value into several arguments
* Comment to clarify bash command
* Adding comment about $domain and $path_url
2017-04-06 15:33:56 +02:00
Maniack Crudelis
c31e4c5b0d New helper ynh_replace_string (#280)
* New helper ynh_substitute_char
Sed abstraction, and a way to use something other than sed.
I added also an escape of the delimiter used by sed, to prevent a fail in this case.
* Renaming to ynh_replace_string
* Renaming variable for clarity
2017-04-02 23:52:11 +02:00
Laurent Peuch
6a0db24c5d Merge pull request #247 from YunoHost/equivs_helpers
[enh] New helpers for equivs use
2017-03-20 01:34:12 +01:00
Laurent Peuch
48238171b2 Merge pull request #248 from YunoHost/logrotate_helpers
[enh] New helpers for logrotate
2017-03-17 16:16:56 +01:00
Maniack Crudelis
9d44e1d84b [enh] New helper ynh_abort_if_errors (#245)
* New helper ynh_check_error

Helpers to implemente trap and set -eu.

Simply to use, you only add `ynh_check_error` in your script.

* Change helper's name

* Propagate new name in comments
2017-03-17 16:16:36 +01:00
Alexandre Aubin
5b9092d6df Rename ynh_app_dependencies to ynh_install_app_dependencies 2017-03-17 04:07:17 +01:00
Maniack Crudelis
5f3fcefc88 Prevent to rewrite the previous control file 2017-03-16 18:35:57 +01:00
Maniack Crudelis
6fbc6fa17d Nouveau helper ynh_normalize_url_path (#234)
* Nouveau helper ynh_check_path

Nouveau helper pour vérifier et corriger la syntaxe du path.
Et ça permet de passer le test "incorrect_path" de package check

* [fix] Bad comment

* path en argument et normalize

* Make commande more obvious

* Do not use path

* Adding behavior for / in the documentation
2017-03-16 04:58:34 +01:00
Maniack Crudelis
2bb32c26b6 Add app setting 2017-03-14 18:05:28 +01:00
Maniack Crudelis
5fcb8cd439 Remove use of deprecated helper 2017-03-14 16:34:07 +01:00
opi
0c01dd4dca Merge branch 'stable' into unstable. (#230 was merged into stable) 2017-03-14 16:29:09 +01:00
Maniack Crudelis
f2e656176e Failed if $1 not set
Because we use set -u, this helper failed if the optional arg is not set
2017-03-13 23:29:47 +01:00
Maniack Crudelis
4dfde86e1a Fix ynh_remove_app_dependencies too... 2017-03-02 23:57:02 +01:00
Maniack Crudelis
7ade94e7e3 Fix ynh_app_dependencies
Double // pour remplacer toutes les occurrences de _
Ajout d'une virgule entre les dépendances.
2017-03-02 23:55:28 +01:00
Laurent Peuch
cf3f0e8185 Merge pull request #230 from YunoHost/ynh_no_log
Hack dégueux pour éviter d'écrire dans le log cli
2017-02-26 19:35:27 +01:00
Laurent Peuch
5d3e1c9212 Merge pull request #233 from YunoHost/ynh_find_port
Nouveau helper ynh_find_port
2017-02-12 03:49:45 +01:00
Laurent Peuch
83dca8e7c6 Merge pull request #237 from YunoHost/ynh_system_user_create_delete
Nouveaux helpers ynh_system_user_create et ynh_system_user_delete
2017-02-12 03:49:02 +01:00
ljf
cc77cd788d [fix] Permission issue on install of some apps 778 2017-02-09 22:26:31 +01:00