summarylogtreecommitdiffstats
path: root/notify-user-and-copy-config
blob: f518cd467182f1004668daba57540af5e83f7567 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash

echo "aria2cd has been installed/updated successfully, but there is something extra to do."
echo ""
echo "If you are using user service, you need to copy /usr/share/aria2/ to <aria2-config-dir>"
echo ""
echo "<aria2-config-dir> means ~/.aria2 or \${XDG_CONFIG_HOME:-\${HOME}/.config}/aria2"
echo ""
echo "According to systemd document, you also need to enable NetworkManager-wait-online.service or systemd-networkd-wait-online.service if you want to use aria2-update-tracker.timer."
echo ""
echo "Notes:"
echo "    aria2@username.service is deprecated now, it may be removed in the future. You can use system wide aria2.service or user wide aria2.service instead."
echo "    Files downloaded by system service is placed at /var/lib/aria2cd/Downloads."
echo ""

# create_config $file
function create_config() {
    if [[ ! -f "/etc/aria2cd/${1}" ]]
    then
        if [[ -f "/usr/share/aria2/${1}" ]]
        then
            echo "Copying ${1}..."
            cp "/usr/share/aria2/${1}" "/etc/aria2cd/${1}"
        else
            echo "Creating empty ${1}..."
            touch "/etc/aria2cd/${1}"
        fi
    else
        echo "${1} is found so we will skip it."
    fi
}

mkdir -p /etc/aria2cd
create_config tracker-config.sh
create_config aria2.conf