mirror of
https://github.com/YunoHost-Apps/invidious_ynh.git
synced 2024-09-03 19:15:55 +02:00
add new parameters
This commit is contained in:
parent
f1b9adce0d
commit
6704482217
2 changed files with 42 additions and 28 deletions
|
@ -17,16 +17,20 @@ key=$(ynh_string_random --length=24)
|
||||||
registration_enabled="true"
|
registration_enabled="true"
|
||||||
login_enabled="true"
|
login_enabled="true"
|
||||||
captcha_enabled="true"
|
captcha_enabled="true"
|
||||||
|
enable_user_notifications="true"
|
||||||
|
banner=""
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=2
|
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=key --value="$key"
|
||||||
ynh_app_setting_set --app=$app --key=registration_enabled --value=$registration_enabled
|
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=login_enabled --value=$login_enabled
|
||||||
ynh_app_setting_set --app=$app --key=captcha_enabled --value=$captcha_enabled
|
ynh_app_setting_set --app="$app" --key=captcha_enabled --value=$captcha_enabled
|
||||||
|
ynh_app_setting_set --app="$app" --key=enable_user_notifications --value=$enable_user_notifications
|
||||||
|
ynh_app_setting_set --app="$app" --key=banner --value="$banner"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
|
@ -41,20 +45,20 @@ ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- -
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
ynh_script_progression --message="Setting up source files..." --weight=4
|
||||||
|
|
||||||
mkdir -p "$install_dir"
|
mkdir -p "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
git config --system --add safe.directory $install_dir
|
git config --system --add safe.directory "$install_dir"
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from GitHub
|
# Download, check integrity, uncompress and patch the source from GitHub
|
||||||
git clone https://github.com/iv-org/invidious "$install_dir" --quiet
|
git clone https://github.com/iv-org/invidious "$install_dir" --quiet
|
||||||
|
|
||||||
pushd "$install_dir"
|
pushd "$install_dir"
|
||||||
git reset --hard --quiet $version_commit
|
git reset --hard --quiet "$version_commit"
|
||||||
make
|
make
|
||||||
popd
|
popd
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
|
@ -64,7 +68,7 @@ ynh_script_progression --message="Modifying a config file..." --weight=1
|
||||||
ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config/config.yml"
|
ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config/config.yml"
|
||||||
|
|
||||||
chmod 600 "$install_dir/config/config.yml"
|
chmod 600 "$install_dir/config/config.yml"
|
||||||
chown $app:$app "$install_dir/config/config.yml"
|
chown "$app:$app" "$install_dir/config/config.yml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -93,7 +97,7 @@ ynh_use_logrotate
|
||||||
|
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -101,7 +105,7 @@ yunohost service add $app --description="Invidious is an alternative front-end t
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
|
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -22,7 +22,7 @@ upgrade_type=$(ynh_check_app_version_changed)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
|
ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -31,22 +31,32 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
if [ -z "${registration_enabled:-}" ]; then
|
if [ -z "${registration_enabled:-}" ]; then
|
||||||
registration_enabled="true"
|
registration_enabled="true"
|
||||||
ynh_app_setting_set --app=$app --key=registration_enabled --value=$registration_enabled
|
ynh_app_setting_set --app="$app" --key=registration_enabled --value=$registration_enabled
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${login_enabled:-}" ]; then
|
if [ -z "${login_enabled:-}" ]; then
|
||||||
login_enabled="true"
|
login_enabled="true"
|
||||||
ynh_app_setting_set --app=$app --key=login_enabled --value=$login_enabled
|
ynh_app_setting_set --app="$app" --key=login_enabled --value=$login_enabled
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${captcha_enabled:-}" ]; then
|
if [ -z "${captcha_enabled:-}" ]; then
|
||||||
captcha_enabled="true"
|
captcha_enabled="true"
|
||||||
ynh_app_setting_set --app=$app --key=captcha_enabled --value=$captcha_enabled
|
ynh_app_setting_set --app="$app" --key=captcha_enabled --value=$captcha_enabled
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${key:-}" ]; then
|
if [ -z "${key:-}" ]; then
|
||||||
key=$(ynh_string_random --length=24)
|
key=$(ynh_string_random --length=24)
|
||||||
ynh_app_setting_set --app=$app --key=key --value=$key
|
ynh_app_setting_set --app="$app" --key=key --value="$key"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${enable_user_notifications:-}" ]; then
|
||||||
|
enable_user_notifications="true"
|
||||||
|
ynh_app_setting_set --app="$app" --key=enable_user_notifications --value="$enable_user_notifications"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${banner:-}" ]; then
|
||||||
|
banner=""
|
||||||
|
ynh_app_setting_set --app="$app" --key=banner --value="$banner"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -64,21 +74,21 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
ynh_script_progression --message="Upgrading source files..." --weight=5
|
||||||
|
|
||||||
pushd $install_dir
|
pushd "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
git config --system --add safe.directory $install_dir
|
git config --system --add safe.directory "$install_dir"
|
||||||
|
|
||||||
ynh_exec_as $app git fetch
|
ynh_exec_as "$app" git fetch
|
||||||
#git checkout master
|
#git checkout master
|
||||||
ynh_exec_as $app git reset --hard --quiet $version_commit
|
ynh_exec_as "$app" git reset --hard --quiet "$version_commit"
|
||||||
ynh_exec_as $app git pull
|
ynh_exec_as "$app" git pull
|
||||||
ynh_exec_warn_less shards install --production
|
ynh_exec_warn_less shards install --production
|
||||||
ynh_exec_warn_less crystal build $install_dir/src/invidious.cr --release
|
ynh_exec_warn_less crystal build "$install_dir/src/invidious.c"r --release
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
|
@ -96,7 +106,7 @@ chmod 644 "/etc/cron.d/$app"
|
||||||
|
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
|
yunohost service add "$app" --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
|
@ -105,15 +115,15 @@ ynh_script_progression --message="Modifying a config file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config/config.yml"
|
ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config/config.yml"
|
||||||
|
|
||||||
chmod 600 $install_dir/config/config.yml
|
chmod 600 "$install_dir/config/config.yml"
|
||||||
chown $app:$app "$install_dir/config/config.yml"
|
chown "$app:$app" "$install_dir/config/config.yml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action=restart --log_path=systemd
|
ynh_systemd_action --service_name="$app" --action=restart --log_path=systemd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
Loading…
Add table
Reference in a new issue