<commit_before>###############################################
#
# Kubos File Transfer Service
#
###############################################

KUBOS_CORE_FILE_TRANSFER_POST_BUILD_HOOKS += FILE_TRANSFER_BUILD_CMDS
KUBOS_CORE_FILE_TRANSFER_POST_INSTALL_TARGET_HOOKS += FILE_TRANSFER_INSTALL_TARGET_CMDS
KUBOS_CORE_FILE_TRANSFER_POST_INSTALL_TARGET_HOOKS += FILE_TRANSFER_INSTALL_INIT_SYSV

define FILE_TRANSFER_BUILD_CMDS
	cd $(BUILD_DIR)/kubos-$(KUBOS_VERSION)/services/file-service && \
    PATH=$(PATH):~/.cargo/bin && \
	CC=$(TARGET_CC) cargo build --target $(CARGO_TARGET) --release
endef

# Install the application into the rootfs file system
define FILE_TRANSFER_INSTALL_TARGET_CMDS
	mkdir -p $(TARGET_DIR)/usr/sbin
	$(INSTALL) -D -m 0755 $(BUILD_DIR)/kubos-$(KUBOS_VERSION)/$(CARGO_OUTPUT_DIR)/file-service \
		$(TARGET_DIR)/usr/sbin
		
    echo 'CHECK PROCESS file-service PIDFILE /var/run/file-service.pid' > $(TARGET_DIR)/etc/monit.d/kubos-app-service.cfg
    echo '    START PROGRAM = "/etc/init.d/S${BR2_KUBOS_CORE_APP_SERVICE_INIT_LVL}kubos-core-file-transfer start"' >> $(TARGET_DIR)/etc/monit.d/kubos-app-service.cfg 
    echo '    IF ${BR2_KUBOS_CORE_APP_SERVICE_RESTART_COUNT} RESTART WITHIN ${BR2_KUBOS_CORE_APP_SERVICE_RESTART_CYCLES} CYCLES THEN TIMEOUT' \
    >> $(TARGET_DIR)/etc/monit.d/kubos-file-transfer.cfg  
endef

# Install the init script
define FILE_TRANSFER_INSTALL_INIT_SYSV
	$(INSTALL) -D -m 0755 $(BR2_EXTERNAL_KUBOS_LINUX_PATH)/package/kubos/kubos-core/kubos-core-file-transfer/kubos-core-file-transfer \
	    $(TARGET_DIR)/etc/init.d/S$(BR2_KUBOS_CORE_FILE_TRANSFER_INIT_LVL)kubos-core-file-transfer
endef

kubos-core-file-transfer-cargoclean: kubos-core-file-transfer-dirclean
	cd $(BUILD_DIR)/kubos-$(KUBOS_VERSION)/services/file-service && \
	PATH=$(PATH):~/.cargo/bin && \
	cargo clean

$(eval $(virtual-package))
<commit_msg>Correcting file transfer monit config<commit_after>###############################################
#
# Kubos File Transfer Service
#
###############################################

KUBOS_CORE_FILE_TRANSFER_POST_BUILD_HOOKS += FILE_TRANSFER_BUILD_CMDS
KUBOS_CORE_FILE_TRANSFER_POST_INSTALL_TARGET_HOOKS += FILE_TRANSFER_INSTALL_TARGET_CMDS
KUBOS_CORE_FILE_TRANSFER_POST_INSTALL_TARGET_HOOKS += FILE_TRANSFER_INSTALL_INIT_SYSV

define FILE_TRANSFER_BUILD_CMDS
	cd $(BUILD_DIR)/kubos-$(KUBOS_VERSION)/services/file-service && \
    PATH=$(PATH):~/.cargo/bin && \
	CC=$(TARGET_CC) cargo build --target $(CARGO_TARGET) --release
endef

# Install the application into the rootfs file system
define FILE_TRANSFER_INSTALL_TARGET_CMDS
	mkdir -p $(TARGET_DIR)/usr/sbin
	$(INSTALL) -D -m 0755 $(BUILD_DIR)/kubos-$(KUBOS_VERSION)/$(CARGO_OUTPUT_DIR)/file-service \
		$(TARGET_DIR)/usr/sbin
		
    echo 'CHECK PROCESS file-service PIDFILE /var/run/file-service.pid' > $(TARGET_DIR)/etc/monit.d/kubos-file-service.cfg
    echo '    START PROGRAM = "/etc/init.d/S${BR2_KUBOS_CORE_APP_SERVICE_INIT_LVL}kubos-core-file-transfer start"' >> $(TARGET_DIR)/etc/monit.d/kubos-file-service.cfg 
    echo '    IF ${BR2_KUBOS_CORE_APP_SERVICE_RESTART_COUNT} RESTART WITHIN ${BR2_KUBOS_CORE_APP_SERVICE_RESTART_CYCLES} CYCLES THEN TIMEOUT' \
    >> $(TARGET_DIR)/etc/monit.d/kubos-file-service.cfg  
endef

# Install the init script
define FILE_TRANSFER_INSTALL_INIT_SYSV
	$(INSTALL) -D -m 0755 $(BR2_EXTERNAL_KUBOS_LINUX_PATH)/package/kubos/kubos-core/kubos-core-file-transfer/kubos-core-file-transfer \
	    $(TARGET_DIR)/etc/init.d/S$(BR2_KUBOS_CORE_FILE_TRANSFER_INIT_LVL)kubos-core-file-transfer
endef

kubos-core-file-transfer-cargoclean: kubos-core-file-transfer-dirclean
	cd $(BUILD_DIR)/kubos-$(KUBOS_VERSION)/services/file-service && \
	PATH=$(PATH):~/.cargo/bin && \
	cargo clean

$(eval $(virtual-package))

{'fraction_non_alphanumeric': 0.16954557533882542, 'fraction_numerical': 0.006909380813180973, 'mean_word_length': 5.906422018348624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2373302', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1438, 'n_words': 180}