This repository was archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux_releases.sh
More file actions
39 lines (31 loc) · 1.39 KB
/
linux_releases.sh
File metadata and controls
39 lines (31 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/bash
curl -s https://www.kernel.org/ > releases
pandoc +RTS -K1073741824 -RTS releases -f html -t markdown_github+pipe_tables -o releases.md
mkdir versions
touch new_releases
for i in mainline stable; do
cat releases.md | grep $i: | awk '{ print $4 }' | sed s/'**'//g > versions/$i
done
cat releases.md | grep longterm: | awk '{ print $4 }' | sed s/'**'//g >> versions/longterm
for i in $(cat versions/longterm); do
echo $i > versions/longterm-$(echo $i | cut -d . -f1-2)
done
for i in $(cat versions/mainline versions/stable versions/longterm-*); do
grep -x $i releases_list || echo $i >> new_releases
done
cat versions/stable > releases_list
cat versions/mainline >> releases_list
cat versions/longterm >> releases_list
rm -rf versions
if [ -n "$(git status --porcelain)" ]; then export NEW_RELEASE=true && git add . && git commit -m "sync $(date +%d/%m/%y) $(date -u +%r) GMT" -m "New releases:" -m "$(cat new_releases)" && git push; else exit 0; fi
if [ "NEW_RELEASE" ]; then
if [ -s new_releases ]; then
### Send message to telegram ###
wget https://raw.githubusercontent.com/fabianonline/telegram.sh/master/telegram
sudo mv telegram /usr/bin
sudo chmod +x /usr/bin/telegram
UPDATE_MESSAGE=$(echo "*New Release Found!*")
echo $TG_TOKEN > ~/.telegram.sh
telegram -M "$UPDATE_MESSAGE"$'\n'"[$(cat new_releases)](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/)"
fi
fi