forked from vmware/photon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I0759cc37c6afabaf345443b88e77be206975379a Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1463 Reviewed-by: Steve Hoenisch <[email protected]> Tested-by: Steve Hoenisch <[email protected]>
- Loading branch information
shoenisch
committed
Sep 28, 2016
1 parent
2f3e37e
commit 3117ac6
Showing
1 changed file
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Contributing | ||
|
||
The Photon OS project team welcomes contributions from the community. | ||
|
||
If you wish to contribute code and you have not signed our Contributor License Agreement (CLA), our CLA-bot will take you through the process and update the issue when you open a [Pull Request](https://help.github.com/articles/creating-a-pull-request). If you have questions about the CLA process, see our CLA [FAQ](https://cla.vmware.com/faq) or contact us through the GitHub issue tracker. | ||
|
||
This page presents guidelines for contributing to Photon OS. Following the guidelines helps to make the contribution process easy, collaborative, and productive. | ||
|
||
## Submitting Bug Reports and Feature Requests | ||
|
||
Please submit bug reports and feature requests by using our GitHub [Issues](https://github.com/vmware/photon/issues) page. | ||
|
||
Before you submit a bug report about the code in the repository, please check the Issues page to see whether someone has already reported the problem. In the bug report, be as specific as possible about the error and the conditions under which it occurred. On what version and build did it occur? What are the steps to reproduce the bug? | ||
|
||
Feature requests should fall within the scope of the project. Keep in mind that Photon OS is intended to be a minimalist Linux operating system geared toward hosting containerized applications and cloud-native applications. | ||
|
||
## Pull Requests | ||
|
||
Before submitting a pull request, please make sure that you can build Photon OS. See [Building an ISO from the Source Code for Photon OS](https://github.com/vmware/photon/blob/master/docs/build-photon.md). | ||
|
||
## SPEC File Guidelines and Best Practices | ||
|
||
### Upgrade | ||
|
||
If you have specs with scripts in `%pre`, `%post`, `%preun`, or `%postun`, make sure that you have code that is in appropriate sections for upgrade and install. | ||
|
||
%pre | ||
|
||
# First argument is 1 => New Installation | ||
# First argument is 2 => Upgrade | ||
case "$1" in | ||
1) | ||
echo 'new install' | ||
;; | ||
2) | ||
echo 'upgrade' | ||
;; | ||
esac | ||
|
||
%post | ||
|
||
# First argument is 1 => New Installation | ||
# First argument is 2 => Upgrade | ||
case "$1" in | ||
1) | ||
echo 'new install' | ||
;; | ||
2) | ||
echo 'upgrade' | ||
;; | ||
esac | ||
|
||
%preun | ||
|
||
# First argument is 0 => Uninstall | ||
# First argument is 1 => Upgrade | ||
case "$1" in | ||
0) | ||
echo 'new install' | ||
;; | ||
1) | ||
echo 'upgrade' | ||
;; | ||
esac | ||
|
||
%postun | ||
|
||
# First argument is 0 => Uninstall | ||
# First argument is 1 => Upgrade | ||
case "$1" in | ||
0) | ||
echo 'new install' | ||
;; | ||
1) | ||
echo 'upgrade' | ||
;; | ||
esac | ||
|
||
### Systemd Macros | ||
|
||
To enable or disable a service in `post`, `preun`, `postun` sections, you can use the following macros. | ||
|
||
%post %systemd_post cloud-config.service //enables service | ||
|
||
%preun %systemd_preun cloud-final.service //disables service | ||
|
||
%postun %systemd_postun cloud-init.service //it does not do anything | ||
|
||
Expansion of these macros: | ||
|
||
%systemd_post() \ | ||
if [ $1 -eq 1 ] ; then \ | ||
# Initial installation \ | ||
systemctl --no-reload preset %{?*} >/dev/null 2>&1 || : \ | ||
fi \ | ||
%{nil} | ||
|
||
%systemd_preun() \ | ||
if [ $1 -eq 0 ] ; then \ | ||
# Package removal, not upgrade \ | ||
systemctl --no-reload disable --now %{?*} > /dev/null 2>&1 || : \ | ||
fi \ | ||
%{nil} | ||
|
||
%systemd_postun() %{nil} | ||
|
||
Note: The `systemd_postun` macro does not do anything. The `systemd_preun` macro disables the service, while `systemd_post` macro enables the service. | ||
|
||
|