#!/bin/sh

profile=`uci get qbittorrent.main.profile`
if [ -n "$profile" ]; then
    echo "qb profile: $profile"
    echo "stop qb"
    /etc/init.d/qbittorrent stop
    sleep 2
    echo "delete password"
    sed -i '/^WebUI\\Password_/d' "$profile/qBittorrent/config/qBittorrent.conf"
    echo "start qb"
    /etc/init.d/qbittorrent start
else
    echo "profile not defined!"
fi

echo "done"
