-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
723 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
# get the version | ||
$version=$args[0] | ||
$bucket=$args[1] | ||
|
||
# create msi | ||
candle.exe -ext WixUtilExtension.dll ./amazon-cloudwatch-agent.wxs | ||
light.exe -ext WixUtilExtension.dll ./amazon-cloudwatch-agent.wixobj | ||
|
||
# upload to s3 | ||
aws s3 cp ./amazon-cloudwatch-agent.msi "s3://cloudwatch-agent-integration-bucket/integration-test/packaging/$version/amazon-cloudwatch-agent.msi" | ||
Write-Host "s3 for msi is s3://cloudwatch-agent-integration-bucket/integration-test/packaging/$version/amazon-cloudwatch-agent.msi" | ||
aws s3 cp ./amazon-cloudwatch-agent.msi "s3://$bucket/integration-test/packaging/$version/amazon-cloudwatch-agent.msi" | ||
Write-Host "s3 for msi is s3://$bucket/integration-test/packaging/$version/amazon-cloudwatch-agent.msi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
#get the version of the agent | ||
AGENT_VERSION=$(</tmp/CWAGENT_VERSION) | ||
|
||
#create a .pkg file | ||
rm -rf /tmp/AmazonCWAgentPackage | ||
mkdir /tmp/AmazonCWAgentPackage | ||
gunzip -c /tmp/amazon-cloudwatch-agent.tar.gz | tar -C /tmp/AmazonCWAgentPackage -xvf - | ||
COMMON_CONFIG_PATH=/tmp/AmazonCWAgentPackage/opt/aws/amazon-cloudwatch-agent/etc/common-config.toml | ||
SAMPLE_SUFFIX=SAMPLE_DO_NOT_MODIFY | ||
mv ${COMMON_CONFIG_PATH} ${COMMON_CONFIG_PATH}.${SAMPLE_SUFFIX} | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to mv common-config.toml" | ||
exit 1 | ||
fi | ||
|
||
mkdir /tmp/AmazonAgentScripts | ||
mv preinstall.sh /tmp/AmazonAgentScripts/preinstall | ||
mv postinstall.sh /tmp/AmazonAgentScripts/postinstall | ||
chmod +x /tmp/AmazonAgentScripts/preinstall | ||
chmod +x /tmp/AmazonAgentScripts/postinstall | ||
|
||
rm -rf artifact | ||
mkdir artifact | ||
sudo pkgbuild --root /tmp/AmazonCWAgentPackage/ --install-location "/" --scripts /tmp/AmazonAgentScripts --identifier com.amazon.cloudwatch.agent --version=$AGENT_VERSION artifact/amazon-cloudwatch-agent.pkg | ||
aws s3 cp ./artifact/amazon-cloudwatch-agent.pkg "s3://$1/integration-test/packaging/$2/amazon-cloudwatch-agent.pkg" | ||
|
||
#TODO uncomment when signing is implemented | ||
## create a package.tar.gz for the uploding it to signing bucket | ||
#tar -cvzf artifact.gz -C artifact . | ||
#tar -cvzf package.tar.gz manifest.yaml artifact.gz | ||
# | ||
##upload the .pkg file created | ||
#/usr/local/bin/aws s3 cp /tmp/package.tar.gz "s3://macos-cwagent-binaries/$AGENT_VERSION/pre-signed/package.tar.gz" --acl public-read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type: :app # MUST indicate the :app type. | ||
os: :osx | ||
name: amazon-cloudwatch-agent.pkg # MUST reference the EXECUTABLES_TO_SIGN path in the output. | ||
outputs: | ||
- label: macos | ||
path: amazon-cloudwatch-agent.pkg | ||
app: | ||
:identifier: com.amazon.cloudwatch.agent # must to be the same with the Bundle Identifier in info.plist | ||
signing_requirements: | ||
certificate_type: :developerIDInstallerDistribution | ||
app_id_prefix: 94KV3E626L |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
echo "Creating a default user cwagent" | ||
COMMON_CONFIG_PATH=/opt/aws/amazon-cloudwatch-agent/etc/common-config.toml | ||
SAMPLE_SUFFIX=SAMPLE_DO_NOT_MODIFY | ||
if [ ! -f ${COMMON_CONFIG_PATH} ]; then | ||
cp ${COMMON_CONFIG_PATH}.${SAMPLE_SUFFIX} ${COMMON_CONFIG_PATH} | ||
fi | ||
|
||
if [[ cwagent == `sudo dscl . -list /Users UniqueID | awk '{print $1}' | grep -w cwagent` ]]; then | ||
echo "User already exists!" | ||
exit 0 | ||
fi | ||
|
||
LastID=`sudo dscl . -list /Users UniqueID | awk '{print $2}' | sort -n | tail -1` | ||
NextID=$((LastID + 1)) | ||
|
||
. /etc/rc.common | ||
sudo dscl . create /Users/cwagent | ||
sudo dscl . create /Users/cwagent RealName cwagent | ||
|
||
sudo dscl . create /Users/cwagent UniqueID $NextID | ||
# PrimaryGroupID of 20 to create a standard user | ||
sudo dscl . create /Users/cwagent PrimaryGroupID 20 | ||
sudo dscl . create /Users/cwagent UserShell /usr/bin/false | ||
sudo dscl . create /Users/cwagent NFSHomeDirectory /Users/cwagent | ||
sudo createhomedir -u cwagent -c | ||
|
||
echo " " | ||
echo "New user `sudo dscl . -list /Users UniqueID | awk '{print $1}' | grep -w cwagent` has been created with unique ID `sudo dscl . -list /Users UniqueID | grep -w cwagent | awk '{print $2}'`" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
COMMON_CONFIG_PATH=/opt/aws/amazon-cloudwatch-agent/etc/common-config.toml | ||
SAMPLE_SUFFIX=SAMPLE_DO_NOT_MODIFY | ||
if [ -e ${COMMON_CONFIG_PATH}.${SAMPLE_SUFFIX} -a -e ${COMMON_CONFIG_PATH} ]; then | ||
diff ${COMMON_CONFIG_PATH}.${SAMPLE_SUFFIX} ${COMMON_CONFIG_PATH} >/dev/null 2>&1 | ||
if [ $? -eq 0 ]; then | ||
rm -r ${COMMON_CONFIG_PATH} | ||
fi | ||
fi | ||
|
||
launchctl list com.amazon.cloudwatch.agent >/dev/null 2>&1 | ||
if [ $? -eq 0 ]; then | ||
echo "Agent is running in the instance" | ||
echo "Stopping the agent" | ||
launchctl unload /Library/LaunchDaemons/com.amazon.cloudwatch.agent.plist | ||
echo "Agent stopped" | ||
fi |
Oops, something went wrong.