summarylogtreecommitdiffstats
path: root/ccstudio.install
blob: c1bf8562efb5e7e2c0a039ae9e445bfee0a5a33d (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
_dir=/opt/ccstudio/ccsv8
_grp=ccstudio

post_install() {
    # Since CCS manages its own updates, and treats it's install directory
    # as its working directory, we can't leave it owned by root
    #
    # This is still hacky, since files that CCS creates will be
    # created under user's group, not ccstudio group, and running
    # CCS via newgrp is not a solution, since it would affect project
    # files (which we do want created under user's group).

    getent group ${_grp} &>/dev/null || {
        echo ">>> Creating group ${_grp}"
        groupadd $_grp
    }

    chgrp -R $_grp $_dir

    echo ">>> Run this command as each user who will run CCS, to add to '${_grp}' group:"
    echo ">>>    sudo usermod -a -G ${_grp} \$(whoami)"
}

post_upgrade() {
    chgrp -R $_grp $_dir
}

post_remove() {
    # Since CCS treats its install direcotry as working directory, trash is left.
    # NOTE: other directories (${_dir}/tools) might have also been created, but
    # some are owned by other packages (e.g. compiler), so be conservative.
    rm -rf ${_dir}/eclipse

    # NOTE: we do not remove the group, to not orphan files
    # in case some files don't get removed.
}