Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions toolkit/imageconfigs/baremetal.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
"KernelOptions": {
"default": "kernel"
},
"FinalizeImageScripts": [
{
"Path": "scripts/cleanup.sh"
}
],
"Hostname": "azure-linux"
}
]
Expand Down
5 changes: 5 additions & 0 deletions toolkit/imageconfigs/qemu-guest.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
"KernelOptions": {
"default": "kernel-hci"
},
"FinalizeImageScripts": [
{
"Path": "scripts/cleanup.sh"
}
],
"Hostname": "azure-linux"
}
]
Expand Down
22 changes: 22 additions & 0 deletions toolkit/imageconfigs/scripts/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

Comment thread
romoh marked this conversation as resolved.
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

set -eux

# cleanup symlinks created by the toolkit that are not needed for base images
Comment thread
romoh marked this conversation as resolved.
if [ -L /srv ]; then
echo "Removing /srv symlink"
rm /srv
else
echo "/srv symlink does not exist"
fi

# cleanup any logs that may have been created during the build
Comment thread
romoh marked this conversation as resolved.
if [ -d /var/log ]; then
echo "Clearing /var/log"
Comment thread
romoh marked this conversation as resolved.
rm -rf /var/log/*
Comment thread
romoh marked this conversation as resolved.
else
echo "/var/log does not exist"
Comment thread
romoh marked this conversation as resolved.
fi