Creating packages is all about getting your code out there. Most packages will include a step designed to copy files from your git repository to the end-user machine as part of the install.
Please make sure you understand the issues below to ensure your files are copied to the end-user machine without any issues.
Due to how a packages install instruction works you can't just use
mv to copy/move files from your git repository to the location on the end-users machine. This is because a install 'staging area' is used for each package to make it easy to roll back an install if any part of it fails. A staging area is also used for any files being installed by any dependencies that are being installed.
Because of this, the install section includes another key-value within it called
Within this section you can specify multiple files or directories that you would like to copy. You need to specify the source - a relative path in your git repository and the destination - an absolute path on the end-user machine.
... install: copy: - source: ./helloworld.sh destination: /usr/bin/helloworld - source: ./myapp/ destination: /var/lib/myapp/
If you want finer control you can also specify other details about the copy such as the user/group that should own the files, the file permissions or if certain files should be include or excluded from the copy.
... install: copy: - source: ./myapp/ destination: /var/lib/myapp/ user: myuser group: mygroup permissions: 755
Check out the full documentation on the copy section section for more details.
For other sections such as
after_install etc you can move files via the copy (
cp) or move (
mv) commands as they are not subject to the staging area.
You do need to be careful to ensure the paths you use do exist though.
Please see the Paths within commands section within Running commands for a full breakdown.
If you want to copy a file to a location that will overwrite a file put in place by another package the package install may fail. You should instead copy the file to a different location and move them in the