1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/borgwarehouse_ynh.git synced 2024-09-03 18:16:17 +02:00

Test with env variable

This commit is contained in:
Limezy 2024-05-06 15:11:20 +07:00
parent eb2d957e03
commit 1ebc032316
6 changed files with 32 additions and 42 deletions

View file

@ -19,18 +19,13 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup --src_path="/home/yunohost.app/$app/app"
unlink "/home/$app/app"
unlink "/home/$app/repos"
ynh_backup --src_path="/home/$app"
#================================================= #=================================================
# BACKUP THE REPOS DIRECTORY # BACKUP THE REPOS DIRECTORY
#================================================= #=================================================
ynh_backup --src_path="/home/yunohost.app/$app" --is_big ynh_backup --src_path="/home/yunohost.app/$app/repos" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

View file

@ -30,10 +30,10 @@ ynh_change_url_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template=".env" --destination="$install_dir/app/.env.local" ynh_add_config --template=".env" --destination="/home/yunohost.app/$app/app/.env.local"
chmod 400 "$install_dir/app/.env.local" chmod 400 "/home/yunohost.app/$app/app/.env.local"
chown $app:$app "$install_dir/app/.env.local" chown $app:$app "/home/yunohost.app/$app/app/.env.local"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION

View file

@ -35,22 +35,19 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir/app"
mkdir "/home/$app" && chmod 700 "/home/$app"
ln -s "$install_dir/app" "/home/$app/app"
mkdir "/home/$app/.ssh" && chmod 700 "/home/$app/.ssh"
touch "/home/$app/.ssh/authorized_keys" && chmod 600 "/home/$app/.ssh/authorized_keys"
mkdir "/home/yunohost.app/$app" && chmod 700 "/home/yunohost.app/$app" mkdir "/home/yunohost.app/$app" && chmod 700 "/home/yunohost.app/$app"
ln -s "/home/yunohost.app/$app" "/home/$app/repos" && chmod 700 "/home/$app/repos"
chown -R $app:www-data "$install_dir" # Download, check integrity, uncompress and patch the source from manifest.toml
chown -R $app:www-data "/home/$app" ynh_setup_source --dest_dir="/home/yunohost.app/$app/app"
chmod 700 "/home/$app/app/helpers/shells/"* chmod 700 "/home/yunohost.app/$app"
mkdir "/home/yunohost.app/$app/.ssh" && chmod 700 "/home/yunohost.app/$app/.ssh"
touch "/home/yunohost.app/$app/.ssh/authorized_keys" && chmod 600 "/home/yunohost.app/$app/.ssh/authorized_keys"
chown -R $app:www-data "/home/yunohost.app/$app"
chmod 700 "/home/yunohost.app/$app/app/helpers/shells/"*
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
@ -74,17 +71,17 @@ yunohost service add $app --description="WebUI for BorgBackup" --log="/var/log/$
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template=".env" --destination="$install_dir/app/.env.local" ynh_add_config --template=".env" --destination="home/yunohost.app/$app/app/.env.local"
chmod 400 "$install_dir/app/.env.local" chmod 400 "/home/yunohost.app/$app/app/.env.local"
chown $app:$app "$install_dir/app/.env.local" chown $app:$app "/home/yunohost.app/$app/app/.env.local"
#================================================= #=================================================
# INSTALL BORGWARHOUSE # INSTALL BORGWARHOUSE
#================================================= #=================================================
ynh_script_progression --message="Installing $app..." --weight=10 ynh_script_progression --message="Installing $app..." --weight=10
pushd $install_dir/app pushd /home/yunohost.app/$app/app
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm ci ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm ci
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $ynh_npm run build ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production $ynh_npm run build

View file

@ -31,8 +31,6 @@ ynh_remove_nodejs
ynh_secure_remove --file="/etc/cron.d/$app" ynh_secure_remove --file="/etc/cron.d/$app"
ynh_secure_remove --file="/home/$app"
ynh_secure_remove --file="/home/yunohost.app/$app" ynh_secure_remove --file="/home/yunohost.app/$app"
#================================================= #=================================================

View file

@ -15,17 +15,17 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$install_dir" mkdir -p "/home/yunohost.app/$app" && chmod 700 "/home/yunohost.app/$app"
chown -R $app:www-data "$install_dir" ynh_restore_file --origin_path="/home/yunohost.app/$app/app"
ynh_restore_file --origin_path="/home/$app" chown -R $app:www-data "/home/yunohost.app/$app/app"
ynh_restore_file --origin_path="/home/yunohost.app/$app" --not_mandatory
chown -R $app:www-data "/home/$app" ynh_restore_file --origin_path="/home/yunohost.app/$app/repos" --not_mandatory
chown -R $app:www-data "/home/yunohost.app/$app"
ln -s "/home/yunohost.app/$app" "/home/$app/repos" && chmod 700 "/home/$app/repos" chown -R $app:www-data "/home/yunohost.app/$app/repos"
ln -s "$install_dir/app" "/home/$app/app" && chmod 700 "/home/$app/app"
chmod 700 "/home/yunohost.app/$app"
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES

View file

@ -37,10 +37,10 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from manifest.toml # Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir" --keep="app/.env.local app/config/users.json app/config/repo.json" ynh_setup_source --dest_dir="/home/yunohost.app/$app/app" --keep="app/.env.local app/config/users.json app/config/repo.json"
fi fi
chown -R $app:www-data "$install_dir" chown -R $app:www-data "/home/yunohost.app/$app/app"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
@ -60,10 +60,10 @@ yunohost service add $app --description="WebUI for BorgBackup" --log="/var/log/$
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template=".env" --destination="$install_dir/app/.env.local" ynh_add_config --template=".env" --destination="/home/yunohost.app/$app/app/.env.local"
chmod 400 "$install_dir/app/.env.local" chmod 400 "/home/yunohost.app/$app/app/.env.local"
chown $app:$app "$install_dir/app/.env.local" chown $app:$app "/home/yunohost.app/$app/app/.env.local"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE