-
-
Notifications
You must be signed in to change notification settings - Fork 5
Description
The Ploutos code contains the following:
if [ -e "${SYSTEMD_SERVICE_UNIT_FILE}" ]; then
mkdir -p ${TARGET_DIR}/rpm/
cp ${SYSTEMD_SERVICE_UNIT_FILE} ${TARGET_DIR}/rpm/${MATRIX_PKG}.service
elif [[ "${SYSTEMD_SERVICE_UNIT_FILE}" == *"*" ]]; then
mkdir -p ${TARGET_DIR}/rpm/
cp ${SYSTEMD_SERVICE_UNIT_FILE} ${TARGET_DIR}/rpm
fiThe if branch wrongly assumes that ${MATRIX_PKG} is the correct name for the service file, and for a service like krill this works fine, the service and package name match, but for cascade the service is called cascaded and the above logic causes the destination service file to have the wrong name.
What needs to happen here is that the RPM SystemD unit handling (which is not present in cargo-generate-rpm like it is in cargo-deb) needs to parse the unit file name based on the rules defined at https://github.com/kornelski/cargo-deb/blob/main/systemd.md#systemd-unit-file-naming.
I.e. given:
<package>.<unit>.<script>- only if unit-name is specified<package>.<script><unit>.<script>- only if unit-name is specified<script>
If <unit> exists in the name, use the name and strip out any <package> that is present.
If <unit> does NOT exist in the name use the filename as-is.