-
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.
Raspberry script & minor fixes (#37)
* Github Actions badge * python script to update raspberry * fix lock not released on unknown error
- Loading branch information
1 parent
81704d3
commit 87f193d
Showing
5 changed files
with
48 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# JackBot | ||
|
||
[![CircleCI](https://img.shields.io/circleci/build/github/dcr-guys/JackBot)](https://circleci.com/gh/dcr-guys/JackBot) | ||
[![Actions Status](https://github.com/dcr-guys/JackBot/workflows/Python%20application%20tests/badge.svg)](https://github.com/dcr-guys/JackBot/actions) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e0eb1aab12184d0b98bee7f1729ecffa)](https://www.codacy.com/manual/rodrigondec/JackBot?utm_source=github.com&utm_medium=referral&utm_content=rodrigondec/JackBot&utm_campaign=Badge_Grade) | ||
|
||
JackBot is a Ticket Splitting Sessions watcher/notifier teleram bot | ||
JackBot is a Ticket Splitting Sessions watcher/notifier telegram bot |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import requests | ||
import json | ||
import tarfile | ||
import subprocess | ||
|
||
releases_url = "https://api.github.com/repos/dcr-guys/JackBot/releases" | ||
releases_response = requests.get(releases_url) | ||
releases_response.data = json.loads(releases_response.content) | ||
|
||
latest = releases_response.data[0] | ||
latest_tarball = requests.get(latest.get('tarball_url')) | ||
latest_name = latest.get('name') | ||
|
||
base_dir = f"./{latest_name}/" | ||
tarfile_name = f"{base_dir}{latest_name}.tar.gz" | ||
|
||
subprocess.run(["mkdir", base_dir]) | ||
|
||
with open(tarfile_name, 'wb') as file: | ||
file.write(latest_tarball.content) | ||
|
||
with tarfile.open(tarfile_name) as tar: | ||
subfolder_name = tar.firstmember.name | ||
tar.extractall(base_dir) | ||
|
||
source_dir = f"{base_dir}/{subfolder_name}/" | ||
dest_dir = "./" | ||
subprocess.run(['rsync', '-av', source_dir, dest_dir]) | ||
|
||
subprocess.run(['rm', '-rf', base_dir]) | ||
|
||
subprocess.run(['make', 'docker.arm.down']) | ||
subprocess.run(['make', 'docker.arm.build']) | ||
subprocess.run(['make', 'docker.arm.up']) |