]> git.ipfire.org Git - people/jschlag/ipfire-3.x-image.git/commitdiff
Set the compression level by a cmd argument
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sun, 18 Nov 2018 17:31:40 +0000 (17:31 +0000)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sun, 18 Nov 2018 17:31:40 +0000 (17:31 +0000)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
generate_image.sh

index 1eb1a649646244c71345dd1008177ec9cbca68be..d037bc1436cffb68ac0bc94e72e868ab6581aa90 100755 (executable)
@@ -171,6 +171,11 @@ publish() {
 
        local image_type
        local compression_type
+       local compression_level=1
+
+       if [[ ${IMAGE_RELEASE} -eq ${TRUE} ]]; then
+               compression_level=9
+       fi
 
        # Do these steps for every image format we like to publish
        for image_type in ${IMAGE_TYPES_PUBLISH}; do
@@ -180,7 +185,7 @@ publish() {
                convert_image "${image_type}" "${image_base_file}" "${image_name_final}"
 
                # compress image.
-               compress_image "${compression_type}" "${image_name_final}.${image_type}" "1"
+               compress_image "${compression_type}" "${image_name_final}.${image_type}" ${compression_level}
 
                # Move images to this path
                mv -f "${image_name_final}.${image_type}.${compression_type}" ${path}
@@ -247,6 +252,22 @@ check_for_free_space() {
                fi
 }
 
+parse_cmdline() {
+       while [ $# -gt 0 ]; do
+               case "${1}" in
+                       "--release")
+                                       IMAGE_RELEASE=${TRUE}
+                               ;;
+
+                       *)
+                               error "Invalid argument: ${1}"
+                               return ${EXIT_CONF_ERROR}
+                               ;;
+               esac
+               shift
+       done
+}
+
 #
 # General settings
 #
@@ -312,6 +333,9 @@ LOCAL_REPO_FILE="/etc/pakfire/repos/local.repo"
 # Scripts starts here
 #
 
+#Parse cmdline
+parse_cmdline $@
+
 # Check that pakfire is working
 check_for_pakfire