diff --git a/scripts/restore b/scripts/restore index 5e5ace2..13f2813 100755 --- a/scripts/restore +++ b/scripts/restore @@ -21,15 +21,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK IF MINIO IS INSTALLED, IF NOT WARN USER -#================================================= -ynh_script_progression --message="Checking if MinIO is installed..." --weight=1 - -if ! yunohost app list | grep -q "id: minio"; then - ynh_die --message="We can't restore because MinIO is not installed ! Please install MinIO first" -fi - #================================================= # LOAD SETTINGS #================================================= @@ -68,6 +59,35 @@ ynh_script_progression --message="Validating restoration parameters..." --weight test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path" +#================================================= +# CHECK IF DEX IS INSTALLED, IF NOT INSTALL IT +#================================================= +ynh_script_progression --message="Installing Dex if needed..." --weight=18 + +if ! yunohost app list | grep -q "id: $dex_app"; then + echo "Dex is not installed. Installing... " + yunohost tools update + if yunohost app list | grep -q "$dex_domain$dex_path"; then + ynh_die "The domain provided for Dex is already used by another app. Please chose another one !" + fi + yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "domain=$dex_domain&path=$dex_path&OIDC_name=$oidc_name&OIDC_secret=$oidc_secret&OIDC_callback=$oidc_callback" + +fi + +#================================================= +# CHECK IF MINIO IS INSTALLED, IF NOT INSTALL IT +#================================================= +ynh_script_progression --message="Installing MinIO if needed..." --weight=18 + +if ! yunohost app list | grep -q "id: minio"; then + echo "MinIO is not installed. Installing... " + yunohost tools update + if yunohost app list | grep -q "$minio_domain"; then + ynh_die "The domain provided for MinIO is already used by another app. Please chose another one !" + fi + yunohost app install https://github.com/YunoHost-Apps/minio_ynh --force --args "domain=$minio_domain&is_public=true&admin=$minio_admin&password=$minio_password" +fi + #================================================= # STANDARD RESTORATION STEPS #=================================================