_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. }