-
Notifications
You must be signed in to change notification settings - Fork 15
Script to create Debian Package of the OS Image Composer Tool #268
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -474,6 +474,41 @@ clean_build_dirs() { | |||||||||||||||||||||||||
| sudo rm -rf cache/ tmp/ | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| #build oic debian package | ||||||||||||||||||||||||||
| build_oic_deb_package() { | ||||||||||||||||||||||||||
| echo "Building Debian Package that installs OS Image Composer Tool " | ||||||||||||||||||||||||||
| echo "Ensuring we're in the working directory before starting deb package build..." | ||||||||||||||||||||||||||
| cd "$WORKING_DIR" | ||||||||||||||||||||||||||
| echo "Current working directory: $(pwd)" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if [ -z "$(ls -A ./config)" ]; then | ||||||||||||||||||||||||||
| echo "Config Directory is empty." | ||||||||||||||||||||||||||
| exit 0 # should be return 1 | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| if [ -z "$(ls -A ./image-templates)" ]; then | ||||||||||||||||||||||||||
| echo "image-templates Directory is empty." | ||||||||||||||||||||||||||
| exit 0 # should be return 1 | ||||||||||||||||||||||||||
|
Comment on lines
+486
to
+490
|
||||||||||||||||||||||||||
| exit 0 # should be return 1 | |
| fi | |
| if [ -z "$(ls -A ./image-templates)" ]; then | |
| echo "image-templates Directory is empty." | |
| exit 0 # should be return 1 | |
| exit 1 # should be return 1 | |
| fi | |
| if [ -z "$(ls -A ./image-templates)" ]; then | |
| echo "image-templates Directory is empty." | |
| exit 1 # should be return 1 |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment indicates this should return 1, but the code exits with 0 (success). This will cause the script to exit successfully even when the image-templates directory is empty, masking a critical validation failure. Change exit 0 to exit 1.
| exit 0 # should be return 1 | |
| exit 1 # should be return 1 |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version number '1.0' is hardcoded in multiple places (lines 492, 499, 501, 508, 509). Consider extracting this into a variable at the function start (e.g., OIC_VERSION='1.0') to make version updates easier and reduce the risk of inconsistencies.
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Multiple sequential mkdir commands can be replaced with a single command using the -p flag: mkdir -p os-image-composer-1.0/{etc/oic,DEBIAN}. This is more efficient and ensures parent directories are created automatically.
| mkdir os-image-composer-1.0 | |
| mkdir os-image-composer-1.0/etc | |
| mkdir os-image-composer-1.0/etc/oic | |
| mkdir os-image-composer-1.0/DEBIAN | |
| mkdir -p os-image-composer-1.0/{etc/oic,DEBIAN} |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra whitespace in description: 'custom bootable' has two spaces instead of one.
| Description: OS Image Composer (OIC) enables users to compose a custom bootable OS image for supported OS distros based on user populated template file that captures package list, configurations and formats of the output OS image. | |
| Description: OS Image Composer (OIC) enables users to compose a custom bootable OS image for supported OS distros based on user populated template file that captures package list, configurations and formats of the output OS image. |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dpkg-deb --build command should include error checking. If the build fails, the function will continue and print the installation command even though no valid package was created. Add a check for the command's exit status and exit with an error if it fails.
| dpkg-deb --build os-image-composer-1.0 | |
| if ! dpkg-deb --build os-image-composer-1.0; then | |
| echo "Error: Failed to build Debian package with dpkg-deb." >&2 | |
| exit 1 | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to add this feature right now in this simple way.
There are more details need to be covered further:
Suggest to hold.