From adb5d3b94c3ad83ee51cb303f6baa9d217773cb6 Mon Sep 17 00:00:00 2001 From: Boudewijn Date: Sun, 2 Mar 2025 22:19:18 +0100 Subject: [PATCH] first attempt at preseeding the app with user credentials --- manifest.toml | 18 +++++++++++------- scripts/install | 24 +++++------------------- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/manifest.toml b/manifest.toml index b9d4615..6c277fa 100644 --- a/manifest.toml +++ b/manifest.toml @@ -4,7 +4,7 @@ packaging_format = 2 id = "my_idlers" name = "My Idlers" -description.en = "A self-hosted web app for displaying, organizing and storing information about your servers (VPS/Dedi), shared & reseller hosting, seedboxes, domains, DNS and misc services." +description.en = "A self-hosted web app for displaying, organizing and storing information about your servers (VPS/Dedi), shared & reseller hosting, seedboxes, domains, DNS and misc services. Are you the person in your family, group of friends or at work who keeps an eye on everyones Yunohosts, then this is the app to help you." description.fr = "Une application Web auto-hébergée pour afficher, organiser et stocker des informations sur vos serveurs (VPS/Dedi), votre hébergement partagé et revendeur, vos seedboxes, vos domaines, vos DNS et divers services." version = "3.0~ynh1" @@ -46,12 +46,16 @@ ram.runtime = "100M" default = "all_users" # for now no credentials configured, make it install first -# [install.admin] -# type = "user" -# [install.password] -# help.en = "Use the help field to add an information for the admin about this question." -# help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." -# type = "password" + [install.name] + help.en = "The name of the user" + type = "text" + [install.email] + help.en = "The email address used for logging in to the application" + type = "email" + [install.password] + help.en = "Use the help field to add an information for the admin about this question." + help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." + type = "password" [resources] # See the packaging documentation for the full set diff --git a/scripts/install b/scripts/install index 429ed9f..4b3333f 100755 --- a/scripts/install +++ b/scripts/install @@ -44,6 +44,9 @@ ynh_config_add --template=.env --destination="$install_dir/.env" chmod 640 "$install_dir/.env" chown "$app:www-data" "$install_dir/.env" +# Inject CreateUser.php into app/Console/Commands/ to extend the upstream version with this functionality +# Using this, we can create the user with the credentials provided +ynh_config_add --template=CreateUser.php --destination="$install_dir/app/Console/Commands/CreateUser.php" #================================================= # SYSTEM CONFIGURATION @@ -97,7 +100,7 @@ pushd "$install_dir" "php$php_version" artisan migrate:fresh --seed -n --force "php$php_version" artisan config:clear -n "php$php_version" artisan config:cache -n - #"php$php_version" artisan lychee:create_user "$admin" "$password" + "php$php_version" artisan app:create-user "$name" "$email" "$password" popd @@ -122,24 +125,7 @@ chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public" "$ # Installation with curl ynh_script_progression "Finalizing installation..." -#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression "Starting $app's systemd service..." - -### `ynh_systemctl` is used to start a systemd service for an app. -### Only needed if you have configure a systemd service -### If you're not using these lines: -### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script -### - As well as the section "START SYSTEMD SERVICE" in the restore script -### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script -### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script - -# Start a systemd service -ynh_systemctl --service="nginx" --action="reload" -ynh_systemctl --service="php$php_version-fpm" --action="reload" +#ynh_local_curl "/INSTALL_PATH" "key1=$name" "key2=$email" "key3=$password" "key4=$password" #================================================= # END OF SCRIPT