2024-09-18 11:04:27 +02:00
|
|
|
# Tools
|
|
|
|
|
|
|
|
## has_update
|
|
|
|
This tool is used to check - with a set registred project - for:
|
|
|
|
- available online latest version
|
|
|
|
- current installed version
|
|
|
|
|
2024-09-18 11:09:46 +02:00
|
|
|
This tool, written in python and under GPLv3 Licence assumes project is
|
2024-09-18 11:04:27 +02:00
|
|
|
installed using git in an admin project name owner on the system.
|
|
|
|
|
|
|
|
It is configured here for "mastodon" project, but you can copy and use it,
|
|
|
|
by changing the settings inside the script
|
|
|
|
|
|
|
|
```
|
|
|
|
owner = "mastodon" # Also used for sudo -u {owner}
|
|
|
|
name = "mastodon"
|
|
|
|
repo = f"https://api.github.com/repos/{owner}/{name}/releases/latest"
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
### Installation
|
|
|
|
```
|
|
|
|
cd /srv
|
|
|
|
git clone https://forge.a-lec.org/cominfra/toot.git
|
2024-09-18 11:44:00 +02:00
|
|
|
chmod +x /srv/toot/tools/has_update
|
2024-09-18 11:04:27 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```
|
|
|
|
Usage: has_update [argument]
|
|
|
|
-h : This help !
|
|
|
|
-v : Show both versions (online, and installed)
|
|
|
|
```
|
|
|
|
|
|
|
|
This tool is intended to inform administrator about available update of a
|
|
|
|
project. You can use it with an external script in a crontab that checks the
|
|
|
|
ouput of *has_update*. Do not forget, in that case, to not give argument. With
|
|
|
|
no argument, *has_update* ouputs a message ONLY if an update is available.
|
|
|
|
|
2024-09-18 11:23:41 +02:00
|
|
|
```
|
|
|
|
cd /home/mastodon/live
|
|
|
|
/srv/toot/tools/has_update
|
|
|
|
```
|
2024-09-18 11:44:00 +02:00
|
|
|
|
|
|
|
### Update has_update from git
|
|
|
|
At that time, you can perform an update using these commands:
|
|
|
|
```
|
|
|
|
cd /srv/toot/
|
|
|
|
git reset --hard # has_update was chmod
|
|
|
|
git pull
|
|
|
|
chmod +x /srv/toot/tools/has_update
|
|
|
|
```
|