Bonjour a tous
petit script sympa pour mettre a jour rutorrent,mobile,filemanager,plugins
git clone https://github.com/xombiemp/ultimate-torrent-setup/blob/master/update-rutorrent
nano /etc/init.d/update-rutorrent
#!/bin/bash
webroot_path="/var/www"
rutorrent_path="$webroot_path/rutorrent"
plugins_path="$rutorrent_path/plugins"
rutorrent_svn="https://github.com/Novik/ruTorrent/trunk/"
plugins_svn="$rutorrent_svn/plugins"
filemanager_svn="http://svn.rutorrent.org/svn/filemanager/trunk"
mobile_svn="https://github.com/xombiemp/rutorrentMobile/trunk"
plugins=(_getdir _noty2 _task autotools check_port chunks cookies create data datadir diskspace edit erasedata extratio filedrop geoip history httprpc loginmgr mediainfo ratio scheduler screenshots seedingtime source throttle tracklabels trafic unpack)
hwk_plugins=(filemanager fileshare)
updated="no"
if [ ! -d "$rutorrent_path" ] ; then
echo -e "INSTALLING rutorrent"
service rtorrent stop
cd "$webroot_path"
svn co "$rutorrent_svn" "rutorrent"
cd "$rutorrent_path"
svn update --set-depth=exclude plugins
mkdir "$plugins_path"
echo -e "rutorrent installed from svn\n"
updated="yes"
else
echo -e "UPDATING rutorrent"
cd "$rutorrent_path"
oldsvn=$(svn info | grep "Revision" | cut -c11-)
newsvn=$(svn info "$rutorrent_svn" | grep "Revision" | cut -c11-)
if [ "$newsvn" != "$oldsvn" ] ; then
service rtorrent stop
svn up
echo -e "rutorrent updated from $oldsvn to $newsvn\n"
updated="yes"
else
echo -e "rutorrent is already at the latest version: $newsvn\n"
fi
fi
echo -e "UPDATING plugins"
for plugin in ${plugins[*]} ; do
if [ ! -d "$plugins_path/$plugin" ] ; then
service rtorrent stop
cd "$plugins_path"
svn co "$plugins_svn/$plugin"
echo -e "$plugin installed from svn\n"
updated="yes"
else
cd "$plugins_path/$plugin"
oldsvn=$(svn info | grep "Revision" | cut -c11-)
newsvn=$(svn info "$plugins_svn/$plugin" | grep "Revision" | cut -c11-)
if [ "$newsvn" != "$oldsvn" ] ; then
service rtorrent stop
svn up
echo -e "$plugin updated from $oldsvn to $newsvn\n"
updated="yes"
else
echo -e "$plugin is already at the latest version: $newsvn\n"
fi
fi
done
for plugin in ${hwk_plugins[*]} ; do
if [ ! -d "$plugins_path/$plugin" ] ; then
service rtorrent stop
cd "$plugins_path"
svn co "$filemanager_svn/$plugin"
echo -e "$plugin installed from svn\n"
updated="yes"
else
cd "$plugins_path/$plugin"
oldsvn=$(svn info | grep "Revision" | cut -c11-)
newsvn=$(svn info "$filemanager_svn/$plugin" | grep "Revision" | cut -c11-)
if [ "$newsvn" != "$oldsvn" ] ; then
service rtorrent stop
svn up
echo -e "$plugin updated from $oldsvn to $newsvn\n"
updated="yes"
else
echo -e "$plugin is already at the latest version: $newsvn\n"
fi
fi
done
if [ ! -d "$plugins_path/mobile" ] ; then
service rtorrent stop
cd "$plugins_path"
svn co "$mobile_svn" "mobile"
echo -e "mobile installed from svn\n"
updated="yes"
else
cd "$plugins_path/mobile"
oldsvn=$(svn info | grep "Revision" | cut -c11-)
newsvn=$(svn info "$mobile_svn" | grep "Revision" | cut -c11-)
if [ "$newsvn" != "$oldsvn" ] ; then
service rtorrent stop
svn up
echo -e "mobile updated from $oldsvn to $newsvn\n"
updated="yes"
else
echo -e "mobile is already at the latest version: $newsvn\n"
fi
fi
if [ "$updated" == "yes" ] ; then
echo -e "Updates were installed. Restarting rtorrent..."
service rtorrent stop
chown -R www-data:www-data "$rutorrent_path"
find $rutorrent_path/share/ -type d -exec chmod 777 {} \;
find $rutorrent_path/share/ -type f -exec chmod 666 {} \;
service nginx restart
service php5-fpm restart
service rtorrent start
else
echo -e "Already running the latest version of everything!\n"
fi
chmod +x /etc/init.d/update-rutorrent
/etc/init.d/update-rutorrent start