#!/bin/bash #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # INSTALL INCUS #================================================= ynh_script_progression --message="Installing Incus... (this make take a long time!)" if ! yunohost app list --output-as json --quiet | jq -e '.apps[] | select(.id == "incus")' >/dev/null; then yunohost app install --force https://github.com/YunoHost-Apps/incus_ynh fi setup_incus #================================================= # 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_exec_as "$app" git -C "$install_dir" init -b main ynh_exec_as "$app" git -C "$install_dir" remote add origin "$yunorunner_repository" ynh_exec_as "$app" git -C "$install_dir" fetch --quiet --depth=1 origin "$yunorunner_release" ynh_exec_as "$app" git -C "$install_dir" reset --quiet --hard FETCH_HEAD ynh_exec_as "$app" git clone https://github.com/YunoHost/package_check "$install_dir/package_check" chown "$app:$app" "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:$app" "$install_dir" chown "$app:www-data" "$install_dir" chown -R "$app:www-data" "$install_dir/results" # Allow system user to execute ciclic chmod ug+x "$install_dir/ciclic" #================================================= # INSTALL PYTHON DEPENDENCIES #================================================= ynh_script_progression --message="Installing Python dependencies..." pushd "$install_dir" python3 -m venv venv venv/bin/pip install --upgrade pip venv/bin/pip install -r requirements-frozen.txt popd #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a config file..." if [ $mode = "auto" ]; then auto="True" else auto="False" fi ynh_add_config --template="yunorunner.config.py" --destination="$install_dir/config.py" chmod 400 "$install_dir/config.py" chown "$app:$app" "$install_dir/config.py" #================================================= # FINISH INSTALL #================================================= ynh_script_progression --message="Run Yunorunner's finish_install script..." if [ "$context" == "official_infra" ] && [ "${PACKAGE_CHECK_EXEC:-0}" -ne 0 ]; then tweak_yunohost fi #================================================= # 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="$app daemon for YunoRunner" $(exposed_ports_if_cluster) ynh_add_config --template="cron" --destination="/etc/cron.d/$app" _ynh_firewall_add_tweak #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting $app's systemd service..." # Start a systemd service ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30 #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed"