Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed errors when running appliance packager on macOS #492

Closed
wants to merge 1 commit into from

Conversation

robrui
Copy link
Contributor

@robrui robrui commented Nov 13, 2024

🗣 Description

This pull request modifies both the tar and date commands to conditionally adapt their behavior depending on the underlying operating system.
1. tar Command: The script checks whether it’s running on macOS or Linux using the uname command. For macOS, the tar command is executed without the --owner and --group flags due to compatibility issues with bsdtar. For Linux, the tar command includes the --numeric-owner, --owner=0, and --group=0 flags to set file ownership to root. This ensures compatibility across both platforms.
2. date Command: The date command was adjusted to handle platform-specific differences. On Linux, it uses the standard date format, while on macOS, adjustments are made to accommodate slight differences in how the date command handles formatting.

This update ensures that both commands work seamlessly on macOS and Linux systems, resolving issues with incompatible options.

💭 Motivation and context

These changes are required to address platform-specific differences in the tar and date commands. macOS uses bsdtar, which does not support the --owner and --group flags, while Linux requires them for setting file ownership. Similarly, the date command on macOS differs slightly from its Linux counterpart. By implementing these adjustments, the script will now function correctly on both operating systems without errors.

🧪 Testing

The changes were tested by running the script on macOS. On macOS, the script ran without the --owner and --group options in tar, and the date command executed with the correct format.

✅ Pre-approval checklist

•	This PR has an informative and human-readable title.
•	Changes are limited to a single goal - eschew scope creep!
•	These code changes follow [cisagov code standards](https://github.com/cisagov/development-guide).
•	All relevant repo and/or project documentation has been updated to reflect the changes in this PR.

ToDo: • Add relevant type of type-of-change labels

@mmguero
Copy link
Collaborator

mmguero commented Nov 13, 2024

Thank you! We'll get it merged in for the next release.

This was referenced Nov 14, 2024
@mmguero
Copy link
Collaborator

mmguero commented Nov 18, 2024

merged as part of #493.

@mmguero mmguero closed this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants