I am writing installation script for my program, which is supposed to run on Linux/Unix OS. What is the default directory for the following files:
The listing varies depending on the Linux filesystem.
1) /bin
, /usr/bin
, /usr/local/bin
2/3) /lib
, /usr/lib
, /usr/local/lib
3.
/usr/share/lib
4) /etc
is a read-only spot for configuration data.
5) /usr/local/etc
or usually in the /home
directory under the dot directory name, if the profile allows the bin directory to be located under the /home/user_id/bin
where 'user_id' is the relevant login id.. for an example for user 'jdoe', his configuration could be written to /home/jdoe/.configs
or ~/.configs
Do not rely on this, for the most part the LSB filesystem dictates that there shall be at minimum: /bin
, /etc
, /usr
, /lib
, /home
For instance, the /usr
could be on a different partition, likewise the same for /home
Edit: Thanks to dtrosset for pointing out my blooper....
$PREFIX/bin
$PREFIX/lib
$PREFIX/lib
/etc
$HOME/.config
Where $HOME
is the home directory of the user running the application, determined at runtime. $PREFIX
depends on the method of distribution:
$PREFIX
should be configurable but default to /usr/local
; $PREFIX
should usually be /usr/local
(but /opt
is also common); $PREFIX
should be /usr
. Documentation and other architecture-independent files should go in $PREFIX/share/doc
; program-generated files shared between instances should go in /var/run
(things like lockfiles, pidfiles and sockets) or /var/lib
(things like shared binary databases).
查看文件系统层次结构标准 。
Executable (Binary):
Shared:
Other:
I'm not sure it would be wise to be writing an install script if you don't know the file structure of a *nix OS. Besides which, each distribution of *nix is sligthly different when it comes to where the data is stored.
I suggest you read this: http://www.comptechdoc.org/os/linux/commands/linux_crfilest.html
^.^
The easiest way is to make an .rpm
of your application and then use for example alien
to make an .deb
out of it. Last I made a deb, it was really, really simple. The packaging also enables you to have a sorts-of auto-update if you want to enable it and you will not need to think a lot about uninstallation procedures.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.