ubuntu - How to design software for Linux in relation to Windows? -


i have application i've written windows porting linux (ubuntu specific). problem have used linux, never developed it. more specifically, dont understand fundamental layout of system. example, should install software? want accessible users, need write permission area edit data files. furthermore, how can determine in programmatic way, software installed (not being called from)? in windows, use registry locate configuration file has of relevant information, there no registry in linux. thanks!

the filesystem hierarchy standard (misnamed -- not standard) helpful you; describes administrator preferences data should live.

since you're first packaging software, i'd recommend doing very little. debian, ubuntu, red hat, suse, mandriva, arch, annvix, openwall, pld, etc., have own little idiosyncrasies how software should best packaged.

building

your best bet provide source tarball builds , hope users or packagers distributions pick , package you. users fine downloading tarball, unpacking, compiling, , installing.

for building software, make(1) usual standard. other tools exists, 1 available everywhere, , pretty reasonable. (even if syntax cranky.) users expect able run: make ; make install or ./configure ; make ; make install build , install software /usr/local default. (./configure part of autotools toolchain; nice providing ./configure --prefix=/opt/foo allow users change software gets installed 1 command line parameter. i'd try avoid autotools far can, @ point, easier write portable software with them without them.)

packaging

if want provide one-stop-packaging, debian policy manual provide canonical rules how package software. debian new maintainers guide provide kinder, gentler, walkthrough of tools unique building packages debian , debian-derived systems.

ubuntu's packaging guide may have details specific ubuntu. (i haven't read yet.)

configuration

when comes application's configuration file, typically file stored in /etc/<foo> <foo> represents program / package. see /etc/resolv.conf details on name resolution, /etc/fstab list of devices contain filesystems , mount them, /etc/sudoers sudo(8) configuration, /etc/apt/ apt(8) package management system, etc.

sometimes applications provide per-user configuration; config files stored in ~/.foorc or ~/.foo/, in case entire directory more useful file. (see ~/.vim/, ~/.mozilla/, ~/.profile, etc.)

if wanted provide -c <filename> command line option tell program use non-standard configuration file, comes in real handy. (especially if users can run foo -c /dev/null start default configuration.)

data files

users store data in home directory. don't need this; sure start directory navigation boxes getenv("home") or load configuration files via sprintf(config_dir, "%s/%s/config", getenv("home"), ".application"); or similar. (they won't have permissions write anywhere home directory , /tmp/ @ sites.)

sometimes data can stored in hidden file or directory; ssh(1) example, keeps data in ~/.ssh/. typically, users want default kry name ssh-keygen(1) ssh-agent(1) can find key minimum of fuss. (it uses ~/.ssh/id_rsa default.) shotwell(1) photo manager provides managed experience, similar iphoto.app apple. lets users choose starting directory, otherwise organizes files , directories within sees fit.

if application general purpose program, you'll let users select own filenames. if want store data directly memory stick mounted in /dev or /media or remote filesystem mounted /automount/blah, home directories, /srv/ directory content served on machine, or /tmp/, let them. it's users pick reasonable filenames , directories data. users have proper permissions already. (don't try provide mechanisms users write in locations don't have privileges.)

application file installation , ownership

there 2 common ways install application on linux system:

  1. the administrator installs once, everyone. usual. programs owned root or bin or adm or similar account. programs run whichever user executes them, user's privileges creating , reading files. if packaged distribution packaging files, executables typically live in /usr/bin/, libraries in /usr/lib/, , non-object-files (images, schemas, etc.) live in /usr/share/. (/bin/ , /lib/ applications needed @ boot or rescue environments. /usr might common machines in network, mounted read-only late in boot process.) (see fhs full details.)

    if programs unpackaged, /usr/local/ starting point: /usr/local/bin/, /usr/local/lib/, /usr/local/share/, etc. administrators prefer /opt/.

  2. users install applications home directory. less common, many users have ~/bin/ directory store shell scripts or programs write, or link in programs ~/local/<foo>/ directory. (there nothing magic name. first thing thought of years ago. others choose other names.) ./configure --prefix=~/local/blah pays itself.)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -