mirror of
https://github.com/YunoHost-Apps/freescout_ynh.git
synced 2024-09-03 18:36:23 +02:00
coding style, example_ynh
This commit is contained in:
parent
e1693be91a
commit
04f75b5832
6 changed files with 53 additions and 84 deletions
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,7 +7,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
|
@ -18,14 +15,14 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
|
|||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="APP_URL=https://$old_domain" --replace_string="APP_URL=https://$new_domain" --target_file=$install_dir/.env
|
||||
ynh_replace_string --match_string="APP_URL=https://$old_domain" --replace_string="APP_URL=https://$new_domain" \
|
||||
--target_file="$install_dir/.env"
|
||||
|
||||
pushd $install_dir
|
||||
php$phpversion artisan freescout:clear-cache
|
||||
pushd "$install_dir"
|
||||
"php$phpversion" artisan freescout:clear-cache
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,13 +7,15 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
firstname=$(yunohost user list --fields firstname --output-as json | jq -r .users.$admin.firstname)
|
||||
lastname=$(yunohost user list --fields lastname --output-as json | jq -r .users.$admin.lastname)
|
||||
#=================================================
|
||||
# INITIALIZE AND STORE SETTINGS
|
||||
#=================================================
|
||||
|
||||
email=$(ynh_user_get_info --username="$admin" --key="mail")
|
||||
firstname=$(ynh_user_get_info --username="$admin" --key="firstname")
|
||||
lastname=$(ynh_user_get_info --username="$admin" --key="lastname")
|
||||
timezone=$(cat /etc/timezone)
|
||||
|
||||
#=================================================
|
||||
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -23,12 +23,20 @@ ynh_script_progression --message="Setting up source files..." --weight=1
|
|||
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chmod ug=rwX,o-rwx "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
usermod -g www-data $app
|
||||
find $install_dir -type f -exec chmod 664 {} \;
|
||||
find $install_dir -type d -exec chmod 775 {} \;
|
||||
usermod -g www-data "$app"
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
|
||||
|
||||
ynh_add_config --template=".env.example" --destination="$install_dir/.env"
|
||||
|
||||
chmod 600 "$install_dir/.env"
|
||||
chown "$app:$app" "$install_dir/.env"
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
|
@ -43,32 +51,20 @@ ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
|||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template=".env.example" --destination="$install_dir/.env"
|
||||
|
||||
chmod 600 "$install_dir/.env"
|
||||
chown $app:$app "$install_dir/.env"
|
||||
|
||||
#=================================================
|
||||
# FINAL FREESCOUT INSTALL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Install $app" --weight=5
|
||||
ynh_script_progression --message="Finalizing $app installation..." --weight=1
|
||||
|
||||
pushd $install_dir
|
||||
php$phpversion artisan key:generate --no-interaction --force
|
||||
php$phpversion artisan freescout:clear-cache
|
||||
php$phpversion artisan storage:link
|
||||
php$phpversion artisan migrate --no-interaction --force
|
||||
php$phpversion artisan freescout:create-user --role=admin --firstName=$firstname --lastName=$lastname --email=$email --password=$password --no-interaction
|
||||
|
||||
chgrp -R www-data storage bootstrap/cache public/css/builds public/js/builds
|
||||
chmod -R ug+rwx storage bootstrap/cache public/css/builds public/js/builds
|
||||
pushd "$install_dir"
|
||||
"php$phpversion" artisan key:generate --no-interaction --force
|
||||
"php$phpversion" artisan freescout:clear-cache
|
||||
"php$phpversion" artisan storage:link
|
||||
"php$phpversion" artisan migrate --no-interaction --force
|
||||
"php$phpversion" artisan freescout:create-user --role="admin" --firstName="$firstname" --lastName="$lastname" --email="$email" --password="$password" --no-interaction
|
||||
|
||||
chgrp -R www-data storage bootstrap/cache public/css/builds public/js/builds
|
||||
chmod -R ug+rwx storage bootstrap/cache public/css/builds public/js/builds
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,9 +8,7 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# REMOVE SYSTEMD SERVICE
|
||||
# REMOVE SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -17,21 +15,18 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
@ -40,14 +35,12 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,23 +7,26 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
firstname=$(ynh_user_get_info --username=$admin --key=firstname)
|
||||
lastname=$(ynh_user_get_info --username=$admin --key=lastname)
|
||||
|
||||
#=================================================
|
||||
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
||||
# INITIALIZE AND STORE SETTINGS
|
||||
#=================================================
|
||||
|
||||
email=$(ynh_user_get_info --username="$admin" --key="mail")
|
||||
firstname=$(ynh_user_get_info --username="$admin" --key="firstname")
|
||||
lastname=$(ynh_user_get_info --username="$admin" --key="lastname")
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
ynh_secure_remove --file="/$install_dir/vendor"
|
||||
# FIXME: use --full_replace=1
|
||||
ynh_secure_remove --file="$install_dir/vendor"
|
||||
|
||||
ynh_setup_source --dest_dir="$install_dir" --keep='.env' #--full_replace=1
|
||||
ynh_setup_source --dest_dir="$install_dir" --keep=".env" #--full_replace=1
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
|
@ -36,26 +37,14 @@ ynh_add_fpm_config
|
|||
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
#ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
#ynh_add_config --template=".env.example" --destination="$install_dir/.env"
|
||||
|
||||
#chmod 400 "$install_dir/.env"
|
||||
#chown $app:$app "$install_dir/.env"
|
||||
|
||||
#=================================================
|
||||
# FINAL FREESCOUT INSTALL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Install $app" --weight=5
|
||||
|
||||
pushd $install_dir
|
||||
php$phpversion artisan freescout:clear-cache
|
||||
php$phpversion artisan migrate --no-interaction --force
|
||||
pushd "$install_dir"
|
||||
"php$phpversion" artisan freescout:clear-cache
|
||||
"php$phpversion" artisan migrate --no-interaction --force
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue