mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 04:44:05 +02:00
Replace || with if check https://github.com/alexbelgium/hassio-addons/issues/755
This commit is contained in:
@@ -15,7 +15,7 @@ if [ ! -f "$CONFIG_LOCATION"/qBittorrent.conf ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$CONFIG_LOCATION"/ || true
|
cd "$CONFIG_LOCATION"/ || true
|
||||||
LINE=$(sed -n '/Preferences/=' qBittorrent.conf)
|
LINE=$(sed -n '/Preferences/=' qBittorrent.conf) || bashio::exit.nok "qBittorrent.conf not valid"
|
||||||
LINE=$((LINE + 1))
|
LINE=$((LINE + 1))
|
||||||
|
|
||||||
# Remove unused folders
|
# Remove unused folders
|
||||||
@@ -44,13 +44,19 @@ if bashio::config.has_value 'SavePath'; then
|
|||||||
|
|
||||||
# Replace save path
|
# Replace save path
|
||||||
CURRENTSAVEPATH=$(sed -n '/Downloads\\\SavePath/p' qBittorrent.conf)
|
CURRENTSAVEPATH=$(sed -n '/Downloads\\\SavePath/p' qBittorrent.conf)
|
||||||
sed -i "s=${CURRENTSAVEPATH#*=}=$DOWNLOADS=g" qBittorrent.conf || \
|
if [[ ${#CURRENTSAVEPATH} -gt 1 ]]; then
|
||||||
|
sed -i "s=${CURRENTSAVEPATH#*=}=$DOWNLOADS=g" qBittorrent.conf
|
||||||
|
else
|
||||||
sed -i "${LINE}a Downloads\\\SavePath=$DOWNLOADS" qBittorrent.conf
|
sed -i "${LINE}a Downloads\\\SavePath=$DOWNLOADS" qBittorrent.conf
|
||||||
|
fi
|
||||||
|
|
||||||
# Replace session save path
|
# Replace session save path
|
||||||
CURRENTSAVEPATH=$(sed -n '/Session\\\DefaultSavePath/p' qBittorrent.conf)
|
CURRENTSAVEPATH=$(sed -n '/Session\\\DefaultSavePath/p' qBittorrent.conf)
|
||||||
sed -i "s=${CURRENTSAVEPATH#*=}=$DOWNLOADS=g" qBittorrent.conf || \
|
if [[ ${#CURRENTSAVEPATH} -gt 1 ]]; then
|
||||||
|
sed -i "s=${CURRENTSAVEPATH#*=}=$DOWNLOADS=g" qBittorrent.conf
|
||||||
|
else
|
||||||
sed -i "2a Session\\\DefaultSavePath=$DOWNLOADS" qBittorrent.conf
|
sed -i "2a Session\\\DefaultSavePath=$DOWNLOADS" qBittorrent.conf
|
||||||
|
fi
|
||||||
|
|
||||||
# Info
|
# Info
|
||||||
bashio::log.info "Downloads can be found in $DOWNLOADS"
|
bashio::log.info "Downloads can be found in $DOWNLOADS"
|
||||||
|
|||||||
Reference in New Issue
Block a user