mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-10 07:57:23 +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
|
||||
file=/usr/local/bin/gitea
|
||||
tmpDir=/tmp/
|
||||
buildFromSource=None
|
||||
sourceDir=/home/git/go/src/code.gitea.io/gitea
|
||||
buildFromSource=
|
||||
sourceDir=
|
||||
logFile=update.log
|
||||
````
|
||||
|
||||
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.
|
||||
|
||||
@@ -28,7 +28,7 @@ class Download:
|
||||
self.downloadGiteaFiles()
|
||||
self.checkAndExtract()
|
||||
|
||||
def isTool(name):
|
||||
def isTool(self, name):
|
||||
# Function to check if tool is available
|
||||
##Check whether `name` is on PATH and marked as executable.
|
||||
return which(name) is not None
|
||||
@@ -67,6 +67,8 @@ class Download:
|
||||
# moving temp file to gtfile location
|
||||
cmd = 'mv ' + self.tmpDir + 'gitea-' + self.githubVersion + '-' + self.gtSystem + ' ' + self.gtFile
|
||||
os.system(cmd)
|
||||
cmd = 'chmod +x ' + self.gtFile
|
||||
os.system(cmd)
|
||||
|
||||
def checkAndExtract(self):
|
||||
os.chdir(self.tmpDir)
|
||||
|
||||
@@ -35,9 +35,13 @@ class Version:
|
||||
currentVersion = self.getVersionFromFile()
|
||||
except:
|
||||
# Get the version via the web api if the file does fail
|
||||
currentVersion = requests.get(self.gtSite).json()['version']
|
||||
if currentVersion.status_code != 200:
|
||||
currentVersion = self.getVersionFromFile()
|
||||
try:
|
||||
currentVersion = requests.get(self.gtSite).json()['version']
|
||||
if currentVersion.status_code != 200:
|
||||
raise RuntimeError("Could not download version.")
|
||||
except:
|
||||
# To allow installation, return a default version of "0.0.0".
|
||||
currentVersion = "0.0.0"
|
||||
finally:
|
||||
logging.info('Version: current_version = %s', currentVersion)
|
||||
return currentVersion
|
||||
|
||||
Reference in New Issue
Block a user