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

Add kepubify by default

This commit is contained in:
Krakinou 2022-11-11 15:08:18 +01:00
parent ad4fe8e3f5
commit 1c9edfa8e7
7 changed files with 75 additions and 4 deletions

View file

@ -0,0 +1,4 @@
SOURCE_URL=https://github.com/pgaskin/kepubify/releases/download/v4.0.4/kepubify-linux-__MACH__
SOURCE_SUM=__SHA256__
SOURCE_EXTRACT=false
SOURCE_FILENAME=kepubify-linux-__MACH__

View file

@ -6,7 +6,7 @@
"en": "Browsing, reading and downloading eBooks using a Calibre database",
"fr": "Explorer, lire et télécharger des eBooks à partir d'une base de données Calibre"
},
"version": "0.96.19~ynh1",
"version": "0.96.19~ynh2",
"url": "https://github.com/janeczku/calibre-web",
"upstream": {
"version": "0.6.19",

View file

@ -8,3 +8,35 @@ DOSSIER_MEDIA=/home/yunohost.multimedia
#These var are used in init_calibre_db_settings conf file
log_file=/var/log/$app/$app.log
access_log_file=/var/log/$app/$app-access.log
mach=`uname -m`
sha256_32bit=3365a848ce06d43fca8f1999eb69c6c8e0e20a56b6b8658a8466b9726adef0f5
sha256_64bit=37d7628d26c5c906f607f24b36f781f306075e7073a6fe7820a751bb60431fc5
sha256_arm=07f23275c4e674093443f01a591aa0980b0b87dbb0a10986d5001e9d56b0e1e7
sha256_arm64=5a15b8f6f6a96216c69330601bca29638cfee50f7bf48712795cff88ae2d03a3
sha256_armv6=7912901dc7b6f51e119f59cfd1f3f8ac2a5c64c42efba9d69ebf2ea8c3a7a2c9
case "$mach" in
"armv6l" ) mach="arm"
sha256=$sha256_arm
;;
"armv7l" ) mach="arm"
sha256=$sha256_arm
;;
"armv8l" ) mach="arm64"
sha256=$sha256_arm64
;;
"aarch64" ) mach="arm64"
sha256=$sha256_arm64
;;
"x86_64" ) mach="64bit"
sha256=$sha256_64bit
;;
* ) mach="32bit"
sha256=$sha256_32bit
;;
esac

View file

@ -92,6 +92,10 @@ ynh_add_config --template="../sources/patches/app-constants.py.patch.src" --dest
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#install kepubify converter
ynh_add_config --template="../conf/appkepubify.src.default" --destination="../conf/appkepubify.src"
ynh_setup_source --dest_dir="/opt/kepubify" --source_id="appkepubify"
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -216,6 +220,8 @@ yunohost service add $app --description="Browse eBook in the web" --log="/var/lo
chown -R $app: $final_path
chmod 740 $final_path
chown -R $app: /opt/kepubify
chmod 770 /opt/kepubify/kepubify-linux-$mach
#=================================================
# SETUP SSOWAT

View file

@ -72,6 +72,14 @@ then
ynh_secure_remove --file="$calibre_dir"
fi
#=================================================
# REMOVE KEPUBIFY DIR
#=================================================
# Remove the data directory if --purge option is used
ynh_script_progression --message="Removing kepubify directory..." --weight=1
ynh_secure_remove --file="/opt/kepubify"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================

View file

@ -126,6 +126,13 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public
fi
#Adding kepubify converter
if [ -z $(sqlite3 $final_path/app.db "SELECT config_kepubifypath FROM settings") ]; then
ynh_add_config --template="../conf/appkepubify.src.default" --destination="../conf/appkepubify.src"
ynh_setup_source --dest_dir="/opt/kepubify" --source_id="appkepubify"
chmod 770 /opt/kepubify/kepubify-linux-$mach
eval sqlite3 $final_path/app.db "\"UPDATE settings SET config_kepubifypath='/opt/kepubify/kepubify-linux-$mach' WHERE ID=1\""
fi
#=================================================
# STANDARD UPGRADE STEPS
@ -247,6 +254,7 @@ ynh_add_systemd_config
# Set permissions on app files
chown -R $app: $final_path
chown -R $app: /opt/kepubify
#=================================================
# INTEGRATE SERVICE IN YUNOHOST

View file

@ -1,5 +1,5 @@
--- a/cps/config_sql.py 2022-08-12 13:48:46.980029500 +0200
+++ b/cps/config_sql.py 2022-08-12 13:51:56.223434627 +0200
--- a/cps/config_sql.py 2022-11-10 20:01:25.834187046 +0100
+++ b/cps/config_sql.py 2022-11-09 23:48:08.351335088 +0100
@@ -62,7 +62,7 @@
mail_server_type = Column(SmallInteger, default=0)
mail_gmail_token = Column(JSON, default={})
@ -39,7 +39,7 @@
config_ldap_port = Column(SmallInteger, default=389)
config_ldap_authentication = Column(SmallInteger, default=constants.LDAP_AUTH_SIMPLE)
config_ldap_serv_username = Column(String, default='cn=admin,dc=example,dc=org')
@@ -122,11 +122,11 @@
@@ -122,15 +122,15 @@
config_ldap_cacert_path = Column(String, default="")
config_ldap_cert_path = Column(String, default="")
config_ldap_key_path = Column(String, default="")
@ -54,3 +54,16 @@
config_ldap_group_members_field = Column(String, default='memberUid')
config_ldap_group_name = Column(String, default='calibreweb')
- config_kepubifypath = Column(String, default=None)
+ config_kepubifypath = Column(String, default='/opt/kepubify/kepubify-linux-__MACH__')
config_converterpath = Column(String, default=None)
config_calibre = Column(String)
config_rarfile_location = Column(String, default=None)
@@ -269,6 +269,7 @@
def set_from_dictionary(self, dictionary, field, convertor=None, default=None, encode=None):
"""Possibly updates a field of this object.
The new value, if present, is grabbed from the given dictionary, and optionally passed through a convertor.
+
:returns: `True` if the field has changed value
"""
new_value = dictionary.get(field, default)