summarylogtreecommitdiffstats
path: root/mldonkey-daemon.install
blob: 55b356bec8ecf203f65c479216881415d4f3e465 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
yellow="${bold}$(tput setaf 3)"
blue="${bold}$(tput setaf 4)"
green="${bold}$(tput setaf 2)"

_instructions() {
  printf "${yellow}==>${all_off} ${bold}ATENTION:${all_off}
  ${blue}->${all_off} Service '${bold}mldonkey${all_off}' can be started as '${bold}systemctl start mldonkey${all_off}'
  ${blue}->${all_off} Service '${bold}mldonkey${all_off}' (by user) can be started as '${bold}systemctl --user start mldonkey${all_off}'\n"
}

_downloads_ini_not_found() {
  printf "${green}==>${all_off} ${bold}Configure you Daemon client:
  ${blue}->${all_off} Please put this content:

     ${bold}temp_directory = \"/var/lib/mldonkey/temp\"
     incoming_directory = \"/var/lib/mldonkey/incoming\"
     mldonkey_bin = \"/usr/bin/mldonkey\"${all_off}

     in this file: '${bold}/var/lib/mldonkey/.mldonkey/downloads.ini${all_off}'
     or: '${bold}"$\HOME/".mldonkey/downloads.ini${all_off}'
     if the service is run as user.\n"
}

post_install() {
  post_upgrade $1
  _instructions
  _downloads_ini_not_found
}

post_upgrade() {
  if [ ! -f /var/lib/mldonkey/.mldonkey/downloads.ini ]; then
    _downloads_ini_not_found
  fi
  true
}

post_remove() {
  paths=(/var/lib/mldonkey /var/log/mldonkey)

  first=true
  for path in ${paths[@]}; do
    if [ -d $path ]; then
      if $first; then
        first=false
        printf "${green}==>${all_off} ${bold}Leftover Paths:${all_off}\n"
      fi
      printf "${blue}  -> ${all_off} ${bold}$path${all_off}"
    fi
  done
}