diff --git a/conf/instance.txt b/conf/instance.txt new file mode 100644 index 0000000..8f33432 --- /dev/null +++ b/conf/instance.txt @@ -0,0 +1,22 @@ +INSERT INTO instances ( + public_domain, + name, + local, + long_description, + short_description, + default_license, + open_registrations, + short_description_html, + long_description_html +) VALUES ( + domain_name, + instance_name, + 't', + '', + '', + 'CC-0', + 't', + '', + '' +); + diff --git a/conf/pass.txt b/conf/pass.txt new file mode 100644 index 0000000..867a8d0 --- /dev/null +++ b/conf/pass.txt @@ -0,0 +1,47 @@ +/* to generate the password, in a shell */ + +apt install python-bcrypt +python -c 'import bcrypt; print(bcrypt.hashpw("PASSWORD", bcrypt.gensalt(log_rounds=10)))' + +/* to generate the keypair, in a shell */ + +openssl genrsa -passout pass:PASSWORD -out private.pem 2048 +openssl rsa -in private.pem -passin pass:PASSWORD -pubout -out public.pub + +/** private.pem now contains the private key, public.pub the public one **/ + +/* SQL command to create the user */ + +INSERT INTO users ( + username, + display_name, + outbox_url, + inbox_url, + is_admin, + summary, + email, + hashed_password, + instance_id, + ap_url, + public_key, + private_key, + shared_inbox_url, + followers_endpoint, + avatar_id, +) VALUES ( + username, + display_name, + 'https://' || domain_name || '/@/' || username || '/outbox', + 'https://' || domain_name || '/@/' || username || '/inbox', + 't', + 'Admin of ' || instance_name, + email, + hashed_password, + 1, + 'https://' || domain_name || '/@/' || username, + pub_key, + priv_key, + 'https://' || domain_name || '/inbox', + 'https://' || domain_name || '/inbox', + NULL +); diff --git a/scripts/install b/scripts/install index b04dfd2..d8e909d 100755 --- a/scripts/install +++ b/scripts/install @@ -160,18 +160,6 @@ ynh_replace_string "__DB_USER__" "$app" "$final_path/.env" # Set right permissions chown -R $app: $final_path -# spawn test -pass="test" -blog_name="test" -admin="test" -email="test@domain.tld" -admin_pass="test123" - -# Copy first run script -cp ../conf/first_run.exp $final_path -chmod +x $final_path/first_run.exp - - # We escape all char witch needed. ynh_replace_special_string "__PASSWORD__" $pass "$final_path/first_run.exp" ynh_replace_special_string "__ADMIN_PASS__" $admin_pass "$final_path/first_run.exp" @@ -195,7 +183,7 @@ ynh_secure_remove "$final_path/first_launch.exp" ### - And the section "SETUP SYSTEMD" in the upgrade script # Create a dedicated systemd config -ynh_add_systemd_config +# ynh_add_systemd_config #=================================================