summarylogtreecommitdiffstats
path: root/yozo-office.install
blob: b91843eeeb2d192fa53b4bb82d48ea2ef9b32c23 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
_PKGBASE="@pkgbase@"
_PKGNAME="@pkgname@"
_PKGVER="@pkgver@"
_APPDIR="/opt/apps/@pkgname@"
pre_install() {
    if [ "$1" = "${_PKGVER}" ]; then 
        if ! pacman -Qs "${_PKGBASE}" | grep -qi 'local'; then
            if [ -f "/etc/Yozosoft/${_pkgname}/installinfo.cfg" ]; then
                echo "Yozo Office is exist. Please uninstall Yozo Office, then install this office."
                exit 1
            fi
            if [ -f /etc/Evermore/EIOffice/installinfo.cfg ]; then
                echo "EIOffice is exist. Please uninstall EIOffice, then install this office."
                exit 1
            fi
        fi
    fi

    if [ "$1" = "${_PKGVER}" ]; then
        if [ -f "${_APPDIR}/System/doExit" ]; then
            "${_APPDIR}/System/doExit" -check
            if [ $? -ne 0 ]; then
                echo "Yozo Office is running. Please stop Yozo Office, then upgrade."
                exit 1
            fi
        fi
    fi

    exit 0

}

post_install() {
    target="${_APPDIR}"
    if [ "$1" = "${_PKGVER}" ]; then
        if [ -z "$2" ]; then
            echo "Configuring system. Please wait a while."
            "${target}/Jre/bin/java" -jar "${target}/System/configure.jar" -i
        fi
        "${target}/Jre/bin/deployApplet" -default -nogui
        echo "Congratulations! Installation is complete. Please restart your computer."
    fi
    exit 0
}

post_upgrade() {
    xdg-icon-resource forceupdate --theme hicolor &>/dev/null
    update-mime-database /usr/share/mime &>/dev/null
    update-desktop-database -q &>/dev/null
}
pre_remove() {
    target="${_APPDIR}"
    if [ "$1" = "${_PKGVER}" ]; then
        "${target}/System/doExit" -check
        if [ $? -ne 0 ]; then
            echo "Yozo Office is running. Please stop Yozo Office, then uninstall."
            exit 1
        fi
        echo "Configuring system. Please wait a while."

        if [ -f "${target}/System/unpatch.ini" ]; then
            while read line
            do
                truncate="${line#*=}"
                if [ -f "${truncate}" ]; then
                    rm -f "${truncate}"
                fi
            done < "${target}/System/unpatch.ini"
        fi

        "${target}/Jre/bin/java" -jar "${target}/System/configure.jar" -u
        rm /etc/skel/.java/deployment/deployment.properties

        rm -rf "${HOME}/.${_PKGNAME}/UserConfig"
        if [ -f "${target}/patcheio.log" ]; then
            rm -f "${target}/patcheio.log"
        fi
        if [ -d "${HOME}/.${_PKGNAME}/CustomizedSEImages" ]; then
            rm -rf "${HOME}/.${_PKGNAME}/CustomizedSEImages"
        fi
        rm -rf "${target}/Config/Key.store"
        rm -rf "${target}/System"
        rm -rf "${target}/Upgrade/Patch"
        rm -rf "${target}/Jre/lib"
    fi
    exit 0
}