diff options
Diffstat (limited to 'amule-daemon.install')
-rw-r--r-- | amule-daemon.install | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/amule-daemon.install b/amule-daemon.install new file mode 100644 index 000000000000..6e561e844617 --- /dev/null +++ b/amule-daemon.install @@ -0,0 +1,67 @@ +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} If you plan to use external client (e.g. amuleGUI or amuleweb) then you need to + provide ${bold}[ExternalConnect]${all_off} configuration. + ${blue}->${all_off} You also need to specify amuleweb password. + Please follow ${bold}https://wiki.archlinux.org/index.php/AMule${all_off} for more information. + ${blue}->${all_off} Service '${bold}amule${all_off}' can be started as '${bold}systemctl start amule${all_off}'. + ${blue}->${all_off} Service '${bold}amule@${all_off}' (by user) can be started as '${bold}systemctl start amule@${all_off}' + ${blue}->${all_off} Service '${bold}amuleweb${all_off}' can be started as '${bold}systemctl start amuleweb${all_off}'.\n" +} + +_notice_if_amuled_exist() { + printf "${yellow}==>${all_off} ${bold}ATENTION:${all_off} + ${green}==>${all_off} ${bold}Deprecated 'amuled' user/group found:${all_off} + ${blue}->${all_off} The deprecated user/group '${bold}amuled${all_off}' has been removed. + ${blue}->${all_off} New '${bold}amule${all_off}' user/group has been created instead.\n" +} + +_instructions_if_amuled_exist() { + printf "${yellow}==>${all_off} ${bold}ATENTION:${all_off} + ${blue}->${all_off} The new aMule data path is ${bold}/var/lib/amule${all_off} + Please move your Amule data to new path with: + + # ${bold}mv /var/lib/amuled/* /var/lib/amule${all_off} + # ${bold}chown -R amule:amule /var/lib/amule${all_off}\n" +} + +post_install() { + post_upgrade $1 + _instructions +} + +post_upgrade() { + if id -u amuled >/dev/null 2>&1; then + userdel amuled + groupdel amuled + _notice_if_amuled_exist + fi + if [ -d /var/lib/amuled ]; then + _instructions_if_amuled_exist + fi + + systemd-sysusers amule.conf + + install -dm744 -o amule -g amule /var/lib/amule +} + +post_remove() { + paths=(/var/lib/amule) + + 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}\n" + fi + done +} |