From a4703fba8cefa9c20cb633edf05f4d49070e2d47 Mon Sep 17 00:00:00 2001 From: Gredin 67 Date: Sat, 23 Jan 2021 21:57:24 +0100 Subject: [PATCH] --- manifest.json | 4 ++-- scripts/install | 29 +++++++++++++++-------------- scripts/remove | 5 ++--- scripts/restore | 13 ++++++------- scripts/upgrade | 10 +++++----- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/manifest.json b/manifest.json index 6f018ff..7db153d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Transform your YunoHost server into media center with Kodi", "fr": "Transfromez votre serveur YunoHost en media center avec Kodi" }, - "version": "17.3", + "version": "17.3~ynh1", "url": "https://kodi.tv", "license": "GPL-2.0", "maintainer": { @@ -15,7 +15,7 @@ "url": "blog.cecchettosylvain.fr" }, "requirements": { - "yunohost": ">= 2.6.4" + "yunohost": ">= 2.7.12" }, "multi_instance": false, "services": [ diff --git a/scripts/install b/scripts/install index 2b52630..dc66cb6 100644 --- a/scripts/install +++ b/scripts/install @@ -58,9 +58,9 @@ ynh_app_setting_set "$app" open_webserver_port "$open_webserver_port" # CREATE KODI USER #================================================= ynh_system_user_create "$app" "$final_path" -sudo mkdir "$final_path" -sudo chown -R "$app":"$app" "$final_path" -sudo usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app" +mkdir "$final_path" +chown -R "$app":"$app" "$final_path" +usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app" #================================================= @@ -70,7 +70,7 @@ ynh_add_systemd_config if [ "$launch_on_boot" -eq 0 ] then - sudo systemctl disable "$app" + systemctl disable "$app" fi @@ -78,6 +78,7 @@ fi # INSTALL DEPENDENCIES AND KODI #================================================= if [[ $arch != arm* ]]; then + cp ../conf/kodi.list "/etc/apt/sources.list.d/${app}.list" ynh_package_update ynh_package_install xorg xinit dbus-x11 kodi else @@ -89,7 +90,7 @@ fi #================================================= # X11 SETTINGS #================================================= -sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config +ynh_replace_string "allowed_users=console" "allowed_users=anybody" /etc/X11/Xwrapper.config #================================================= @@ -101,17 +102,17 @@ yunohost service add "$app" --log "$final_path/.kodi/temp/kodi.log" #================================================= # CONTROL WEB INTERFACE #================================================= -sudo mkdir -p "$final_path/.kodi/userdata/" -sudo cp ../conf/advancedsettings.xml "$final_path/.kodi/userdata/advancedsettings.xml" +mkdir -p "$final_path/.kodi/userdata/" +cp ../conf/advancedsettings.xml "$final_path/.kodi/userdata/advancedsettings.xml" if [[ $arch != arm* ]]; then - sudo wget -q $chorus2_package -P /tmp - sudo unzip /tmp/webinterface.default.2.4.4.zip -d /tmp/ - sudo mkdir -p "$final_path/.kodi/addons/" - sudo mv /tmp/webinterface.default/ "$final_path/.kodi/addons/webinterface.chorus2/" + wget -q $chorus2_package -P /tmp + unzip /tmp/webinterface.default.2.4.4.zip -d /tmp/ + mkdir -p "$final_path/.kodi/addons/" + mv /tmp/webinterface.default/ "$final_path/.kodi/addons/webinterface.chorus2/" fi -sudo chown -R "$app":"$app" "$final_path" +chown -R "$app":"$app" "$final_path" if [ "$open_webserver_port" -eq 1 ] then @@ -124,7 +125,7 @@ fi #================================================= finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup_if_checksum_is_different "$finalnginxconf" -sudo cp ../conf/nginx.conf "$finalnginxconf" +cp ../conf/nginx.conf "$finalnginxconf" if [ "$path_url" == "/" ]; then ynh_replace_string "__PATH__/" "/" "$finalnginxconf" @@ -147,4 +148,4 @@ systemctl reload nginx #================================================= # START KODI #================================================= -sudo systemctl start "$app" +systemctl start "$app" diff --git a/scripts/remove b/scripts/remove index b48b1f1..cab73bf 100644 --- a/scripts/remove +++ b/scripts/remove @@ -57,14 +57,13 @@ then echo "Remove $app service" yunohost service remove "$app" fi -sudo systemctl daemon-reload +systemctl daemon-reload #================================================= # X11 SETTINGS #================================================= -sudo sed -i 's/allowed_users=anybody/allowed_users=console/' /etc/X11/Xwrapper.config - +ynh_replace_string "allowed_users=anybody" "allowed_users=console" /etc/X11/Xwrapper.config #================================================= # REMOVE DEPENDENCIES AND KODI diff --git a/scripts/restore b/scripts/restore index e122ae4..0219051 100644 --- a/scripts/restore +++ b/scripts/restore @@ -57,9 +57,9 @@ test ! -d "$final_path" \ # CREATE KODI USER #================================================= ynh_system_user_create "$app" "$final_path" -sudo mkdir "$final_path" -sudo chown -R "$app":"$app" "$final_path" -sudo usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app" +mkdir "$final_path" +chown -R "$app":"$app" "$final_path" +usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input,netdev "$app" #================================================= @@ -93,7 +93,7 @@ yunohost service add "$app" --log "$final_path/.kodi/temp/kodi.log" #================================================= if [ "$launch_on_boot" -eq 0 ] then - sudo systemctl disable "$app" + systemctl disable "$app" else systemctl enable "$app".service fi @@ -115,8 +115,7 @@ fi #================================================= # X11 SETTINGS #================================================= -sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config - +ynh_replace_string "allowed_users=console" "allowed_users=anybody" /etc/X11/Xwrapper.config #================================================= # CONTROL WEB INTERFACE @@ -137,4 +136,4 @@ systemctl reload nginx #================================================= # START KODI #================================================= -sudo systemctl start "$app" \ No newline at end of file +systemctl start "$app" \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index e0633ef..9988d1f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -51,7 +51,7 @@ fi #================================================= # STOP KODI #================================================= -sudo systemctl stop "$app" +systemctl stop "$app" #================================================= @@ -79,6 +79,7 @@ ynh_add_systemd_config # INSTALL DEPENDENCIES AND KODI #================================================= if [[ "$arch" != arm* ]]; then + cp ../conf/kodi.list "/etc/apt/sources.list.d/${app}.list" ynh_package_update ynh_package_install xorg xinit dbus-x11 kodi else @@ -91,8 +92,7 @@ fi #================================================= # X11 SETTINGS #================================================= -sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config - +ynh_replace_string "allowed_users=console" "allowed_users=anybody" /etc/X11/Xwrapper.config #================================================= # CONTROL WEB INTERFACE @@ -108,7 +108,7 @@ fi #================================================= finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup_if_checksum_is_different "$finalnginxconf" -sudo cp ../conf/nginx.conf "$finalnginxconf" +cp ../conf/nginx.conf "$finalnginxconf" if [ "$path_url" == "/" ]; then ynh_replace_string "__PATH__/" "/" "$finalnginxconf" @@ -132,7 +132,7 @@ systemctl reload nginx #================================================= # START KODI #================================================= -sudo systemctl start "$app" +systemctl start "$app"