2021-04-10 19:54:45 +00:00
|
|
|
#!/bin/sh
|
2025-01-27 02:21:40 +00:00
|
|
|
user=$(whoami)
|
|
|
|
cd ~
|
2021-04-10 19:54:45 +00:00
|
|
|
echo -n "Specify the blog location(~/public_html/blog/): "
|
|
|
|
read location
|
2025-01-27 02:21:40 +00:00
|
|
|
if [ -z $location ]
|
|
|
|
then
|
|
|
|
location="/home/$user/public_html/blog/rss.xml"
|
|
|
|
else
|
|
|
|
location="$location/rss.xml"
|
|
|
|
fi
|
|
|
|
|
2020-08-14 20:54:29 +00:00
|
|
|
{
|
2020-12-17 07:57:15 +00:00
|
|
|
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
|
2020-08-14 20:54:29 +00:00
|
|
|
echo "<rss version=\"2.0\">"
|
|
|
|
echo "<channel>"
|
|
|
|
echo "<title>~$user on TTBP</title>"
|
|
|
|
echo "<link>http://tilde.town/~$user/blog/</link>"
|
|
|
|
echo "<updated>$(date)</updated>"
|
|
|
|
echo "<description>$user's blog on tilde.town</description>"
|
2020-12-17 07:57:15 +00:00
|
|
|
} > $location
|
2025-01-27 02:21:40 +00:00
|
|
|
|
|
|
|
for x in $(ls /home/$user/.ttbp/entries)
|
|
|
|
do
|
2020-08-14 20:54:29 +00:00
|
|
|
{
|
|
|
|
echo "<item>"
|
|
|
|
echo "<title>$(echo $x | sed -E s/\.txt//g)</title>"
|
|
|
|
echo "<pubDate>$(echo $x | awk '{printf substr($0,1,4) "-" substr($0,5,2) "-" substr($0,7,2)}')</pubDate>"
|
|
|
|
echo "<link>http://tilde.town/~$user/blog/$(echo $x | sed -E s/\.txt/\.html/)</link>"
|
|
|
|
echo "<description><![CDATA[$(cat /home/$user/.ttbp/entries/$x)]]></description>"
|
|
|
|
echo "<author>$user@tilde.town</author>"
|
|
|
|
echo "</item>"
|
|
|
|
} >> $location
|
2025-01-27 02:21:40 +00:00
|
|
|
done
|
|
|
|
|
2020-08-14 20:54:29 +00:00
|
|
|
{
|
|
|
|
echo "</channel>"
|
|
|
|
echo "</rss>"
|
|
|
|
} >> $location
|
2025-01-27 02:21:40 +00:00
|
|
|
|
|
|
|
echo "Finished generating rss feed... you can now go to $(echo $location | sed -E "s/^.*public_html/http:\/\/tilde\.town\/~$user/")"
|