first commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from setuphelpers import *
|
||||
|
||||
# Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()
|
||||
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
|
||||
|
||||
nextcloud_path=makepath('/opt','nextcloud')
|
||||
|
||||
def install():
|
||||
print("Installing: %s" % control.package)
|
||||
|
||||
if not isdir(nextcloud_path):
|
||||
mkdirs(nextcloud_path)
|
||||
|
||||
filecopyto('Nextcloud-%s-x86_64.AppImage'%control.version.split('-')[0],makepath(nextcloud_path,'Nextcloud.AppImage'))
|
||||
run("chmod +x %s/Nextcloud.AppImage" % nextcloud_path)
|
||||
|
||||
filecopyto('nextcloud.desktop',makepath('/usr','share','applications'))
|
||||
|
||||
def uninstall():
|
||||
remove_tree(nextcloud_path)
|
||||
remove_file(makepath('/usr','share','applications','nextcloud.desktop')
|
||||
|
||||
|
||||
def update_package():
|
||||
|
||||
proxies = {}
|
||||
if isfile(makepath(application_data(),'waptconsole','waptconsole.ini')):
|
||||
proxywapt = inifile_readstring(makepath(user_local_appdata(),'waptconsole','waptconsole.ini'),'global','http_proxy')
|
||||
if proxywapt :
|
||||
proxies = {'http':proxywapt,'https':proxywapt}
|
||||
|
||||
|
||||
for line in wgets('https://download.nextcloud.com/desktop/releases/Linux/?C=M;O=D',proxies=proxies).splitlines() :
|
||||
if 'AppImage' in line:
|
||||
version = line[line.find('Nextcloud-'):line.find('-x86_64.AppImage')].replace('Nextcloud-','')
|
||||
break
|
||||
|
||||
exes = glob.glob('*.AppImage')
|
||||
for fn in exes:
|
||||
if fn != 'Nextcloud-' + version + '-x86_64.AppImage':
|
||||
remove_file(fn)
|
||||
|
||||
if not isfile('Nextcloud-' + version + '-x86_64.AppImage'):
|
||||
wget('https://download.nextcloud.com/desktop/releases/Linux/' + 'Nextcloud-' + version + '-x86_64.AppImage','Nextcloud-' + version + '-x86_64.AppImage',proxies=proxies)
|
||||
else:
|
||||
print('Already up to date, skipped')
|
||||
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
||||
from waptpackage import PackageEntry
|
||||
pe = PackageEntry()
|
||||
pe.load_control_from_wapt(os.getcwd())
|
||||
|
||||
pe.version = version + '-0'
|
||||
pe.save_control_to_wapt(os.getcwd())
|
||||
|
||||
if __name__ == '__main__':
|
||||
update_package()
|
||||
Reference in New Issue
Block a user