53 lines
1.3 KiB
Markdown
53 lines
1.3 KiB
Markdown
# Tools
|
|
|
|
## has_update
|
|
This tool is used to check - with a set registred project - for:
|
|
- available online latest version
|
|
- current installed version
|
|
|
|
This tool, written in python and under GPLv3 Licence assumes project is
|
|
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
|
|
chmod +x /srv/toot/tools/has_update
|
|
```
|
|
|
|
### 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.
|
|
|
|
```
|
|
cd /home/mastodon/live
|
|
/srv/toot/tools/has_update
|
|
```
|
|
|
|
### 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
|
|
```
|