This commit is contained in:
Disassembler 2018-10-26 22:11:34 +02:00
parent 977b9af923
commit 848e99b4af
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
3 changed files with 27 additions and 23 deletions

View File

@ -295,14 +295,14 @@ class WSGIApp(object):
except:
return self.render_json({'error': request.session.lang.package_manager_error()})
app_title = self.pkgmgr.online_packages[app]['title']
response = self.render_json({'ok': self.render_setup_apps_row(app, app_title, '{:.1f}'.print(total_size / 1048576))})
response = self.render_json({'ok': self.render_setup_apps_row(app, app_title, '{:.1f}'.format(total_size / 1048576))})
response.call_on_close(lambda: self.pkgmgr.install_package(app))
return response
def get_install_progress_action(self, request):
# Gets pending installation status
if self.pkgmgr.pending:
return self.render_json({'progress': '{:.1f}'.print(self.pkgmgr.pending / 1048576)})
return self.render_json({'progress': '{:.1f}'.format(self.pkgmgr.pending / 1048576)})
app = request.form['app']
app_title = self.conf['apps'][app]['title']
return self.render_json({'ok': self.render_setup_apps_row(app, app_title)})

View File

@ -34,25 +34,6 @@
<div class="setup-box">
<h2>Správce aplikací</h2>
<p>Vyberte které aplikace mají být nainstalovány, které se mají zobrazovat na hlavní straně portálu a které mají být automaticky spuštěny při startu virtuálního stroje.</p>
<p><strong>Přístupové údaje k distribučnímu serveru:</strong></p>
<form id="update-repo" action="/update-repo" method="post">
<table>
<tr>
<td>Uživatelské jméno:</td>
<td><input type="text" name="repousername" id="repousername" value="{{ conf['repo']['user'] }}"></td>
</tr>
<tr>
<td>Heslo:</td>
<td><input type="password" name="repopassword" id="repopassword"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<input type="submit" id="repo-submit" value="Nastavit">
</td>
</tr>
</table>
</form>
<table id="app-manager">
<thead>
<tr>
@ -73,6 +54,29 @@
{% if not online_packages %}
<p class="error">Připojení k distribučnímu serveru se nezdařilo. Zkontrolujte přístupové údaje a připojení k síti.</p>
{% endif %}
<p><strong>Přístupové údaje k distribučnímu serveru:</strong></p>
<form id="update-repo" action="/update-repo" method="post">
<table>
<tr>
<td>URL serveru:</td>
<td><input type="text" name="repourl" value="{{ conf['repo']['url'] }}"></td>
</tr>
<tr>
<td>Uživatelské jméno:</td>
<td><input type="text" name="repousername" value="{{ conf['repo']['user'] }}"></td>
</tr>
<tr>
<td>Heslo:</td>
<td><input type="password" name="repopassword"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<input type="submit" id="repo-submit" value="Nastavit">
</td>
</tr>
</table>
</form>
</div>
<div class="setup-box">

View File

@ -46,9 +46,9 @@ def pack(pkg_file):
cwd = os.path.dirname(os.path.abspath(pkg_file))
subprocess.run(['tar', '--transform', 's|^|srv/{}/|'.format(pkg_name), '-rpf', tar_path, 'install', 'install.sh', 'upgrade', 'upgrade.sh', 'uninstall', 'uninstall.sh'], cwd=cwd)
# Compress the tarball with xz (LZMA2)
print('Compressing', tar_path, '({0:.2f} MB)'.format(os.path.getsize(tar_path)/1048576))
print('Compressing', tar_path, '({:.2f} MB)'.format(os.path.getsize(tar_path)/1048576))
subprocess.run(['xz', '-9', tar_path])
print('Compressed ', xz_path, '({0:.2f} MB)'.format(os.path.getsize(xz_path)/1048576))
print('Compressed ', xz_path, '({:.2f} MB)'.format(os.path.getsize(xz_path)/1048576))
# Register package
print('Registering package')