mirror of
https://github.com/YunoHost-Apps/invidious_ynh.git
synced 2024-09-03 19:15:55 +02:00
5d85060a92
* Thumbnails (#133) * Update manifest.toml * Update manifest.toml * Update manifest.toml * Auto-update README --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> * fix * Auto-update README * Update manifest.toml * Only build invidious once per install (#136) * Thumbnails (#133) (#134) * Thumbnails (#133) * Update manifest.toml * Update manifest.toml * Update manifest.toml * Auto-update README --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> * fix * Auto-update README --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> * Only build invidious once per install * Update manifest.toml --------- Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> Co-authored-by: eric_G <46165813+ericgaspar@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost@yunohost.org> * Update manifest.toml * fix * Auto-update README * Update manifest.toml --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> Co-authored-by: selfhoster1312 <121760708+selfhoster1312@users.noreply.github.com> Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com>
110 lines
3.7 KiB
Bash
110 lines
3.7 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
key=$(ynh_string_random --length=24)
|
|
registration_enabled="true"
|
|
login_enabled="true"
|
|
captcha_enabled="true"
|
|
|
|
#=================================================
|
|
# STORE SETTINGS FROM MANIFEST
|
|
#=================================================
|
|
ynh_script_progression --message="Storing installation settings..." --weight=2
|
|
|
|
ynh_app_setting_set --app=$app --key=key --value=$key
|
|
ynh_app_setting_set --app=$app --key=registration_enabled --value=$registration_enabled
|
|
ynh_app_setting_set --app=$app --key=login_enabled --value=$login_enabled
|
|
ynh_app_setting_set --app=$app --key=captcha_enabled --value=$captcha_enabled
|
|
|
|
#=================================================
|
|
# INSTALL DEPENDENCIES
|
|
#=================================================
|
|
ynh_script_progression --message="Installing dependencies..." --weight=15
|
|
|
|
ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=stable
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=4
|
|
|
|
mkdir -p "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
git config --system --add safe.directory $install_dir
|
|
|
|
# Download, check integrity, uncompress and patch the source from GitHub
|
|
git clone https://github.com/iv-org/invidious "$install_dir" --quiet
|
|
|
|
pushd "$install_dir"
|
|
git reset --hard --quiet $version_commit
|
|
make
|
|
popd
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# MODIFY A CONFIG FILE
|
|
#=================================================
|
|
ynh_script_progression --message="Modifying a config file..." --weight=1
|
|
|
|
ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config/config.yml"
|
|
|
|
chmod 600 "$install_dir/config/config.yml"
|
|
chown $app:$app "$install_dir/config/config.yml"
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# INSTALL INVIDIOUS
|
|
#=================================================
|
|
ynh_script_progression --message="Building Invidious.. (this will take some time and resources!)" --weight=60
|
|
|
|
pushd "$install_dir"
|
|
./invidious --migrate
|
|
popd
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=10
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app"
|
|
chown root: "/etc/cron.d/$app"
|
|
chmod 644 "/etc/cron.d/$app"
|
|
|
|
ynh_use_logrotate
|
|
|
|
ynh_add_systemd_config
|
|
|
|
yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of Invidious completed" --last
|