I want to create postinst script for my application debian package and I need to modify /etc/environment file (add some path to it) to make my application bin directory content accessible globally in system.
With my current knowledge all I can do now is:
- remove last
"character in/etc/environmentfile (for now I don't know how to do it in bash, maybe I will try this: How can I remove the last character of a file in unix? ) - append
: - append
/usr/some/directory/bin(my application bin dir) to that file - append
"
Is there easier way to add some path to environment variables permanently and globally?
Background:
I'm working on few packages to automate installation/deployment process, I have few things like Java, bash scripts, drivers and some c/c++ tool applications to deploy on many devices.