summarylogtreecommitdiffstats
path: root/cozy-apache.install
blob: e71afc8116c6ef9ccb6cd70b779f1b69ff810cb0 (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
53
54
55
56
57
58
59
60
#!/bin/sh
# Install scripts for Cozy
# Maintainer: Brendan Abolivier <brendan@cozycloud.cc>

# Fancy message is fancy
msg_blue() {
    printf "${blue}==>${bold} $1${all_off}\n"
}

prompt_blue() {
    printf "${blue}==>${bold} $1${all_off}"
}

all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"

post_install() {
    msg "This package exists only for information purposes. It has been deprecated. If you're using it, it's highly recommanded uninstalling it and using the \"cozy\" package."
}

pre_remove() {
    which cozy-monitor >/dev/null 2>&1
    RESULT=$?
    if [ "$RESULT" = "0" ]; then
        APPS="$(cozy-monitor status | grep -vE '(mta|postfix|couch|controller|data-system|ds|home|proxy)' | sed 's/:.*//;s/\[Error//' | xargs echo)"
        APPS="$APPS proxy home data-system"
        for app in $APPS ; do cozy-monitor uninstall $app ; done
    fi
    which supervisorctl >/dev/null 2>&1 && supervisorctl stop cozy-controller
}

post_remove() {
    echo "The Cozy database contains all your user data. Keeping it could be troublesome for further installations. It will not be removed, unless you run"
    echo "    # /usr/bin/cozy-rm-db"
    mv /etc/cozy/couchdb.login /tmp/couchdb.login
    echo "Moved the admin logins to /tmp/couch.login"
    echo "Please don't forget to move it elsewhere if you don't want to lose access to your whole database."


    [ -d /etc/cozy ] && msg_blue "Deleting /etc/cozy directory" && rm -rf /etc/cozy
    [ -d /usr/local/var/log/cozy ] && msg_blue "Deleting /usr/local/var/log/cozy directory" && rm -rf /usr/local/var/log/cozy
    [ -d /usr/local/cozy ] && msg_blue "Deleting /usr/local/cozy directory" && rm -rf /usr/local/cozy
    [ -f /var/httpd/conf/extra/cozy.conf ] && msg_blue "Erasing Apache2 configuration" && rm -f /var/httpd/conf/extra/cozy.conf
    msg_blue "Erasing scripts and folders"
    [ -f /usr/local/sbin/debian-reconfigure-cozy-domain.sh ] && rm -f /usr/local/sbin/debian-reconfigure-cozy-domain.sh
    [ -d /usr/local/var/cozy ] && rm -rf /usr/local/var/cozy
    [ -d /usr/share/cozy ] && rm -rf /usr/share/cozy
    msg_blue "Removing NPM dependencies"
    [ -f /usr/bin/cozy-controller ] && npm remove -g cozy-controller
    [ -f /usr/bin/cozy-controller ] && npm remove -g cozy-monitor
    sed -i 's/\n#Cozy configuration\nInclude conf/extra/cozy.conf//' /etc/httpd/conf/httpd.conf
    systemctl restart httpd
    msg_blue "Erasing supervisor configuration" && rm /etc/supervisor.d/cozy*
    supervisorctl reload
}

post_upgrade() {
    msg "This package exists only for information purposes. It has been deprecated. If you're using it, it's highly recommanded uninstalling it and using the \"cozy\" package. Help on migrating instance can be found here: https://blog.benj.me/2015/11/19/cozycloud-migrer-son-instance-2-le-retour/"
}