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

Fix upgrade

This commit is contained in:
yalh76 2020-07-23 01:44:52 +02:00
parent 3e79c96f16
commit 9949873d11
3 changed files with 80 additions and 11 deletions

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/CouchPotato/CouchPotatoServer/archive/build/3.0.1.tar.gz
SOURCE_SUM=f08f9c6ac02f66c6667f17ded1eea4c051a62bbcbadd2a8673394019878e92f7
SOURCE_URL=https://github.com/CouchPotato/CouchPotatoServer/archive/7260c12f72447ddb6f062367c6dfbda03ecd4e9c.tar.gz
SOURCE_SUM=2944f73f1630ada31e24d47df678c4412bd6acc93295ce2915179a75ecfd5dd1
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -2,25 +2,26 @@
api_key =
username =
ssl_key =
proxy_server =
ssl_cert =
data_dir = __DATADIR__
use_proxy = 0
permission_file = 0755
proxy_password =
dereferer = http://www.nullrefer.com/?
permission_folder = 0755
dark_theme = False
development = 0
url_base = __PATH__
proxy_username =
ipv6 = 0
debug = 0
launch_browser = False
password =
port = __PORT__
permission_file = 0755
url_base = __PATH__
show_wizard = 0
username_internal_meta = rw
use_proxy = 0
proxy_password =
dereferer = http://www.nullrefer.com/?
dark_theme = False
api_key_internal_meta = ro
proxy_username =
ipv6 = 0
[updater]
notification = False
@ -32,7 +33,7 @@ automatic = False
startup_scan = True
library_refresh_interval = 0
cleanup = True
enabled = 1
enabled = True
library = /home/yunohost.multimedia/share/Video/Movies
[renamer]

View file

@ -170,6 +170,74 @@ mkdir -p "/home/yunohost.multimedia/share/Video/Movies"
# Fix permissions
/home/yunohost.multimedia/ynh_media_build.sh
#=================================================
# CONFIGURE TRANSMISSION
#=================================================
ynh_script_progression --message="Configuring transmission..."
# Transmission link: Preferred method is direct RPC link. If not available, switch to watchdir.
transmission_rpcurl=""
transmission_rpcpassword=""
transmission_watchdir=""
# Check if Transmission is installed
if [[ -z $(yunohost app list -i -f transmission | grep -v 'apps:') ]]; then
ynh_script_progression --message="Transmission is not installed. Disabling link to CouchPotato..."
ynh_replace_string --match_string="__RPC__" --replace_string="0" --target_file="../conf/couchpotato.conf" # Disable Transmission RPC
ynh_replace_string --match_string="__BLACKHOLE__" --replace_string="0" --target_file="../conf/couchpotato.conf" # Disable Transmission Watchdir
ynh_replace_string --match_string="__RENAMER__" --replace_string="0" --target_file="../conf/couchpotato.conf" # Disable Renamer
else
ynh_script_progression --message="Transmission is installed. Trying to link it to CouchPotato..."
# Check if the transmission password is in settings
if [[ -n $(ynh_app_setting_get --app=transmission --key=rpcpassword || true) ]]; then
ynh_script_progression --message="Transmission will be linked to CouchPotato directly"
transmission_rpcurl="$(ynh_app_setting_get --app=transmission --key=path)transmission"
transmission_rpcpassword=$(ynh_app_setting_get --app=transmission --key=rpcpassword)
ynh_replace_string --match_string="__RPC__" --replace_string="1" --target_file="../conf/couchpotato.conf" # Enable Transmission RPC
ynh_replace_string --match_string="__BLACKHOLE__" --replace_string="0" --target_file="../conf/couchpotato.conf" # Disable Transmission Watchdir
ynh_replace_string --match_string="__RENAMER__" --replace_string="1" --target_file="../conf/couchpotato.conf" # Enable Renamer
# If transmission uses YunoHost multimedia, use its folder for the renamer
else
# Check if transmission has watchdir enabled
if [[ -n $(ynh_app_setting_get --app=transmission --key=watchdir || true) ]]; then
ynh_script_progression --message="Transmission will be linked to CouchPotato with watchdir"
transmission_watchdir=$(ynh_app_setting_get --app=transmission --key=watchdir)
ynh_replace_string --match_string="__RPC__" --replace_string="0" --target_file="../conf/couchpotato.conf" # Disable Transmission RPC
ynh_replace_string --match_string="__BLACKHOLE__" --replace_string="1" --target_file="../conf/couchpotato.conf" # Enable Transmission Watchdir
ynh_replace_string --match_string="__RENAMER__" --replace_string="1" --target_file="../conf/couchpotato.conf" # Enable Renamer
# If transmission uses YunoHost multimedia, use its folder for the renamer
else
ynh_script_progression --message="Cannot link Couchpotato to Transmission because Transmission has no RPC password or watchdir available."
ynh_replace_string --match_string="__RPC__" --replace_string="0" --target_file="../conf/couchpotato.conf" # Disable Transmission RPC
ynh_replace_string --match_string="__BLACKHOLE__" --replace_string="0" --target_file="../conf/couchpotato.conf" # Disable Transmission Watchdir
ynh_replace_string --match_string="__RENAMER__" --replace_string="0" --target_file="../conf/couchpotato.conf" # Disable Renamer
fi
fi
fi
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
app_config_file="${final_path}/settings.conf"
# Configure App
ynh_replace_string --match_string="__RPCURL__" --replace_string="$transmission_rpcurl" --target_file="../conf/couchpotato.conf"
ynh_replace_string --match_string="__RPCPASSWORD__" --replace_string="$transmission_rpcpassword" --target_file="../conf/couchpotato.conf"
ynh_replace_string --match_string="__WATCHDIR__" --replace_string="$transmission_watchdir" --target_file="../conf/couchpotato.conf"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="../conf/couchpotato.conf"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/couchpotato.conf"
ynh_replace_string --match_string="__DATADIR__" --replace_string="$app_data_dir" --target_file="../conf/couchpotato.conf"
ynh_backup_if_checksum_is_different --file=$app_config_file
cp -a ../conf/couchpotato.conf $app_config_file
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$app_config_file"
#=================================================
# CONFIGURE LOGS
#=================================================