From 345ebdc414246188157b4134f9b68cfee1ad8e5d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 20 Jul 2022 00:29:33 +0000 Subject: [PATCH 1/4] Upgrade to v3.0.0.17 --- conf/app.src | 4 ++-- manifest.json | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/conf/app.src b/conf/app.src index 34156bc..9e74ab5 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/nilsteampassnet/TeamPass/archive/2.1.27.15.tar.gz -SOURCE_SUM=b253798fc88ced0bef129f59ac17cb6b755ef0847c5baa78ca30361e827e442d +SOURCE_URL=https://github.com/nilsteampassnet/TeamPass/archive/refs/tags/3.0.0.17.tar.gz +SOURCE_SUM=4a4eee3cce68fd3168716da0a5e770db04269cef97c3fc26d0032f5c47b745db SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 3acae53..5d33877 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Passwords Manager", "fr": "Gestionnaire de mots de passes." }, - "version": "2.1.27.15~ynh3", + "version": "3.0.0.17~ynh1", "url": "http://www.teampass.net", "upstream": { "license": "AGPL-3.0", @@ -19,10 +19,12 @@ "name": "", "email": "" }, - "previous_maintainers": [{ - "name": "Maniack Crudelis", - "email": "maniackc_dev@crudelis.fr" - }], + "previous_maintainers": [ + { + "name": "Maniack Crudelis", + "email": "maniackc_dev@crudelis.fr" + } + ], "requirements": { "yunohost": ">= 4.3.0" }, From a8f0f079cd794640e108a71ebd4124474c7183f3 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 20 Jul 2022 00:29:44 +0000 Subject: [PATCH 2/4] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a24f255..5d7cfc1 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ TeamPass is a Passwords Manager dedicated for managing passwords in a collaborat Teampass offers a large set of features permitting to manage your passwords and related data in an organized way in respect to the access rights defined for each users. -**Shipped version:** 2.1.27.15~ynh3 +**Shipped version:** 3.0.0.17~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 2de888e..5228ec8 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ TeamPass est un gestionnaire de mots de passe dédié à la gestion des mots de Teampass offre un large ensemble de fonctionnalités permettant de gérer vos mots de passe et les données associées de manière organisée dans le respect des droits d'accès définis pour chaque utilisateur. -**Version incluse :** 2.1.27.15~ynh3 +**Version incluse :** 3.0.0.17~ynh1 ## Captures d'écran From 77a48629b507ee91aabddb71b39fa3f47d60bd00 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 23 Jul 2022 00:41:42 +0200 Subject: [PATCH 3/4] fix missing /backups --- scripts/install | 1 + scripts/upgrade | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index bb0e5e9..746e017 100644 --- a/scripts/install +++ b/scripts/install @@ -223,6 +223,7 @@ chown -R $app:www-data "$final_path" # Sauf certains dossiers includes, files et upload chown -R $app $final_path/{includes,files,upload} # Restreint l'accès au dossier de backup +mkdir -p $final_path/backups chmod 750 $final_path/backups #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5e482b6..b13c826 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -190,6 +190,7 @@ if [ -d "$final_path/install" ]; then fi # Restreint l'accès au dossier de backup +mkdir -p $final_path/backups chmod 750 $final_path/backups #================================================= From ae7e43b1a26dbd3e905b5588fb475303e9ddf4c5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 24 Jul 2022 15:39:53 +0200 Subject: [PATCH 4/4] Fixes --- conf/populate.sql | 150 +++++++++++++++--- conf/settings.php | 34 ++-- conf/teampass_pre_upgrade_ynh/conf/app.src | 6 +- .../scripts/_common.sh | 22 +++ conf/teampass_pre_upgrade_ynh/scripts/install | 10 +- conf/teampass_pre_upgrade_ynh/scripts/remove | 8 + scripts/_common.sh | 9 +- scripts/install | 37 ++--- scripts/remove | 8 + scripts/restore | 10 ++ scripts/upgrade | 7 + 11 files changed, 245 insertions(+), 56 deletions(-) create mode 100644 conf/teampass_pre_upgrade_ynh/scripts/_common.sh diff --git a/conf/populate.sql b/conf/populate.sql index b517d78..98c9ced 100644 --- a/conf/populate.sql +++ b/conf/populate.sql @@ -5,6 +5,61 @@ ALTER DATABASE `__APP__` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE `__APP__`; +CREATE TABLE IF NOT EXISTS `teampass_defuse_passwords` ( + `increment_id` int(12) NOT NULL AUTO_INCREMENT, + `type` varchar(100) NOT NULL, + `object_id` int(12) NOT NULL, + `password` text NOT NULL, + PRIMARY KEY (`increment_id`) +) CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `teampass_notification` ( + `increment_id` INT(12) NOT NULL AUTO_INCREMENT, + `item_id` INT(12) NOT NULL, + `user_id` INT(12) NOT NULL, + PRIMARY KEY (`increment_id`) +) CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `teampass_sharekeys_items` ( + `increment_id` int(12) NOT NULL AUTO_INCREMENT, + `object_id` int(12) NOT NULL, + `user_id` int(12) NOT NULL, + `share_key` text NOT NULL, + PRIMARY KEY (`increment_id`) +) CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `teampass_sharekeys_logs` ( + `increment_id` int(12) NOT NULL AUTO_INCREMENT, + `object_id` int(12) NOT NULL, + `user_id` int(12) NOT NULL, + `share_key` text NOT NULL, + PRIMARY KEY (`increment_id`) +) CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `teampass_sharekeys_fields` ( + `increment_id` int(12) NOT NULL AUTO_INCREMENT, + `object_id` int(12) NOT NULL, + `user_id` int(12) NOT NULL, + `share_key` text NOT NULL, + PRIMARY KEY (`increment_id`) +) CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `teampass_sharekeys_suggestions` ( + `increment_id` int(12) NOT NULL AUTO_INCREMENT, + `object_id` int(12) NOT NULL, + `user_id` int(12) NOT NULL, + `share_key` text NOT NULL, + PRIMARY KEY (`increment_id`) +) CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `teampass_sharekeys_files` ( + `increment_id` int(12) NOT NULL AUTO_INCREMENT, + `object_id` int(12) NOT NULL, + `user_id` int(12) NOT NULL, + `share_key` text NOT NULL, + PRIMARY KEY (`increment_id`) +) CHARSET=utf8; + CREATE TABLE IF NOT EXISTS `teampass_items` ( `id` int(12) NOT null AUTO_INCREMENT, `label` varchar(500) NOT NULL, @@ -26,6 +81,7 @@ CREATE TABLE IF NOT EXISTS `teampass_items` ( `auto_update_pwd_frequency` tinyint(2) NOT null DEFAULT '0', `auto_update_pwd_next_date` varchar(100) NOT null DEFAULT '0', `encryption_type` VARCHAR(20) NOT NULL DEFAULT 'not_set', + `fa_icon` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`), KEY `restricted_inactif_idx` (`restricted_to`,`inactif`) ) CHARSET=utf8; @@ -68,9 +124,8 @@ INSERT INTO `teampass_misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'manager_edit', '1'), ('admin', 'cpassman_dir', '__FINALPATH__'), ('admin', 'cpassman_url', 'https://__DOMAIN____PATH__'), -('admin', 'favicon', 'https://__DOMAIN____PATH__/favico.ico'), +('admin', 'favicon', 'https://__DOMAIN____PATH__/favicon.ico'), ('admin', 'path_to_upload_folder', '__FINALPATH__/upload'), -('admin', 'url_to_upload_folder', 'https://__DOMAIN____PATH__/upload'), ('admin', 'path_to_files_folder', '__FINALPATH__/files'), ('admin', 'url_to_files_folder', 'https://__DOMAIN____PATH__/files'), ('admin', 'activate_expiration', '0'), @@ -154,7 +209,7 @@ INSERT INTO `teampass_misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'duo', '0'), ('admin', 'enable_server_password_change', '0'), ('admin', 'ldap_object_class', 'person'), -('admin', 'bck_script_path', '__FINALPATH__/backups/'), +('admin', 'bck_script_path', '__FINALPATH__/backups'), ('admin', 'bck_script_filename', 'bck_teampass'), ('admin', 'syslog_enable', '0'), ('admin', 'syslog_host', 'localhost'), @@ -174,7 +229,37 @@ INSERT INTO `teampass_misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'disable_show_forgot_pwd_link', '1'), ('admin', 'offline_key_level', '0'), ('admin', 'enable_http_request_login', '0'), -('admin', 'ldap_and_local_authentication', '0'); +('admin', 'ldap_and_local_authentication', '0'), +('admin', 'secure_display_image', '1'), +('admin', 'upload_zero_byte_file', '0'), +('admin', 'upload_all_extensions_file', '0'), +('admin', 'bck_script_passkey', ''), +('admin', 'admin_2fa_required', '1'), +('admin', 'password_overview_delay', '4'), +('admin', 'copy_to_clipboard_small_icons', '1'), +('admin', 'duo_akey', ''), +('admin', 'duo_ikey', ''), +('admin', 'duo_skey', ''), +('admin', 'duo_host', ''), +('admin', 'teampass_version', ''), +('admin', 'roles_allowed_to_print_select', ''), +('admin', 'clipboard_life_duration', '30'), +('admin', 'mfa_for_roles', ''), +('admin', 'tree_counters', '0'), +('admin', 'settings_offline_mode', '0'), +('admin', 'settings_tree_counters', '0'), +('admin', 'enable_massive_move_delete', '0'), +('admin', 'email_debug_level', '0'), +('admin', 'ga_reset_by_user', ''), +('admin', 'onthefly-backup-key', ''), +('admin', 'onthefly-restore-key', ''), +('admin', 'ldap_user_dn_attribute', ''), +('admin', 'ldap_dn_additional_user_dn', ''), +('admin', 'ldap_user_object_filter', ''), +('admin', 'ldap_bdn', ''), +('admin', 'ldap_hosts', ''), +('admin', 'ldap_password', ''), +('admin', 'ldap_username', ''); -- Default value --('admin', 'enable_pf_feature', '0'), --('admin', 'log_connections', '1'), @@ -220,7 +305,9 @@ CREATE TABLE IF NOT EXISTS `teampass_nested_tree` ( `bloquer_creation` tinyint(1) NOT null DEFAULT '0', `bloquer_modification` tinyint(1) NOT null DEFAULT '0', `personal_folder` tinyint(1) NOT null DEFAULT '0', - `renewal_period` TINYINT(4) NOT null DEFAULT '0', + `renewal_period` int(5) NOT NULL DEFAULT 0, + `fa_icon` varchar(100) NOT NULL DEFAULT 'fas fa-folder', + `fa_icon_selected` varchar(100) NOT NULL DEFAULT 'fas fa-folder-open', PRIMARY KEY (`id`), KEY `nested_tree_parent_id` (`parent_id`), KEY `nested_tree_nleft` (`nleft`), @@ -229,7 +316,7 @@ CREATE TABLE IF NOT EXISTS `teampass_nested_tree` ( KEY `personal_folder_idx` (`personal_folder`) ) CHARSET=utf8; -INSERT INTO teampass_nested_tree VALUES("1","0","__FOLDERS__","1","2","1","0","0","0","0"); +INSERT INTO teampass_nested_tree VALUES("1","0","__FOLDERS__","1","2","1","0","0","0","0","0","0"); CREATE TABLE IF NOT EXISTS `teampass_rights` ( `id` int(12) NOT null AUTO_INCREMENT, @@ -243,19 +330,19 @@ CREATE TABLE IF NOT EXISTS `teampass_users` ( `id` int(12) NOT null AUTO_INCREMENT, `login` varchar(50) NOT NULL, `pw` varchar(400) NOT NULL, - `groupes_visibles` varchar(250) NOT NULL, + `groupes_visibles` varchar(1000) NOT NULL, `derniers` text NULL, `key_tempo` varchar(100) NULL, `last_pw_change` varchar(30) NULL, `last_pw` text NULL, `admin` tinyint(1) NOT null DEFAULT '0', - `fonction_id` varchar(255) NULL, - `groupes_interdits` varchar(255) NULL, + `fonction_id` varchar(1000) NULL, + `groupes_interdits` varchar(1000) NULL, `last_connexion` varchar(30) NULL, `gestionnaire` int(11) NOT null DEFAULT '0', `email` varchar(300) NOT NULL DEFAULT 'none', - `favourites` varchar(300) NULL, - `latest_items` varchar(300) NULL, + `favourites` varchar(1000) NULL, + `latest_items` varchar(1000) NULL, `personal_folder` int(1) NOT null DEFAULT '0', `disabled` tinyint(1) NOT null DEFAULT '0', `no_bad_attempts` tinyint(1) NOT null DEFAULT '0', @@ -270,8 +357,8 @@ CREATE TABLE IF NOT EXISTS `teampass_users` ( `psk` varchar(400) NULL, `ga` varchar(50) NULL, `ga_temporary_code` VARCHAR(20) NOT NULL DEFAULT 'none', - `avatar` varchar(255) NULL, - `avatar_thumb` varchar(255) NULL, + `avatar` varchar(1000) NULL, + `avatar_thumb` varchar(1000) NULL, `upgrade_needed` BOOLEAN NOT NULL DEFAULT FALSE, `treeloadstrategy` varchar(30) NOT null DEFAULT 'full', `can_manage_all_users` tinyint(1) NOT NULL DEFAULT '0', @@ -279,13 +366,22 @@ CREATE TABLE IF NOT EXISTS `teampass_users` ( `agses-usercardid` VARCHAR(50) NOT NULL DEFAULT '0', `encrypted_psk` text NULL, `user_ip` varchar(400) NOT null DEFAULT 'none', + `user_ip_lastdate` varchar(50) NULL DEFAULT NULL, `user_api_key` varchar(500) NOT null DEFAULT 'none', + `yubico_user_key` varchar(100) NOT null DEFAULT 'none', + `yubico_user_id` varchar(100) NOT null DEFAULT 'none', + `public_key` TEXT DEFAULT NULL, + `private_key` TEXT DEFAULT NULL, + `special` VARCHAR(250) NOT NULL DEFAULT 'none', + `auth_type` VARCHAR(200) NOT NULL DEFAULT 'local', PRIMARY KEY (`id`), UNIQUE KEY `login` (`login`) ) CHARSET=utf8; -INSERT INTO `teampass_users` (`id`, `login`, `pw`, `admin`, `gestionnaire`, `personal_folder`, `groupes_visibles`, `email`, `encrypted_psk`, `last_pw_change`) VALUES -('1', 'admin', '__BCRYPT_MDP__', '1', '0', '0', '', '', '', '__TIME__'); +INSERT INTO `teampass_users` (`id`, `login`, `pw`, `groupes_visibles`, `derniers`, `key_tempo`, `last_pw_change`, `last_pw`, `admin`) VALUES +(1, 'admin', '__BCRYPT_MDP__', '1', NULL, '', '__TIME__', NULL, 1), +(9999991, 'OTV', '', '', '', '', '', '', 1), +(9999999, 'API', '', '', '', '', '', '', 1); CREATE TABLE IF NOT EXISTS `teampass_tags` ( `id` int(12) NOT null AUTO_INCREMENT, @@ -307,12 +403,14 @@ CREATE TABLE IF NOT EXISTS `teampass_log_system` ( CREATE TABLE IF NOT EXISTS `teampass_files` ( `id` int(11) NOT null AUTO_INCREMENT, `id_item` int(11) NOT NULL, - `name` varchar(100) NOT NULL, + `name` TEXT NOT NULL, `size` int(10) NOT NULL, `extension` varchar(10) NOT NULL, `type` varchar(255) NOT NULL, `file` varchar(50) NOT NULL, `status` varchar(50) NOT NULL DEFAULT '0', + `content` longblob DEFAULT NULL, + `confirmed` INT(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) CHARSET=utf8; @@ -325,7 +423,7 @@ CREATE TABLE IF NOT EXISTS `teampass_cache` ( `id_tree` int(12) NOT NULL, `perso` tinyint(1) NOT NULL, `restricted_to` varchar(200) DEFAULT NULL, - `login` varchar(200) DEFAULT NULL, + `login` text DEFAULT NULL, `folder` varchar(300) NOT NULL, `author` varchar(50) NOT NULL, `renewal_period` tinyint(4) NOT NULL DEFAULT '0', @@ -406,6 +504,7 @@ INSERT INTO `teampass_languages` (`name`, `label`, `code`, `flag`) VALUES ('turkish', 'Turkish' , 'tr', 'tr.png'), ('norwegian', 'Norwegian' , 'no', 'no.png'), ('japanese', 'Japanese' , 'ja', 'ja.png'), +('portuguese', 'Portuguese', 'pr', 'pr.png'), ('portuguese_br', 'Portuguese (Brazil)' , 'pr-bt', 'pr-bt.png'), ('chinese', 'Chinese' , 'cn', 'cn.png'), ('swedish', 'Swedish' , 'se', 'se.png'), @@ -454,8 +553,11 @@ CREATE TABLE IF NOT EXISTS `teampass_categories` ( `level` int(2) NOT NULL, `description` text NULL, `type` varchar(50) NULL default '', + `masked` tinyint(1) NOT NULL DEFAULT 0, `order` int(12) NOT NULL default '0', `encrypted_data` tinyint(1) NOT NULL default '1', + `role_visibility` varchar(255) NOT NULL DEFAULT 'all', + `is_mandatory` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) CHARSET=utf8; @@ -466,13 +568,15 @@ CREATE TABLE IF NOT EXISTS `teampass_categories_items` ( `data` text NOT NULL, `data_iv` text NOT NULL, `encryption_type` VARCHAR(20) NOT NULL DEFAULT 'not_set', + `is_mandatory` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) CHARSET=utf8; CREATE TABLE IF NOT EXISTS `teampass_categories_folders` ( + `increment_id` int(12) NOT NULL AUTO_INCREMENT, `id_category` int(12) NOT NULL, `id_folder` int(12) NOT NULL, - PRIMARY KEY (`id_category`) + PRIMARY KEY (`increment_id`) ) CHARSET=utf8; CREATE TABLE IF NOT EXISTS `teampass_api` ( @@ -490,6 +594,7 @@ CREATE TABLE IF NOT EXISTS `teampass_otv` ( `code` varchar(100) NOT NULL, `item_id` int(12) NOT NULL, `originator` int(12) NOT NULL, + `encrypted` text NOT NULL, PRIMARY KEY (`id`) ) CHARSET=utf8; @@ -523,7 +628,7 @@ CREATE TABLE IF NOT EXISTS `teampass_export` ( ) CHARSET=utf8; CREATE TABLE IF NOT EXISTS `teampass_tokens` ( - `id` int(12) NOT NULL, + `id` int(12) NOT NULL AUTO_INCREMENT, `user_id` int(12) NOT NULL, `token` varchar(255) NOT NULL, `reason` varchar(255) NOT NULL, @@ -547,3 +652,10 @@ CREATE TABLE IF NOT EXISTS `teampass_items_change` ( `timestamp` varchar(50) NOT NULL DEFAULT 'none', PRIMARY KEY (`id`) ) CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `teampass_templates` ( + `increment_id` int(12) NOT NULL AUTO_INCREMENT, + `item_id` int(12) NOT NULL, + `category_id` int(12) NOT NULL, + PRIMARY KEY (`increment_id`) +) CHARSET=utf8; diff --git a/conf/settings.php b/conf/settings.php index 20660a8..626a660 100644 --- a/conf/settings.php +++ b/conf/settings.php @@ -1,18 +1,28 @@ "", + "cert" => "", + "ca_cert" => "", + "ca_path" => "", + "cipher" => "" +)); +define("DB_CONNECT_OPTIONS", array( + MYSQLI_OPT_CONNECT_TIMEOUT => 10 +)); +define("SECUREPATH", "/etc/__APP__/"); -### DATABASE connexion parameters ### -$server = "localhost"; -$user = "__DB_USER__"; -$pass = "__DB_PWD__"; -$database = "__DB_NAME__"; -$pre = "teampass_"; -$port = 3306; -$encoding = "utf8"; +if (isset($_SESSION['settings']['timezone']) === true) { + date_default_timezone_set($_SESSION['settings']['timezone']); +} -@date_default_timezone_set($_SESSION['settings']['timezone']); -@define('SECUREPATH', '/etc/__APP__/'); if (file_exists("/etc/__APP__/sk.php")) { require_once "/etc/__APP__/sk.php"; } diff --git a/conf/teampass_pre_upgrade_ynh/conf/app.src b/conf/teampass_pre_upgrade_ynh/conf/app.src index 09692c6..9e74ab5 100644 --- a/conf/teampass_pre_upgrade_ynh/conf/app.src +++ b/conf/teampass_pre_upgrade_ynh/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/nilsteampassnet/TeamPass/archive/2.1.27.11.tar.gz -SOURCE_SUM=b1dd6cad9d470cb298b9b3e9a5f0df43 -SOURCE_SUM_PRG=md5sum +SOURCE_URL=https://github.com/nilsteampassnet/TeamPass/archive/refs/tags/3.0.0.17.tar.gz +SOURCE_SUM=4a4eee3cce68fd3168716da0a5e770db04269cef97c3fc26d0032f5c47b745db +SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= diff --git a/conf/teampass_pre_upgrade_ynh/scripts/_common.sh b/conf/teampass_pre_upgrade_ynh/scripts/_common.sh new file mode 100644 index 0000000..3957507 --- /dev/null +++ b/conf/teampass_pre_upgrade_ynh/scripts/_common.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +#================================================= +# COMMON VARIABLES +#================================================= + +YNH_PHP_VERSION="7.4" + +# dependencies used by the app +pkg_dependencies="php$YNH_PHP_VERSION-mbstring php$YNH_PHP_VERSION-bcmath php$YNH_PHP_VERSION-iconv php$YNH_PHP_VERSION-xml php$YNH_PHP_VERSION-gd php$YNH_PHP_VERSION-curl php$YNH_PHP_VERSION-mysqli" + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/conf/teampass_pre_upgrade_ynh/scripts/install b/conf/teampass_pre_upgrade_ynh/scripts/install index 27db3e6..7344c4b 100644 --- a/conf/teampass_pre_upgrade_ynh/scripts/install +++ b/conf/teampass_pre_upgrade_ynh/scripts/install @@ -1,11 +1,12 @@ #!/bin/bash #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -48,6 +49,13 @@ ynh_app_setting_set $app path $path_url #================================================= # STANDARD MODIFICATIONS +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # CREATE A SQL BDD #================================================= diff --git a/conf/teampass_pre_upgrade_ynh/scripts/remove b/conf/teampass_pre_upgrade_ynh/scripts/remove index a19444c..d721fb9 100644 --- a/conf/teampass_pre_upgrade_ynh/scripts/remove +++ b/conf/teampass_pre_upgrade_ynh/scripts/remove @@ -43,6 +43,14 @@ ynh_remove_nginx_config # Suppression de la configuration nginx ynh_remove_fpm_config # Suppression de la configuration du pool php-fpm +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/_common.sh b/scripts/_common.sh index c7189cd..3957507 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,10 @@ # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="7.3" +YNH_PHP_VERSION="7.4" + +# dependencies used by the app +pkg_dependencies="php$YNH_PHP_VERSION-mbstring php$YNH_PHP_VERSION-bcmath php$YNH_PHP_VERSION-iconv php$YNH_PHP_VERSION-xml php$YNH_PHP_VERSION-gd php$YNH_PHP_VERSION-curl php$YNH_PHP_VERSION-mysqli" #================================================= # PERSONAL HELPERS @@ -13,3 +16,7 @@ YNH_PHP_VERSION="7.3" #================================================= # EXPERIMENTAL HELPERS #================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/install b/scripts/install index 746e017..0844bf0 100644 --- a/scripts/install +++ b/scripts/install @@ -50,6 +50,13 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # STANDARD MODIFICATIONS +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # CREATE DEDICATED USER #================================================= @@ -108,7 +115,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Filling the database..." -version="$(sed -n 3p $final_path/changelog.txt)" +version=$(ynh_app_upstream_version) bcrypt_mdp="$(php $final_path/mdphash.php $password)" timezone="$(cat /etc/timezone)" time="$(date +%s)" @@ -134,25 +141,6 @@ ynh_app_setting_set --app=$app --key=langue --value=$langue ynh_mysql_connect_as $db_name $db_pwd $db_name < $final_path/populate.sql ynh_secure_remove --file="$final_path/populate.sql" -#================================================= -# CREATE TP.CONFIG.PHP FILE -#================================================= -ynh_script_progression --message="Creating tp.config.php file..." - -# The file tp.config.php is a dump of the admin part of the database. -tp_config_file="$final_path/includes/config/tp.config.php" - -echo " $tp_config_file - -while read settings -do - echo -n " '$(echo $settings | awk '{ print $1 }')'" >> $tp_config_file - echo " => '$(echo $settings | cut -d' ' -f2-)'," >> $tp_config_file -done <<< "$(ynh_mysql_execute_as_root "SELECT intitule, valeur FROM teampass_misc" $app)" -echo ");" >> $tp_config_file - #================================================= # ADD A CONFIGURATION #================================================= @@ -160,6 +148,15 @@ ynh_script_progression --message="Adding a configuration file..." ynh_add_config --template="../conf/settings.php" --destination="$final_path/includes/config/settings.php" +#================================================= +# CREATE TP.CONFIG.PHP FILE +#================================================= +ynh_script_progression --message="Creating tp.config.php file..." + +pushd $final_path + ynh_exec_as $app php$phpversion ./maketpconfig.php +popd + #================================================= # CREATE A SALTKEY #================================================= diff --git a/scripts/remove b/scripts/remove index bfb799a..5b38064 100644 --- a/scripts/remove +++ b/scripts/remove @@ -55,6 +55,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index 5d0d0b4..9e4a571 100644 --- a/scripts/restore +++ b/scripts/restore @@ -68,6 +68,16 @@ chown -R $app:www-data "$final_path" # Sauf les dossiers includes, files et upload chown -R $app $final_path/{includes,files,upload} +#================================================= +# SPECIFIC RESTORATION +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b13c826..0f9821c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,6 +95,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # PHP-FPM CONFIGURATION #=================================================