#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # INSTALL NODEJS #================================================= ynh_script_progression --message="Installing NodeJS..." --weight=3 ynh_install_nodejs --nodejs_version=$nodejs_version ynh_use_nodejs #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=6 # Download, check integrity, uncompress and patch the source from amd64.src ynh_setup_source --dest_dir="$install_dir/package" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" #================================================= # ADD SSH ACCESS #================================================= if [ -n "$public_key" ]; then ynh_script_progression --message="Enabling ssh access for dev..." --weight=1 # enable ssh access to the files for updates # todo: Secure it more with https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh mkdir --parents "$install_dir/.ssh" ynh_add_config --template="authorized_keys" --destination="$install_dir/.ssh/authorized_keys" chown -R "$app:$app" "$install_dir/.ssh" chmod 700 "$install_dir/.ssh" chmod 600 "$install_dir/.ssh/authorized_keys" _install_restart_script_and_sudoers fi #================================================= # Install chromium #================================================= if [ $install_chromium -eq 1 ]; then ynh_script_progression --message="Installing Chromium..." --weight=8 pushd "$install_dir/package" ynh_exec_as "$app" $ynh_node_load_PATH $ynh_node "./node_modules/puppeteer/install.js" popd fi #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 _generate_env_file #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config yunohost service add $app --description="A Cors proxy letting the browser manages cookies and redirects." --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last