I would put a link or a script in /usr/local/bin
A link if all you need to do to start foo.exe
is to type the full path /my/path/foo.exe
. You on the other hand would need a small shell script that calls mono /path/to/foo.exe
.
Angenommen, Sie verteilen ein Programm, das unter Linux ausgeführt wird, nennen Sie es Foo, und die Programmdatei heißt foo.exe (da es sich um ein CLR-Programm handelt, das unter Mono ausgeführt wird) und es ein paar DLLs im selben Verzeichnis und möglicherweise auch benötigt Eine neuere Version benötigt möglicherweise einige Datendateien, die beim Start und was auch immer gelesen wird, daher ist das Umstellen in ein globales bin-Verzeichnis etwas umständlich, und es ist wirklich vorzuziehen, im ursprünglichen Verzeichnis zu bleiben ...
Aber der Benutzer würde es vorziehen, um das Programm aufzurufen, indem Sie foo
statt mono /path/to/foo.exe
.
Was ist der beste / üblichste Weg, um einen so kurzen Befehl bereitzustellen? Kann / sollte ein Installationsskript / Makefile ein einzeiliges Skript erstellen foo
, das den vollständigen Pfad aufruft, und das einzeilige Skript in ein globales bin-Verzeichnis stellen? Wenn ja, wie sollte das Zielverzeichnis sein und gibt es Anweisungen, wie genau dies zu tun ist? Oder gibt es eine bevorzugte Alternative?
edit : Der Ansatz, ein einzeiliges Skript zur Installationszeit zu erstellen, scheint gut zu funktionieren. Hier ist das eigentliche Installationsskript, das ich am Ende geschrieben habe:
a@a-desktop:~/ayane$ cat install.sh #!/bin/sh echo mono `pwd`/ayane.exe '"$@"' >ayane chmod +x ayane mv ayane /usr/local/bin
I would put a link or a script in /usr/local/bin
A link if all you need to do to start foo.exe
is to type the full path /my/path/foo.exe
. You on the other hand would need a small shell script that calls mono /path/to/foo.exe
.
I would use the Filesystem Hierarchy Standard as a guide and install your package in /opt/package_name
and place your wrapper script in /usr/local/bin
or allow the user to configure these choices and generate the wrapper script at install-time based on those choices. An alternative would be to put the wrapper script in the same directory as the application and add the application directory to PATH
in /etc/profile
, but I consider this less desirable.
Use an alias
put something like
alias foo='mono /path/to/foo.exe'
into the users shell initialisation file.
The simplest way is with a Bash alias. I'm not sure if it's normal practice to add an alias to profile files though.