Skip to content

Commit

Permalink
Add I ♥ Quotes and QDB. Add links of issue files.
Browse files Browse the repository at this point in the history
  • Loading branch information
livibetter committed Apr 9, 2012
1 parent b42fecc commit f94765d
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions rootfs/bin/gen-issue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,46 @@
#
# * /etc/issue.logo
# <http://www.gentoo-wiki.info/TIP_Login_issue>
# <https://github.com/livibetter/dotfiles/blob/master/rootfs/etc/issue.logo>
# * /etc/issue.orig
# The original issue file
# <https://github.com/livibetter/dotfiles/blob/master/rootfs/etc/issue.orig>
#
# Text
# ----
#
# * That's What She Said
# <http://www.twssstories.com/>
# * I ♥ Quotes
# <http://iheartquotes.com/>
# * QDB
# <http://www.qdb.us/>

gen_text()
{
case "$((RANDOM % 3))" in
0) # That's What She Said
xmllint --xpath '//item[1]/description/text()' <(wget -q -O - http://www.twssstories.com/rss.xml) |
sed 's/&lt;\/\?p&gt;//g;q' |
fold -s
;;
1) # I ♥ Quotes
wget -q -O - http://www.iheartquotes.com/api/v1/random |
head -n -2 |
sed 's/&quot;/"/g'
;;
2) # QDB
echo -e 'setns a=http://purl.org/rss/1.0/\ncat //a:item[1]/a:description/text()' |
xmllint --shell <(wget -q -O - 'http://qdb.us/qdb.xml?action=random&fixed=0') |
sed '1,3d;$d;s/&amp;/\&/g;s/&lt;/</g;s/&gt;/>/g;s/&nbsp;/ /g;s/&quot;/"/g;s/<br \/>//g' |
fold -s
;;
esac
}

cat /etc/issue.logo \
<(echo -e '\e[1;34m') \
<(xmllint --xpath '//item[1]/description/text()' <(wget -q -O - http://www.twssstories.com/rss.xml) |
sed 's/&lt;\/\?p&gt;//g;q' |
fold -s) \
<(gen_text) \
<(echo -e '\e[0m') \
/etc/issue.orig \
> /etc/issue

0 comments on commit f94765d

Please sign in to comment.