Skip to content

A demo project that uses CPack to build an RPM containing a systemd service.

Notifications You must be signed in to change notification settings

andrew-hardin/cpack-systemd-demo

Repository files navigation

Create an RPM with a systemd service via CPack

This project uses CPack to create an RPM containing a systemd service. I'm a novice when in comes to creating RPMs- caveat emptor.

Here's a utilitarian user's guide:

# Clone, build, and package the project.
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/hello-world-service
make package

# Go ahead and install the RPM.
ls *.rpm
yum install ./hello-world-0.1-Linux.rpm

# Check the status of the service - should be stopped.
systemctl status hello-world

# Start the service, then check its status.
systemctl start hello-world
systemctl status hello-world

# Removing the RPM should cleanup all traces.
yum remove hello-world
systemctl status hello-world

Upgrading from 0.1...

This project was fixed to support upgrades to the RPM package. If you're creating your own RPMs, I strongly recommend testing the upgrade process before shipping.

References

About

A demo project that uses CPack to build an RPM containing a systemd service.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published