Name: obs-service-run Version: 0.0.1 Release: 0 Summary: Obs service that will run command License: GPL-3.0-or-later URL: https://github.com/huakim-tyk/%{name} Group: Development/Tools/Building BuildArch: noarch BuildRequires: rpm_macro(_obs_service_dir) %description %{summary}. %install %define file %{_obs_service_dir}/run %define script %{buildroot}%{file} mkdir -p %{buildroot}%{_obs_service_dir} cat <<'EOF' > %{script} #!/bin/bash while [ -n "$1" ];do case $1 in --*) typeset -a "${1:2}" eval "${1:2}+=(\"\$2\")" shift; shift; ;; *) shift; ;; esac done eval "outdir=\"\$(realpath -s \"\${outdir:-.}\")\" ; ${command:-". \"\$sourcefile\""}" exit $? EOF cat <<'EOF' > %{script}.service Example how to create a service source file that will be executed if no command given command that will be launched EOF %post %postun %files %attr(755, root, root) %{file} %attr(644, root, root) %{file}.service %changelog