diff --git a/scripts/_common.sh b/scripts/_common.sh index 1e95153..a4454f4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,3 +3,40 @@ pkg_dependencies="sqlite3" create_dir=0 +#================================================= +# EXPERIMENTAL HELPERS +#================================================= +#================================================= +# YUNOHOST MULTIMEDIA INTEGRATION +#================================================= + +# Install or update the main directory yunohost.multimedia +# +# usage: ynh_multimedia_build_main_dir +ynh_multimedia_build_main_dir () { + local ynh_media_release="v1.0" +# local checksum="4852c8607db820ad51f348da0dcf0c88" + + # Download yunohost.multimedia scripts + wget -nv https://github.com/Krakinou/yunohost.multimedia/archive/${ynh_media_release}.tar.gz + + # Verify checksum +# echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ +# || ynh_die "Corrupt source" + + # Extract + mkdir yunohost.multimedia-master + tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1 + ./yunohost.multimedia-master/script/ynh_media_build.sh +} + +# Grant write access to multimedia directories to a specified user +# +# usage: ynh_multimedia_addaccess user_name +# +# | arg: user_name - User to be granted write access +ynh_multimedia_addaccess () { + local user_name=$1 + groupadd -f multimedia + usermod -a -G multimedia $user_name +} \ No newline at end of file diff --git a/scripts/install b/scripts/install index 588ade6..d76e796 100755 --- a/scripts/install +++ b/scripts/install @@ -111,6 +111,9 @@ ynh_add_nginx_config # Create a system user ynh_system_user_create $app +#add user to multimedia group +usermod -a -G multimedia $app + chown -R $app: $final_path #================================================= @@ -124,6 +127,9 @@ ynh_add_systemd_config # CREATE FILES AND DIRECTORIES #================================================= +# Build YunoHost multimedia directories +ynh_multimedia_build_main_dir + #Check if library folder exists. If not create it if [ ! -e "$calibre_dir" ]; then ynh_print_info "Create calibre library folder $calibre_dir"