mirror of
https://github.com/YunoHost-Apps/linkstack_ynh.git
synced 2024-09-03 19:36:14 +02:00
55da7c3473
* Initial release * Auto-update README --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org>
82 lines
3.1 KiB
Bash
Executable file
82 lines
3.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
|
|
admin_fullname=$(ynh_user_get_info --username="$admin" --key=fullname)
|
|
|
|
#=================================================
|
|
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
|
|
|
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
|
### downloaded from an upstream source, like a git repository.
|
|
### `ynh_setup_source` use the file conf/app.src
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
# $install_dir will automatically be initialized with some decent
|
|
# permission by default ... however, you may need to recursively reapply
|
|
# ownership to all files such as after the ynh_setup_source step
|
|
chown -R $app:www-data "$install_dir"
|
|
chmod o-rwx "$install_dir" -R
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated PHP-FPM config using the conf/php-fpm.conf or conf/extra_php-fpm.conf
|
|
ynh_add_fpm_config --usage=medium --footprint=low
|
|
|
|
# Create a dedicated NGINX config using the conf/nginx.conf template
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# Automated installation process
|
|
#=================================================
|
|
|
|
# Dirty trick to bypass the manual installation process
|
|
# Use Laravel CLI to create the admin user as the installation proccess would do
|
|
# See https://github.com/LinkStackOrg/LinkStack/blob/5dbb2b182d58b79149e02ffedcd3f63ba916b3c9/app/Http/Controllers/InstallerController.php#L68-L78
|
|
|
|
pushd $install_dir
|
|
php8.1 artisan tinker --execute="""
|
|
use App\Models\User;
|
|
|
|
User::create([
|
|
'name' => '$admin_fullname',
|
|
'email' => '$admin_mail',
|
|
'email_verified_at' => '0001-01-01 00:00:00',
|
|
'password' => Hash::make('$password'),
|
|
'littlelink_name' => '$admin',
|
|
'littlelink_description' => 'admin page',
|
|
'block' => 'no',
|
|
]);
|
|
|
|
User::where('id', '1')->update(['role' => 'admin']);
|
|
"""
|
|
popd
|
|
|
|
# End of installation
|
|
ynh_secure_remove $install_dir/INSTALLING
|
|
ynh_write_var_in_file --file="$install_dir/.env" --key="APP_DEBUG" --value="false"
|
|
ynh_write_var_in_file --file="$install_dir/.env" --key="APP_ENV" --value="production"
|
|
ynh_write_var_in_file --file="$install_dir/.env" --key="NOTIFY_UPDATES" --value="false"
|
|
ynh_write_var_in_file --file="$install_dir/.env" --key="NOTIFY_EVENTS" --value="false"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
ynh_script_progression --message="Installation of $app completed" --last
|