mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-11 00:17:22 +01:00
Merge pull request #11 from iwalton3/master
Fixes: Make binary executable, fix isTool method signature, handle corrupted binary, and README tweaks.
This commit is contained in:
@@ -38,15 +38,15 @@ apiUrl=https://api.github.com/repos/go-gitea/gitea/releases/latest
|
|||||||
system=linux-amd64
|
system=linux-amd64
|
||||||
file=/usr/local/bin/gitea
|
file=/usr/local/bin/gitea
|
||||||
tmpDir=/tmp/
|
tmpDir=/tmp/
|
||||||
buildFromSource=None
|
buildFromSource=
|
||||||
sourceDir=/home/git/go/src/code.gitea.io/gitea
|
sourceDir=
|
||||||
logFile=update.log
|
logFile=update.log
|
||||||
````
|
````
|
||||||
|
|
||||||
Use the following command to install gitea-auto-update.
|
Use the following command to install gitea-auto-update.
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo pip install gitea-auto-update
|
sudo pip3 install gitea-auto-update
|
||||||
```
|
```
|
||||||
|
|
||||||
Enter the command `gite-auto-update --settings=/path/to/settings.ini` in your commandline.
|
Enter the command `gite-auto-update --settings=/path/to/settings.ini` in your commandline.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Download:
|
|||||||
self.downloadGiteaFiles()
|
self.downloadGiteaFiles()
|
||||||
self.checkAndExtract()
|
self.checkAndExtract()
|
||||||
|
|
||||||
def isTool(name):
|
def isTool(self, name):
|
||||||
# Function to check if tool is available
|
# Function to check if tool is available
|
||||||
##Check whether `name` is on PATH and marked as executable.
|
##Check whether `name` is on PATH and marked as executable.
|
||||||
return which(name) is not None
|
return which(name) is not None
|
||||||
@@ -67,6 +67,8 @@ class Download:
|
|||||||
# moving temp file to gtfile location
|
# moving temp file to gtfile location
|
||||||
cmd = 'mv ' + self.tmpDir + 'gitea-' + self.githubVersion + '-' + self.gtSystem + ' ' + self.gtFile
|
cmd = 'mv ' + self.tmpDir + 'gitea-' + self.githubVersion + '-' + self.gtSystem + ' ' + self.gtFile
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
cmd = 'chmod +x ' + self.gtFile
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
def checkAndExtract(self):
|
def checkAndExtract(self):
|
||||||
os.chdir(self.tmpDir)
|
os.chdir(self.tmpDir)
|
||||||
|
|||||||
@@ -35,9 +35,13 @@ class Version:
|
|||||||
currentVersion = self.getVersionFromFile()
|
currentVersion = self.getVersionFromFile()
|
||||||
except:
|
except:
|
||||||
# Get the version via the web api if the file does fail
|
# Get the version via the web api if the file does fail
|
||||||
|
try:
|
||||||
currentVersion = requests.get(self.gtSite).json()['version']
|
currentVersion = requests.get(self.gtSite).json()['version']
|
||||||
if currentVersion.status_code != 200:
|
if currentVersion.status_code != 200:
|
||||||
currentVersion = self.getVersionFromFile()
|
raise RuntimeError("Could not download version.")
|
||||||
|
except:
|
||||||
|
# To allow installation, return a default version of "0.0.0".
|
||||||
|
currentVersion = "0.0.0"
|
||||||
finally:
|
finally:
|
||||||
logging.info('Version: current_version = %s', currentVersion)
|
logging.info('Version: current_version = %s', currentVersion)
|
||||||
return currentVersion
|
return currentVersion
|
||||||
|
|||||||
Reference in New Issue
Block a user