« Plex : télécharger les mises à jour automatiquement » : différence entre les versions
Aller à la navigation
Aller à la recherche
Aucun résumé des modifications |
Aucun résumé des modifications |
||
(5 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
[[Category:serveur]] | |||
[[Category:debian]] | |||
[[Category:mediacenter]] | |||
<pre> | <pre> | ||
#! /bin/bash | #! /bin/bash | ||
target="https://plex.tv/downloads" | target="https://plex.tv/api/downloads/1.json" | ||
if [ "$1" == "cron" ]; then | if [ "$1" == "cron" ]; then | ||
Ligne 11 : | Ligne 14 : | ||
w3m -dump $target 2>/dev/null > /root/plexupdate/tmp/plex_downloads.html | w3m -dump $target 2>/dev/null > /root/plexupdate/tmp/plex_downloads.html | ||
download_url=`cat /root/plexupdate/tmp/plex_downloads.html | grep -ioe '"label"[^}]*' | grep -i "\"distro\":\"ubuntu\"" | grep amd64 | grep -m1 -ioe 'https://[^\"]*'` | |||
latest_version=`echo $download_url | cut -d"/" -f5` | |||
if [ $cron = 0 ]; then echo "Latest version is $latest_version"; fi | if [ $cron = 0 ]; then echo "Latest version is $latest_version"; fi | ||
Ligne 18 : | Ligne 22 : | ||
if [ $cron = 0 ]; then echo "Current version is $current_version"; fi | if [ $cron = 0 ]; then echo "Current version is $current_version"; fi | ||
if [ ! "$latest_version" == "$current_version" ]; then | if [ ! "$latest_version" == "$current_version" ]; then | ||
echo "A new plex version is available" | echo "A new plex version is available" | ||
Ligne 24 : | Ligne 27 : | ||
if [ ! -f /root/plexupdate/plexmediaserver_"$latest_version"_amd64.deb ]; then | if [ ! -f /root/plexupdate/plexmediaserver_"$latest_version"_amd64.deb ]; then | ||
echo "downloading new plex version $latest_version" | echo "downloading new plex version $latest_version" | ||
wget | wget $download_url -O /root/plexupdate/plexmediaserver_"$latest_version"_amd64.deb | ||
fi | fi | ||
echo "install it using dpkg -i /root/plexupdate/plexmediaserver_"$latest_version"_amd64.deb" | echo "install it using dpkg -i /root/plexupdate/plexmediaserver_"$latest_version"_amd64.deb" | ||
fi | fi | ||
</pre> | </pre> |
Dernière version du 5 novembre 2016 à 14:00
#! /bin/bash target="https://plex.tv/api/downloads/1.json" if [ "$1" == "cron" ]; then cron=1 else cron=0 fi w3m -dump $target 2>/dev/null > /root/plexupdate/tmp/plex_downloads.html download_url=`cat /root/plexupdate/tmp/plex_downloads.html | grep -ioe '"label"[^}]*' | grep -i "\"distro\":\"ubuntu\"" | grep amd64 | grep -m1 -ioe 'https://[^\"]*'` latest_version=`echo $download_url | cut -d"/" -f5` if [ $cron = 0 ]; then echo "Latest version is $latest_version"; fi current_version=`dpkg -s plexmediaserver | grep Version: | cut -d" " -f2` if [ $cron = 0 ]; then echo "Current version is $current_version"; fi if [ ! "$latest_version" == "$current_version" ]; then echo "A new plex version is available" if [ ! -f /root/plexupdate/plexmediaserver_"$latest_version"_amd64.deb ]; then echo "downloading new plex version $latest_version" wget $download_url -O /root/plexupdate/plexmediaserver_"$latest_version"_amd64.deb fi echo "install it using dpkg -i /root/plexupdate/plexmediaserver_"$latest_version"_amd64.deb" fi