-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
ccf3575
commit 570f36b
Showing
5 changed files
with
110 additions
and
107 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 |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
|
||
# Check for input parameter (the message to be added) | ||
if [ $# -lt 1 ]; then | ||
echo "Usage: $0 <message>" | ||
exit 1 | ||
echo "Usage: $0 <message>" | ||
exit 1 | ||
fi | ||
|
||
RSS_FILE=$1 | ||
|
@@ -16,42 +16,42 @@ MESSAGE=$(echo "$MESSAGE" | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\&q | |
|
||
# Check if the RSS file exists | ||
if [ -f "$RSS_FILE" ]; then | ||
# Get the size of the RSS file | ||
FILE_SIZE=$(stat -c%s "$RSS_FILE") | ||
|
||
# If the size of the RSS file is more than 100KB, remove it | ||
if [ "$FILE_SIZE" -gt 102400 ]; then | ||
echo "The RSS file is larger than 100KB. Removing the file..." | ||
rm "$RSS_FILE" | ||
fi | ||
# Get the size of the RSS file | ||
FILE_SIZE=$(stat -c%s "$RSS_FILE") | ||
|
||
# If the size of the RSS file is more than 100KB, remove it | ||
if [ "$FILE_SIZE" -gt 102400 ]; then | ||
echo "The RSS file is larger than 100KB. Removing the file..." | ||
rm "$RSS_FILE" | ||
fi | ||
fi | ||
|
||
# If the RSS file doesn't exist, create a new one | ||
if [ ! -f "$RSS_FILE" ]; then | ||
echo '<?xml version="1.0" encoding="UTF-8"?> | ||
echo '<?xml version="1.0" encoding="UTF-8"?> | ||
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"> | ||
<channel> | ||
<author><name>OpenStreetMap US</name></author> | ||
<title type="text">tile.ourmap.us Planet Build</title> | ||
<link>https://tile.ourmap.us/</link> | ||
<description>Planet build status</description> | ||
</channel> | ||
</rss>' > "$RSS_FILE" | ||
</rss>' >"$RSS_FILE" | ||
fi | ||
|
||
# Read the URL from /tmp/seashells_render and extract it using grep | ||
URL=$(grep -o 'https://[^ ]*' /tmp/seashells_render) | ||
|
||
# Add the new item entry to the RSS file | ||
xmlstarlet ed --inplace \ | ||
-s "//channel" -t elem -n "item" -v "" \ | ||
-s "//channel/item[last()]" -t elem -n "title" -v "$TITLE" \ | ||
-s "//channel/item[last()]" -t elem -n "author" -v "[email protected]" \ | ||
-s "//channel/item[last()]" -t elem -n "link" -v "$URL" \ | ||
-s "//channel/item[last()]" -t elem -n "pubDate" -v "$CURRENT_DATE" \ | ||
-s "//channel/item[last()]" -t elem -n "content:encoded" -v "$MESSAGE" \ | ||
-i "//channel/item[last()]/content:encoded" -t attr -n "type" -v "html" \ | ||
"$RSS_FILE" | ||
-s "//channel" -t elem -n "item" -v "" \ | ||
-s "//channel/item[last()]" -t elem -n "title" -v "$TITLE" \ | ||
-s "//channel/item[last()]" -t elem -n "author" -v "[email protected]" \ | ||
-s "//channel/item[last()]" -t elem -n "link" -v "$URL" \ | ||
-s "//channel/item[last()]" -t elem -n "pubDate" -v "$CURRENT_DATE" \ | ||
-s "//channel/item[last()]" -t elem -n "content:encoded" -v "$MESSAGE" \ | ||
-i "//channel/item[last()]/content:encoded" -t attr -n "type" -v "html" \ | ||
"$RSS_FILE" | ||
|
||
echo "New entry added to $RSS_FILE" | ||
aws s3 cp "$RSS_FILE" s3://tileserver-static/ | ||
aws s3 cp "$RSS_FILE" s3://tileserver-static/ |