diff --git a/images/linux/scripts/installers/post-deployment.sh b/images/linux/scripts/installers/post-deployment.sh index 10fe34fe..2864dae4 100644 --- a/images/linux/scripts/installers/post-deployment.sh +++ b/images/linux/scripts/installers/post-deployment.sh @@ -9,3 +9,8 @@ if [[ -d "/opt" ]]; then echo "chmod -R 777 /opt" chmod -R 777 /opt fi + +# remove installer and helper folders +rm -rf $HELPER_SCRIPT_FOLDER +rm -rf $INSTALLER_SCRIPT_FOLDER +chmod 755 $IMAGE_FOLDER diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 111f87f0..3aa477cb 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -301,6 +301,18 @@ "destination": "{{template_dir}}/Ubuntu1604-README.md", "direction": "download" }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/post-deployment.sh" + ], + "environment_vars":[ + "HELPER_SCRIPT_FOLDER={{user `helper_script_folder`}}", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", + "IMAGE_FOLDER={{user `image_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts":[ @@ -310,22 +322,6 @@ "RUN_VALIDATION={{user `run_validation_diskspace`}}" ] }, - { - "type": "shell", - "scripts":[ - "{{template_dir}}/scripts/installers/post-deployment.sh" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", - "inline": [ - "rm -rf {{user `helper_script_folder`}}", - "rm -rf {{user `installer_script_folder`}}", - "chmod 755 {{user `image_folder`}}" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, { "type": "file", "source": "{{template_dir}}/config/ubuntu1604.conf", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index d62de1e4..a5b71c07 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -305,6 +305,18 @@ "destination": "{{template_dir}}/Ubuntu1804-README.md", "direction": "download" }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/post-deployment.sh" + ], + "environment_vars":[ + "HELPER_SCRIPT_FOLDER={{user `helper_script_folder`}}", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", + "IMAGE_FOLDER={{user `image_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts":[ @@ -314,22 +326,6 @@ "RUN_VALIDATION={{user `run_validation_diskspace`}}" ] }, - { - "type": "shell", - "scripts":[ - "{{template_dir}}/scripts/installers/post-deployment.sh" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", - "inline": [ - "rm -rf {{user `helper_script_folder`}}", - "rm -rf {{user `installer_script_folder`}}", - "chmod 755 {{user `image_folder`}}" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, { "type": "file", "source": "{{template_dir}}/config/ubuntu1804.conf", diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 5a0f7760..c2a1bd56 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -307,6 +307,18 @@ "destination": "{{template_dir}}/Ubuntu2004-README.md", "direction": "download" }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/post-deployment.sh" + ], + "environment_vars":[ + "HELPER_SCRIPT_FOLDER={{user `helper_script_folder`}}", + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", + "IMAGE_FOLDER={{user `image_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts":[ @@ -316,22 +328,6 @@ "RUN_VALIDATION={{user `run_validation_diskspace`}}" ] }, - { - "type": "shell", - "scripts":[ - "{{template_dir}}/scripts/installers/post-deployment.sh" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", - "inline": [ - "rm -rf {{user `helper_script_folder`}}", - "rm -rf {{user `installer_script_folder`}}", - "chmod 755 {{user `image_folder`}}" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, { "type": "file", "source": "{{template_dir}}/config/ubuntu2004.conf",