mirror of
https://github.com/YunoHost-Apps/my_capsule_ynh.git
synced 2024-09-03 19:46:21 +02:00
87 lines
2.7 KiB
Bash
Executable file
87 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source ynh_apps
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# CREATE DEDICATED USER
|
|
#=================================================
|
|
ynh_script_progression --message="Installing Gemserv..."
|
|
|
|
# ynh_install_apps --apps="gemserv"
|
|
|
|
#=================================================
|
|
# CREATE DEDICATED USER
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring system user..."
|
|
|
|
if [ "$with_sftp" -eq 1 ]; then
|
|
usermod -a -G "sftp.app" "$app"
|
|
fi
|
|
|
|
if [ -n "$password" ]; then
|
|
# Add the password to this user
|
|
chpasswd <<< "${app}:${password}"
|
|
# By default, passwords are not saved
|
|
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
|
fi
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..."
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir/www/htmgem"
|
|
|
|
chmod o-rwx "$install_dir"
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
# Home directory of the user needs to be owned by $app to allow SFTP connections
|
|
chown "$app:$app" "$install_dir"
|
|
setfacl -m g:"$app":r-x "$install_dir"
|
|
setfacl -m g:"www-data":r-x "$install_dir"
|
|
setfacl -m g:"gemserv":r-x "$install_dir"
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# BUILD DEFAULT CAPSULE
|
|
#=================================================
|
|
ynh_script_progression --message="Building default capsule..."
|
|
|
|
if [ "$with_sftp" -eq 1 ]; then
|
|
ynh_add_config --template="index.gmi" --destination="$install_dir/www/index.gmi"
|
|
else
|
|
ynh_add_config --template="index_no_sftp.gmi" --destination="$install_dir/www/index.gmi"
|
|
fi
|
|
|
|
chmod 644 "$install_dir/www/index.gmi"
|
|
chown "$app:$app" "$install_dir/www/index.gmi"
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
ynh_add_fpm_config
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated Gemserv config
|
|
_ynh_add_gemserv_config
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed"
|