Compare commits

...

53 Commits

Author SHA1 Message Date
Jonathan Carter
ed2ddb0a77 list debian deps 2025-12-10 21:18:21 +02:00
Jonathan Carter
31bb032a4e Set text_select to false for new pywbview' 2025-10-25 21:52:17 +02:00
Jonathan Carter
22dcf36b14 cleanup mainapplet a bit 2025-08-31 18:31:51 +02:00
Jonathan Carter
088bf495f5 Bunch of ui stuff 2025-08-31 14:53:40 +02:00
Jonathan Carter
c0aa82241b Fix static scrolling 2025-08-28 12:26:13 +02:00
Jonathan Carter
9544463bd6 Minor changes 2025-08-26 16:07:34 +02:00
Jonathan Carter
60cd5140d2 Add systemd unit 2025-08-26 15:58:42 +02:00
Jonathan Carter
dcbc8dd062 Try to make header moving work 2025-08-26 15:58:32 +02:00
Jonathan Carter
08f232bf51 Rename to yasi, add icon 2025-08-26 15:22:26 +02:00
Jonathan Carter
75d068fef6 Exclude cd and loop devs 2025-08-25 20:58:26 +02:00
Jonathan Carter
373ce1247e More cleanup 2025-08-23 23:59:50 +02:00
Jonathan Carter
eaa983e955 Fix extension 2025-08-23 22:59:18 +02:00
Jonathan Carter
652bbba9c0 re-add yasi-applets 2025-08-23 22:33:58 +02:00
Jonathan Carter
69d6ba277d Move a whole bunch of stuff around 2025-08-23 22:33:41 +02:00
Jonathan Carter
8791c58cbf Various ui work 2025-08-23 16:03:38 +02:00
Jonathan Carter
258a359ce1 commit some failed experiments 2025-08-19 20:28:02 +02:00
Jonathan Carter
21b210a689 Some more UI work 2025-08-18 23:08:51 +02:00
Jonathan Carter
430b144d92 Add installer slide placeholder 2025-08-16 14:23:29 +02:00
Jonathan Carter
d4cfa4815c Add button menu placeholders 2025-08-16 14:22:34 +02:00
Jonathan Carter
9f8f89fde2 More UI work 2025-08-16 14:22:13 +02:00
Jonathan Carter
3dade195a5 Fix route 2025-07-20 11:47:29 +02:00
Jonathan Carter
b61c45b5f4 Push a bunch of uncommitted UI changes 2025-07-17 09:53:02 +02:00
Jonathan Carter
007a959274 some more ui work 2025-07-03 22:11:08 +02:00
Jonathan Carter
d0ab6f9803 Some initial menu and translation work 2025-06-20 19:30:10 +02:00
Jonathan Carter
bc0d6b1803 Remove trailing whitespace 2025-06-19 19:50:09 +02:00
Jonathan Carter
4b6b6282e1 hide some diagnostic and example data from disks 2025-04-06 20:49:28 +02:00
Jonathan Carter
1b990becc3 Show actual disks and partition sizes 2025-04-06 20:01:33 +02:00
Jonathan Carter
2c6c0675a2 Some more partitioning html 2025-04-04 22:21:11 +02:00
Jonathan Carter
d7b0491fdf Work a little more on disks html 2025-04-04 21:43:14 +02:00
Jonathan Carter
1dc9a1c734 Fix applet size 2025-04-04 21:07:41 +02:00
Jonathan Carter
4c234d76fb Fix body size 2025-04-04 20:48:59 +02:00
Jonathan Carter
12c1963d67 Catch up with uncommitted changes 2025-04-03 21:23:49 +02:00
Jonathan Carter
68667f2d86 Flesh out README 2024-12-18 20:56:12 +02:00
Jonathan Carter
d076c3c3e7 update hex 2024-12-18 20:48:18 +02:00
Jonathan Carter
29120ab016 Add hex sticker hehe 2024-12-18 20:47:23 +02:00
Jonathan Carter
f9057f2e1e Wishful thinking? :) 2024-12-18 20:43:42 +02:00
Jonathan Carter
38b6dc6a88 Add license 2024-12-18 20:28:19 +02:00
Jonathan Carter
63f71adf34 Flesh out readme a bit more 2024-12-18 20:20:53 +02:00
Jonathan Carter
46fd5c1505 Add a screenshot 2024-12-18 20:18:51 +02:00
Jonathan Carter
9b4239ca1c Move docs 2024-12-18 20:16:33 +02:00
Jonathan Carter
e788ab5d43 Add some screenshots 2024-12-18 20:16:00 +02:00
Jonathan Carter
42d35d6052 Add welcome img 2024-12-18 18:19:28 +02:00
Jonathan Carter
716f7e8773 Add footer file and installer template 2024-12-18 18:18:58 +02:00
Jonathan Carter
132efcec34 some initial themes toying 2024-12-18 18:18:22 +02:00
Jonathan Carter
66a24ea889 Initial favicon 2024-12-18 18:17:58 +02:00
Jonathan Carter
cb914ee60a Add extra welcome module files 2024-12-18 18:17:39 +02:00
Jonathan Carter
2ff0bb04bd Some more initial UI work, initial translation support 2024-12-18 18:17:24 +02:00
Jonathan Carter
4bc89c5d2b Some more initial changes 2024-12-08 16:55:03 +02:00
Jonathan Carter
a61cc67a34 rename s-i-d, add siwc 2024-12-05 15:53:01 +02:00
Jonathan Carter
6a5905374d Update ui a bit more 2024-12-05 12:01:16 +02:00
Jonathan Carter
6a2dfbbde5 UI tests 2024-09-23 16:13:34 +02:00
Jonathan Carter
71011fcafd Move files to actual applets 2024-09-12 18:01:52 +02:00
Jonathan Carter
8661952137 Work on initial partition edit UI 2024-09-09 20:42:20 +02:00
88 changed files with 2551 additions and 603 deletions

340
LICENCE Normal file
View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -1,6 +1,52 @@
Dependencies
![Blippie System Installer Hexagon](https://git.jonathancarter.org/system-installer/system-installer-daemon/raw/branch/main/docs/hex-sticker.png)
# Welcome
Welcome to System Installer, a powerful toolkit for setting up an installer for operating systems.
![Installer screenshot](https://git.jonathancarter.org/system-installer/system-installer-daemon/raw/branch/main/docs/screenshots/welcome.png)
Dependencies:
- flask
- pytest
- coverage
- libjs-htmx
- libjs-material-design-lite
- gettext
Recommended:
- libjs-htmx (needed if the web front-end is to be used)
- sass-stylesheets-bulma (needed if the web front-end is to be used)
- libxapp-gtk3-module
On Debian-based systems, you should get everything with the following:
```
apt install python3-flask python3-command-runner python3-pytest python3-dmm gettext libjs-htmx sass-stylesheets-bulma fonts-fork-awesome
```
## Development
**Please Note:** This project is in early development, and if you have stumbled across this page, please note that it is nowhere near ready for production use yet. Hopefully that changes over the next few months!
### Translations
This project uses gettext for translations. More instruction to follow...
### Modules
Back-end modules:
* TODO: Explain DMM modules
Front-end modules:
* TODO: Explain Flask blueprint files
API:
A stable API doesn't exist yet, but it's planned!
## License
This software is released under the GPL-2 license or later. See the LICENSE
file for additional details.

BIN
docs/hex-sticker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
docs/screenshots/users.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -1,6 +0,0 @@
from flask import Blueprint
bp = Blueprint('main', __name__)
from applets.main import routes

View File

@@ -1,21 +0,0 @@
from applets.main import bp
@bp.route('/')
def index():
"""
The page you'd get if you access the root of
this app in a browser.
"""
return ("Welcome to System Installer Daemon POC <br />"
"Version: Unavailable")
@bp.route('/api/v0')
def apihome():
"""
Not sure what this function should do, but have
a feeling that it should exist.
"""
return ("0")

View File

@@ -1,6 +0,0 @@
from flask import Blueprint
bp = Blueprint('webui', __name__)
from applets.webui import routes

View File

@@ -1,86 +0,0 @@
from applets.webui import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
@bp.route('/webui')
def webui_index():
"""
The page you'd get if you access the root of
this app in a browser.
"""
return ("""
<head>
<script src="/static/htmx.min.js.gz crossorigin="anonymous"></script>
</head>
<button hx-post="/clicked"
hx-trigger="click"
hx-target="#parent-div"
hx-swap="outerHTML" >
Click Me!
</button>
<div style="background-color: black; color: white; height: 200px; width: 200px;" hx-get="/welcome" hx-trigger="every 2s"></div>
<div hx-post="/welcome" hx-trigger="mouseenter">
1
<br><br><br><br>
[Here Mouse, Mouse!]
<br><Br><br><br>
2
</div>
Welcome to System Installer Daemon POC <br />
This is the WebUI Index
""")
@bp.route('/webui/welcome')
def webui_welcome():
"""
Welcome screen for the webui.
It's job right now is to:
- Obtain the language
- Check basic system eligibility
"""
return render_template('welcome.html')
@bp.route('/webui/users')
def webui_users():
"""
Users screen for the webui.
It's job right now is to:
- Set up an initial user
More functions will follow at a later stage
"""
return render_template('users.html')
@bp.route('/webui/disks')
def webui_disks():
"""
Disks screen for the webui.
"""
return render_template('disks.html')
@bp.route('/webui/software')
def webui_software():
"""
Software screen for the webui.
"""
return render_template('software.html')
@bp.route('/webui/summary')
def webui_summary():
"""
Summary screen for the webui.
"""
return render_template('summary.html')

View File

@@ -1,6 +0,0 @@
from flask import Blueprint
bp = Blueprint('welcome', __name__)
from applets.welcome import routes

View File

@@ -1,31 +0,0 @@
from applets.welcome import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
import dmm.lsblk as lsblk
@bp.route('/welcome',methods=['GET', 'POST', 'PUT'])
def welcome_index():
"""
The page you'd get if you access the root of
this app in a browser.
"""
blkid = lsblk.list_scsi_devices()
return render_template('welcome.html', blkid=blkid)
#return ("Welcome to System Installer Daemon POC <br />"
# "This is the Welcome Index")
@bp.route('/welcome2')
def welcome2_index():
return ("Changins some text in our htmx front-end")
@bp.route('/api/')
def api_home():
"""
Wel
"""
return ("Welcome to the welcome API")

View File

@@ -1 +0,0 @@
test:

View File

@@ -1 +0,0 @@
/usr/share/javascript/htmx/htmx.min.js.gz

View File

@@ -1,20 +0,0 @@
@mixin glassmorphism() {
background: rgba(255,255,255,0.05);
backdrop-filter: blur(10px);
}
.bg {
position: absolute;
z-index:-1;
top:0;
right:0;
bottom:0;
left:0;
background-image: radial-gradient(circle at 30% 86%, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.03) 8%,transparent 8%, transparent 92%),radial-gradient(circle at 55% 100%, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.03) 8%,transparent 8%, transparent 92%),radial-gradient(circle at 40% 75%, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.03) 6%,transparent 6%, transparent 94%),radial-gradient(circle at 7% 99%, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.03) 6%,transparent 6%, transparent 94%),radial-gradient(circle at 69% 76%, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.03) 6%,transparent 6%, transparent 94%),radial-gradient(circle at 2% 35%, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.03) 6%,transparent 6%, transparent 94%),radial-gradient(circle at 14% 48%, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.03) 6%,transparent 6%, transparent 94%),radial-gradient(circle at 28% 87%, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.04) 4%,transparent 4%, transparent 96%),radial-gradient(circle at 65% 14%, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.04) 4%,transparent 4%, transparent 96%),radial-gradient(circle at 51% 36%, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.04) 4%,transparent 4%, transparent 96%),radial-gradient(circle at 6% 93%, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.04) 4%,transparent 4%, transparent 96%),linear-gradient(135deg, rgb(23, 233, 173),rgb(29, 24, 208));
}
body {
display: flex;
}

View File

@@ -1,66 +0,0 @@
#!/usr/bin/env python3
"""
Welcome to SID - The System Installer Daemon!
"""
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
from waitress import serve
import logging
import dmm.lsblk as lsblk
# configuration
VERSION = "0.00"
SECRET_KEY = "exampls"
DEV_MODE = 1
APPS = "main welcome"
if DEV_MODE == 1:
print("Note: Starting in devmode!")
DEBUG = True
# create our application in flask
app = Flask(__name__)
app.config.from_object(__name__)
# Register blueprints here
for APP in APPS.split(" "):
print("Loading applet: %s " % APP)
from applets.main import bp as main_bp
app.register_blueprint(main_bp)
from applets.welcome import bp as welcome_bp
app.register_blueprint(welcome_bp)
from applets.webui import bp as webui_bp
app.register_blueprint(webui_bp)
# configure logs
# logging.basicConfig()
logger = logging.getLogger('waitress')
if DEV_MODE == "1":
logger.setLevel(logging.DEBUG)
logger.debug("logger set to DEBUG")
# Justtry doing something with dmm
lsblk.list_scsi_devices()
if __name__ == '__main__':
if DEV_MODE:
serve(app,
host='0.0.0.0',
port=8080,
url_scheme='http',
expose_tracebacks=True)
else:
serve(app,
host='0.0.0.0',
port=8080,
url_scheme='https',
expose_tracebacks=False)

View File

@@ -1,104 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/bulma.css" rel="stylesheet">
<link href="/static/welcome.css" rel="stylesheet">
</head>
<body>
<div class="bg"></div>
<div style="margin-top: 50px;" class="container">
<div class="notification is-dark">
<h1 class="is-size-3"> Disks and Partitions </h1>
<br>
<div class="tabs">
<ul>
<li><a href="./welcome">Welcome</a></li>
<li><a href="./users">Users</a></li>
<li class="is-active"><a href="./disks">Disks</a></li>
<li><a href="./software">Software</a></li>
<li><a href="./summary">Summary</a></li>
</ul>
</div>
<br>
<p> How would you like to install Debian?</p>
<br>
<div class="radios">
<label class="radio">
<input type="radio" name="rsvp" />
Erase entire disk
</label>
<label class="radio">
<input type="radio" name="rsvp" />
Install alongside another operating system
</label>
<label class="radio">
<input type="radio" name="rsvp" disabled />
Define your own disk and partitioning setup
</label>
</div>
<br>
<p> Proposed layout: </p>
<br>
<div style="background-color: gray; padding: 15px; border-radius: 15px;">
<p> <span style="width: 100%;" class="tag is-black">Physical disk: TOSHIBA HDWD120 (20 GB)</span> </p>
<div class="columns">
<div class="column is-narrow is-primary">
<div class="box" style="width: 220px;">
<p class="subtitle">/dev/sda1</p>
<p class="title is-5"><span class="tag is-black">/boot/efi</span> <span class="tag is-dark">200 MB</span> <span class="tag is-link">vfat</span></p>
</div>
</div>
<div class="column">
<div class="box">
<p class="subtitle">/dev/sda2</p>
<p class="title is-5"><span class="tag is-black">/</span> <span class="tag is-dark">18 GB</span> <span class="tag is-link">btrfs</span></p>
</div>
</div>
</div>
</div>
<div class="modal">
<div class="modal-background"></div>
<div class="modal-content">
<!-- Any other Bulma elements you want -->
<p>Welcome to partition disk editor.</p>
<p>This is quite cool.</p>
<div class="columns">
<div class="column"><button class="button is-light">Back</button></div>
<a href="./software"><div class="column"><button class="button is-link">Next</button></div></a>
</div>
</div>
</div>
<br><br><br>
<div class="columns">
<div class="column"><button class="button is-light">Back</button></div>
<a href="./software"><div class="column"><button class="button is-link">Next</button></div></a>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,53 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/bulma.css" rel="stylesheet">
<link href="/static/welcome.css" rel="stylesheet">
</head>
<body>
<div class="bg"></div>
<div style="margin-top: 50px; color: white;" class="container">
<div class="notification is-dark">
<h1 class="is-size-3"> Select Software </h1>
<br>
<div class="tabs">
<ul>
<li><a href="./welcome">Welcome</a></li>
<li><a href="./users">Users</a></li>
<li><a href="./disks">Disks</a></li>
<li class="is-active"><a href="./software">Software</a></li>
<li><a href="./summary">Summary</a></li>
</ul>
</div>
<br>
<p> Would you like fries with that?</p>
<br>
<ul>
<li>Desktop environment</li>
<li>Server software</li>
</ul>
<br><br>
<div class="columns">
<div class="column"><button class="button is-light">Back</button></div>
<a href="./summary"><div class="column"><button class="button is-link">Next</button></div></a>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,49 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/bulma.css" rel="stylesheet">
<link href="/static/welcome.css" rel="stylesheet">
</head>
<body>
<div class="bg"></div>
<div style="margin-top: 50px; color: white;" class="container">
<div class="notification is-dark">
<h1 class="is-size-3"> Summary </h1>
<br>
<div class="tabs">
<ul>
<li><a href="./welcome">Welcome</a></li>
<li><a href="./users">Users</a></li>
<li><a href="./disks">Disks</a></li>
<li><a href="./software">Software</a></li>
<li class="is-active"><a href="./summary">Summary</a></li>
</ul>
</div>
<br>
<p> Ready to install.</p>
<br>
<br><br>
<div class="columns">
<div class="column"><button class="button is-light">Back</button></div>
<a href="./install"><div class="column"><button class="button is-link">Start Install</button></div></a>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,70 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/bulma.css" rel="stylesheet">
<link href="/static/welcome.css" rel="stylesheet">
</head>
<body>
<div class="bg"></div>
<div style="margin-top: 50px; color: white;" class="container">
<div class="notification is-dark">
<h1 class="is-size-3"> Configure User </h1>
<br>
<div class="tabs">
<ul>
<li><a href="./welcome">Welcome</a></li>
<li class="is-active"><a href="./users">Users</a></li>
<li><a href="./disks">Disks</a></li>
<li><a href="./software">Software</a></li>
<li><a href="./summary">Summary</a></li>
</ul>
</div>
<br>
<p> Let's set up an initial user.</p>
<br>
<div class="field">
<label class="label">Name</label>
<div class="control">
<input class="input" type="text" placeholder="Text input">
</div>
</div>
<div class="field">
<label class="label">Username</label>
<div class="control has-icons-left has-icons-right">
<input class="input is-success" type="text" placeholder="Text input" value="user">
<span class="icon is-small is-left">
<i class="fas fa-user"></i>
</span>
<span class="icon is-small is-right">
<i class="fas fa-check"></i>
</span>
</div>
<p class="help is-success">This username is available</p>
</div>
<br><br>
<div class="columns">
<div class="column"><button class="button is-light">Back</button> <button class="button is-light">Connect Active Directory</button> <button class="button is-light">Connect LDAP</button></div>
<a href="./disks"><div class="column"><button class="button is-link">Next</button></div></a>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,80 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/bulma.css" rel="stylesheet">
<link href="/static/welcome.css" rel="stylesheet">
</head>
<body>
<div class="bg"></div>
<div style="min-height: 80%; left: 22%; right: 22%; top: 50px; bottom: 50px; position: absolute;" class="container">
<div class="notification is-dark">
<h1 class="is-size-3"> Welcome to System Installer </h1>
<br>
<div class="tabs">
<ul>
<li class="is-active"><a href="./welcome">Welcome</a></li>
<li><a href="./users">Users</a></li>
<li><a href="./disks">Disks</a></li>
<li><a href="./software">Software</a></li>
<li><a href="./summary">Summary</a></li>
</ul>
</div>
<br>
<p> Welcome! This setup program will install Debian on to your system.</p>
<br>
<div class="control is-link">
<div class="select">
<select>
<option>English</option>
<option>Afrikaans</option>
</select>
</div>
</div>
<br>
<div class="control is-link">
<div class="select">
<select>
<option>en-us</option>
<option>en-uk</option>
</select>
</div>
</div>
<br>
<div class="control is-link">
<div class="select">
<select>
<option>Africa/Johannesburg</option>
<option>UTC</option>
</select>
</div>
</div>
<br><br><br><br><br><br>
<div class="columns">
<div class="column"><button class="button is-light">Quit</button></div>
<a href="./users"><div class="column"><button class="button is-link">Next</button></div></a>
</div>
</div>
</div>
</body>
</html>

61
src/yasi-daemon Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/env python3
"""
Welcome to YaSID - The The Yasi System Installer Daemon!
"""
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
from waitress import serve
import logging
import dmm.lsblk as lsblk
import importlib
import yaml
import sys
# configuration
CONFIGFILE="/etc/yasi/yasi.yaml"
# import config
global config
config_contents = open(CONFIGFILE, "r")
config = yaml.safe_load(config_contents)
APPS = config['settings']['apps']
DEV_MODE = config['settings']['devmode']
# create our application in flask
app = Flask(__name__)
app.config.from_object(__name__)
app.config['CONFIG'] = config
app.app_context().push()
config['settings']['menu'] = {}
sys.path.append('/usr/share/yasi-daemon')
if DEV_MODE:
print("Note: Starting in devmode!")
DEBUG = True
tracebacks = True
# Register blueprints here
for APP in APPS.split(" "):
print(f"Loading applet: {APP} ")
# Dynamically import the blueprint module
module = importlib.import_module(f"yasi_applets.{APP}")
# Get the blueprint (bp) from the imported module
bp = getattr(module, "bp")
# Register the blueprint with the app
app.register_blueprint(bp)
# configure logs
# logging.basicConfig()
logger = logging.getLogger('waitress')
if DEV_MODE == "1":
logger.setLevel(logging.DEBUG)
logger.debug("logger set to DEBUG")
if __name__ == '__main__':
serve(app,
host='127.0.0.1',
port=9274,
url_scheme='http',
expose_tracebacks=DEV_MODE)

35
src/yasi-webclient Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python3
import webview
LOCATION = "http://localhost:9274/welcome"
def on_closed():
"""
Actions to take when System Installer is closed.
"""
print('pywebview window is closed')
window = webview.create_window('System Installer', LOCATION,
transparent=True, easy_drag=False, frameless=True,
width=1050, focus=True, zoomable=True,
confirm_close=True, resizable=True, shadow=True,
text_select=False, draggable=False
)
webview.settings = {
'ALLOW_DOWNLOADS': False,
'ALLOW_FILE_URLS': False,
'DRAG_REGION_SELECTOR': '.pywebview-drag-region',
'DRAG_REGION_DIRECT_TARGET_ONLY': True,
'OPEN_EXTERNAL_LINKS_IN_BROWSER': True,
'OPEN_DEVTOOLS_IN_DEBUG': True,
'IGNORE_SSL_ERRORS': False,
'REMOTE_DEBUGGING_PORT': None,
'SHOW_DEFAULT_MENUS': True
}
window.events.closed += on_closed
#webview.start(icon='/usr/share/icons/yasi.png')
webview.start()

View File

@@ -0,0 +1,7 @@
from flask import Blueprint
bp = Blueprint('disks', __name__,
template_folder='')
from yasi_applets.disks import routes

View File

@@ -0,0 +1,179 @@
{% extends "layout.html" %}
{% block body %}
<div style="">
<p><b>How would you like to install Debian?</b></p>
<br>
<div class="radios">
<label class="radio">
<input selected type="radio" name="rsvp" />
Preconfigured partitioning &nbsp;
<!-- Let's hide these babies for the initial release.
<label class="radio">
<input type="radio" name="rsvp" disabled />
Erase entire disk
</label>
<label class="radio">
<input type="radio" name="rsvp" disabled />
Install alongside another operating system
</label>
<label class="radio">
<input type="radio" name="rsvp" disabled />
Edit existing partitions
</label>
-->
</div>
<div class="columns" width="100%">
<div class="column"><p> <br>Current layout: </p></div>
</div>
<!--
<div style="">
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px;">
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">Physical disk: TOSHIBA HDWD120 (2000 GB) <br>
<div class="columns">
<div class="column is-narrow is-primary">
<div class="box" style="min-width: 220px; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px;">
<p class="is-tiny">/dev/sda1</p>
<p class="title is-5"><span class="tag is-black">/boot/efi</span>
<span class="tag is-dark">200 MB</span>
<span class="tag is-link">vfat</span>
</p>
</div>
</div>
<a hx-get="/disks/partition/sda" hx-swap="outerHTML"/>
<div class="column">
<div class="box" style="border-radius: 0 0 5px 0px; height: 60px; padding-top: 5px;">
<p class="is-tiny">/dev/sda2</p>
<p class="title is-5"><span class="tag is-black">/</span> <span class="tag is-dark">18 GB</span> <span class="tag is-link">btrfs</span></p>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
-->
<!--
<p> There are {{ blockdevs["blockdevices"]|count }} block devices detected. </p>
<p> They are </p>
<br>
-->
{% for disk in blockdevs["blockdevices"] if disk["name"] != "zram0" and "loop" not in disk["name"] and disk["name"] != "sr0" %}
<!--
<h1> Raw data </h1>
{{ disk }}
<h1> Children </h1>
{% for child in disk['children'] %}
<h2> <big><b> Child </b></big> </h2>
Path: {{ child['path'] }}
fstype: {{ child['fstype'] }}
fssize: {{ child['fssize'] }}
{{ child }}
{% endfor %}
-->
<div style=""> <!-- partition bars -->
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px;">
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
<small><small>{{ disk['name'] }} ({{(disk['size']/1024000000)|round(0)|int }} GB) - Serial: {{ disk['serial'] }}</small></small>
<div class="columns">
{% for child in disk['children'] %}
<a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML"/>
<div class="column is-narrow is-primary">
<div class="box" style="min-width: 220px; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px;">
<p class="is-tiny">{{ child['name'] }} ({{ (child['size']/1024000000)|round(2) }} GiB) </p>
<p class="title is-5"><span class="tag is-black">{{ child['mountpoint'] }}</span>
<span class="tag is-link">{{ child['fstype'] }}</span>
</p>
</div>
</div>
</a>
{% endfor %}
{% if disk['maj:min'] == "252:0" %}
<div class="column is-narrow is-primary">
<div class="box" style="width: 100%; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px; right: 0px;">
<p class="is-tiny"> {{ disk['name'] }} ({{ (disk['size']/1024000000)|round(2) }} GiB) </p>
<p class="title is-5"><span class="tag is-black">/dev/{{ disk['name'] }}</span>
<span class="tag is-link">swap</span>
</p>
</div>
</div>
{% endif %}
</div>
</div>
<!--
<p> Diskname: {{ disk['name'] }} </p>
<p> Model: {{ disk['model'] }} </p>
<p> Serial: {{ disk['serial'] }} </p>
<p> Removable: {{ disk['rm'] }} </p>
<p> Size: {{ disk['size'] | int / 1024000000 | round(2) }} GiB </p>
<p> ID: {{disk['id'] }} </p>
<p> pttype: {{disk['pttype'] }} </p>
<p> Maj:min: {{disk['maj:min']}} </p>
<p> phy-sec: {{ disk['phy-sec'] }}. log-sec: {{ disk['log-sec'] }} </p>
<p> There are {{ disk['children']|count }} Children </p>
-->
<!--
{% for child in disk['children'] %}
<br>
<p> Name: {{ child['name'] }}. Path: {{ child['path'] }}. {{ child['size'] }}. Block: {{ child['subsystems'] }} {{ child['maj:min'] }} {{ child['type'] }} </p>
<p> Fstype: {{ child['fstype'] }}. Label: {{ child['label'] }}. Rota: {{ child['rota'] }}</p>
<p> Parttypename: {{ child['parttypename'] }}
<br>
{% endfor %}
-->
{% endfor %}
<!-- Add Undetected Disk
Add Virtual Filesystem
Add Network Filesystem -->
<div class="columns" width="100%">
<div class="column"><p> <br>Proposed partitioning: </p></div>
</div>
<div style=""> <!-- partition bars -->
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px;">
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
<small><small> New GPT Partition Table</small></small>
<div class="columns">
{% for partition in partitions %}
{% if "mkpart" in partition['command'] %}
<a hx-get="/disks/partition/{{ partition['device'] }}" hx-swap="outerHTML"/ style="{% if "100%" in partition['command'] %}width: 100%; {% endif %}">
<div class="column is-narrow is-primary">
<div class="box" style="min-width: 220px; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px;">
<p class="is-tiny"> {{ partition['device'] }} </p>
<p class="title is-5"><span class="tag is-black"> {{ partition['mountpoint'] }} </span>
<span class="tag is-link"> {{ partition['fstype'] }} </span>
</p>
</div>
</div>
</a>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,88 @@
<div class="modal is-active">
<div class="modal-background"></div>
<div class="modal-content">
<div style="background-color: #424242; padding: 15px; border-radius: 15px; boders: none; color: white;">
<h1 class="is-size-4"> Edit partition: {{ partition }} </h1>
<p class="title is-6"><span class="tag is-black">Primary Partition</span>
<span>
<p>Select usage: <div class="control is-link">
<div class="select">
<select>
<option>Local file system</option>
<option>Remote file system</option>
<option>Logical volume for ZFS zpool</option>
<option>Logical volume for LVM</option>
<option>Logical volume for LUKS encryption</option>
<option>Logical volume for Linux (mdadm) RAID</option>
<option>Logical volume for Microsoft LDM RAID</option>
<option>Swap partition</option>
<option>Do not configure</option>
</select>
</div>
</div>
</span>
<span>
<p>Select Mount Point: <div class="control is-link">
<div class="select">
<select>
<option>/</option>
<option>/usr</option>
<option>/var</option>
<option>Other...</option>
</select>
</div>
</div>
</span>
<span>
<p>Select Filesystem: <div class="control is-link">
<div class="select">
<select>
<option is-active>btrfs</option>
<option>ext4</option>
<option>ext3</option>
<option>ext2</option>
<option>xfs</option>
<option>jfs</option>
<option>ntfs</option>
<option>vfat</option>
<option>nfs</option>
<option>nbd</option>
<option>samba</option>
</select>
</div>
</div>
</span>
</p>
<div class="checkboxes">
<label class="checkbox">
<input type="checkbox" />
noatime
</label>
<label class="checkbox">
<input type="checkbox" />
nodiratime
</label>
<label class="checkbox">
<input type="checkbox" />
discard
</label>
</div>
<br>
<div class="columns">
<a href="/disks">
<div class="column"><button class="button is-light">Cancel</button></div>
</a>
<a href="/disks"><div class="column"><button class="button is-link">Continue</button></div></a>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,69 @@
from yasi_applets.disks import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
import dmm.lsblk as lsblk
from flask import current_app
@bp.route('/disks')
def disks():
"""
Disks screen for the webui.
"""
blockdevs = lsblk.list_block_devices()
print(lsblk.list_block_devices())
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
next_step_url = menu[menu.index("disks")+1]
if menu[menu.index("disks")] == 1:
previous_step_url = False
else:
previous_step_url = menu[menu.index("disks")-1]
add_disks_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-hdd-o" aria-hidden="true"></i> &nbsp; Add Disk or Filesystem </button>'
add_swap_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-object-group" aria-hidden="true"></i> &nbsp; Swap Configuration </button>'
bottom_menu = add_disks_button + add_swap_button
# no bottom menu for this release
bottom_menu = ""
build_summary()
return render_template('disks.html', blockdevs=blockdevs,
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
previous_step = previous_step_url,
next_step=next_step_url,
partitions=current_app.config['CONFIG']['recipe']['create_partitions']['command_set'],
format_partitions=current_app.config['CONFIG']['recipe']['format_partitions'],
bottom_menu=bottom_menu)
@bp.route('/disks/partition/<part>')
def disks_partition(part):
"""
Partition modal for the webui partition screen.
"""
print("Partition is: " + part)
partition = part
return render_template('disks_partition.html',
menu=current_app.config['CONFIG']['settings']['menu'],
partition=partition)
def build_menu():
"""
Define menu items and paths.
"""
# proper one once translations are done:
#current_app.config['CONFIG']['settings']['menu']['welcome'] = (build_stringlist()['menu_item'], "/welcome", 10)
current_app.config['CONFIG']['settings']['menu']['disks'] = ("Disks", "/disks", 30)
def build_summary():
"""
Write up a summary of what this module will do.
"""
current_app.config['CONFIG']['Summary']['disks'] = {}
current_app.config['CONFIG']['Summary']['disks']['heading'] = "Disks and Partitions"
current_app.config['CONFIG']['Summary']['disks']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']
current_app.config['CONFIG']['Summary']['disks']['text'] = "Pre-configured disk layout."
return("ok?")
build_menu()

View File

@@ -0,0 +1,7 @@
from flask import Blueprint
bp = Blueprint('hardware', __name__,
template_folder='')
from yasi_applets.hardware import routes

View File

@@ -0,0 +1,41 @@
{% extends "layout.html" %}
{% block body %}
<p> <b> Would you like fries with that? </b></p>
<br>
<div style="background-color: gray; padding: 4px 6px 7px 6px;
border-radius: 10px; margin-bottom: 20px;">
<span style="width: 100%; border-radius: 8px 8px 0 0;"
class="tag is-black">
Real-time Clock
</span>
<div style="padding-left: 15px; padding-right: 15px; background-color: #fff;
color: #000;">
<p>Date / time. / timezone</p> <br>
<input style="background-color: #777777;" type="checkbox" id="popcon"
name="popcon" hx-post="/software/settings" hx-trigger="change"
{% if popcon %} checked {% endif %}>
<label for="popcon"> Participate in PopCon </label><br>
</div>
</div>
<div style="background-color: gray; padding: 4px 6px 7px 6px;
border-radius: 10px; margin-bottom: 20px;">
<span style="width: 100%; border-radius: 8px 8px 0 0;"
class="tag is-black">
Firmware
</span>
<div style="padding-left: 15px; padding-right: 15px; background-color: #fff;
color: #000;">
<p>Install additional firmware.</p> <br>
<input style="background-color: #777777;" type="checkbox" id="popcon"
name="popcon" hx-post="/software/settings" hx-trigger="change"
{% if popcon %} checked {% endif %}>
<label for="popcon"> Participate in PopCon </label><br>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,65 @@
from yasi_applets.hardware import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
from flask import current_app
@bp.route('/hardware')
def webui_hardware():
"""
Hardware screen for the webui.
"""
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
next_step_url = menu[menu.index("hardware")+1]
if menu[menu.index("hardware")] == 1:
previous_step_url = False
else:
previous_step_url = menu[menu.index("hardware")-1]
sources_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-cloud-download" aria-hidden="true"></i> &nbsp; Configure Network </button>'
blends_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-download" aria-hidden="true"></i> &nbsp; Install a Blend </button>'
bottom_menu = sources_button + blends_button
build_summary()
return render_template('hardware.html',
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
previous_step = previous_step_url,
next_step = next_step_url,
bottom_menu = bottom_menu,
popcon=current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'])
@bp.route('/hardware/settings', methods=['GET', 'POST'])
def hardware_settings():
"""
Receive settings for the hardware applet.
"""
if request.method == 'POST':
popcon = "popcon" in request.form
current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'] = popcon
print(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'])
build_summary()
return ('', 204)
def build_menu():
"""
Define menu items and paths.
"""
# proper one once translations are done:
#current_app.config['CONFIG']['settings']['menu']['welcome'] = (build_stringlist()['menu_item'], "/welcome", 10)
current_app.config['CONFIG']['settings']['menu']['hardware'] = ("Hardware", "/hardware", 40)
def build_summary():
"""
Write up a summary of what this module will do.
"""
current_app.config['CONFIG']['Summary']['hardware'] = {}
current_app.config['CONFIG']['Summary']['hardware']['heading'] = "Hardware"
current_app.config['CONFIG']['Summary']['hardware']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']
current_app.config['CONFIG']['Summary']['hardware']['text'] = "Participate in Popularity Contest: " + str(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']) + "<br/>No desktop environment selected."
return("ok?")
build_menu()

View File

@@ -0,0 +1,9 @@
from flask import Blueprint
bp = Blueprint('install', __name__,
template_folder='',
static_folder='static',
static_url_path='/welcome/static')
from yasi_applets.install import routes

View File

@@ -0,0 +1,52 @@
{% extends "layout.html" %}
{% block body %}
<center>
<p style="position: absolute: left: 45px; top: 10px;">
<big><big>
Installing...
</big></big>
</p>
<br />
<img style="width: 400px; padding: 20px;" src="/install/static/img/slide1.png" /> <br />
<p>
Installing system, the rest of the process is automated.
</p>
<p style="margin: 20px;">
<input style="background-color: #777777;" type="checkbox"
id="reboot" name="reboot" value="reboot" checked>
<label for="reboot"> Reboot automatically when ready </label></p><br>
<div id="output"></div>
<!-- Hidden input to track last line -->
<div id="last-line-container">
<input type="hidden" id="last-line" name="last_line" value="0">
</div>
<!-- Poller -->
<div hx-get="/install/status"
hx-trigger="load, every 1s"
hx-include="#last-line"
hx-swap-oob="true"
hx-target="this"
hx-ext="json-enc"
hx-vars="{}">
</div>
</center>
<div style="position: absolute; padding: 10px; background-color: #26495e; left: 40px;
right: 40px; bottom: 40px; height: text-align: middle;">
<center> Initializing... </center>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,109 @@
from yasi_applets.install import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint, jsonify
from flask import current_app
import subprocess
import threading
status = {
"status": "idle", # idle | running | finished
"output": "",
"exit_code": None,
"lines": []
}
@bp.route('/install',methods=['GET', 'POST', 'PUT'])
def install_index():
"""
The page you'd get if you access the root of
this app in a browser.
"""
install_start()
return render_template('install.html')
@bp.route('/install-start',methods=['GET', 'POST', 'PUT'])
def install_start():
"""
Trigger the installation process
"""
print("The installation process is starting!... in theory at least")
if status["status"] == "running":
return jsonify({"status": "already running"}), 409 # Conflict
threading.Thread(target=run_script).start()
return jsonify({"status": "started"})
print("did it finish?")
def run_script():
global status
status["status"] = "running"
process = subprocess.Popen(
["bash", "/data/jonathan/devel/highvoltage/system-installer/daemon/src/fake-install-shell.sh"],
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
text = True)
lines = []
for line in iter(process.stdout.readline,''):
#lines.append(line.strip())
#status["output"] = "\n".join(lines)
status["lines"].append(line.strip())
process.wait()
status["status"] = 'finished'
status["exit_code"] = process.returncode
print(lines)
print("status:", status["status"], "code:", status["exit_code"])
@bp.route('/install/status', methods=['GET', 'POST'])
def install_status():
"""
Update on the status of the installation process.
"""
# Keep track of the last line posted, so that we can include
# any new lines not provided to the UI yet
last_line = int(request.args.get("last_line", 0))
new_lines = status["lines"][last_line:]
if not new_lines and status["status"] == "finished":
return "" # Empty response = HTMX will stop polling
lines_html = ""
for i, line in enumerate(new_lines, start=last_line + 1):
lines_html += f'<div>{line}</div>'
return {
"output": status['output'],
"status": status['status'],
"lines": lines_html,
"last_line": f'<input type="hidden" id="last-line" name="last_line" value="{last_line + len(new_lines)}">'
}
@bp.route('/install/cancel', methods=["POST"])
def install_cancel():
"""
Cancel the installation process.
"""
if status["status"] != "running" or not status["process"]:
return Response("No running script", status=400)
process["process"].terminate()
process["status"] = "cancelled"
process["exit_code"] = -1
return Response("Cancelled", status=200)
@bp.route('/settings',methods=['GET', 'POST', 'PUT'])
def settings():
"""
Manage settings for the installation module.
"""
print("Settings")

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -0,0 +1,9 @@
from flask import Blueprint
bp = Blueprint('main', __name__,
template_folder='',
static_folder='static',
static_url_path='/main/static')
from yasi_applets.main import routes

View File

@@ -0,0 +1,36 @@
<!-- Buttons on the left -->
<div style="position: absolute; bottom: 15px; left: 15px;">
{% if previous_step %}
<!-- Why two of these? So that we can use two different keyboard shortcuts for back. -->
<button style="display: none;" hx-get="/{{ previous_step }}" hx-target="body"
hx-trigger="click, keydown[altKey&&key=='b'] from:body"></button>
<a href="/{{ previous_step }}"><button hx-get="/{{ previous_step }}" hx-target="body"
hx-trigger="click, keydown[ctrlKey&&code=='PageUp'] from:body" class="button is-light">Back</button></a>
{% endif %}
{% if bottom_menu %}
{{ bottom_menu | safe }}
{% endif %}
</div> <!-- end buttons on the left -->
<!-- Buttons on the right -->
<div style="position: absolute; bottom: 15px; right: 15px;">
{% if next_step %}
{% if next_step == "install" %}
<a href="/{{ next_step }}"><button hx-get="/{{ next_step }}" hx-target="body"
hx-trigger="click, keyup[altKey&&key=='i'] from:body" class="button is-link">Install</button></a>
{% else %}
<!-- Why two of these? So that we can use two different keyboard shortcuts for next. -->
<a href="/{{ next_step }}"<button hx-get="/{{ next_step }}" hx-target="body"
hx-trigger="click, keydown[ctrlKey&&code=='PageDown'] from:body" class=""></button></a>
<a href="/{{ next_step }}"<button hx-get="/{{ next_step }}" hx-target="body"
hx-trigger="click, keydown[altKey&&key=='n'] from:body" class="button is-link">Next</button></a>
{% endif %}
{% endif %}
</div> <!-- end buttons on the right -->

View File

@@ -0,0 +1,28 @@
<!-- Header -->
<div id="titlebar" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
<!-- drag region class: -->
<div id="titlebar" class="pywebview-drag-region" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
<!--
You might be tempted to replace the unicode character by a fa-code as in the
alternate commend below. Don't do it, it causes all kinds of artifacts and
glitches as the page reloads (and makes it feel much more like an old website
than a proper webapp.
-->
<a hx-get="/main/menu" hx-swap="outerHTML"/> <button class="button is-link"></button> </a>
<!--
<a hx-get="/main/menu" hx-swap="outerHTML"/> <button class="button is-link"> <i class="fa fa-bars" aria-hidden="true"></i> </button> </a> -->
{% for item in menu_order %}
<a href="{{ menu[item][1]}}"> <button class="button is-{% if request.path == menu[item][1] %}info{% else %}dark{% endif %}"> {{ menu[item][0]}} </button></a>
{% endfor %}
<div style="position: absolute; top: 15px; right: 15px;">
<a hx-get="/main/help" hx-swap="outerHTML"/> <button class="button is-light"> <i class="fa fa-question" aria-hidden="true"></i> </button></a>
<a hx-get="/main/quit" hx-swap="outerHTML"/><button onclick="closeApp()" class="button is-danger" > 🗙 </button></a>
</div>
</div> <!-- end pywebview-drag-region -->
<!-- End Header -->

View File

@@ -0,0 +1,24 @@
<div class="modal is-active">
<div class="modal-background"></div>
<div class="modal-content">
<div style="background-color: #424242; padding: 15px; border-radius: 15px; boders: none; color: white;">
<h1 class="is-size-4"> Help </h1>
<br>
<p>The help system is not yet implemented.</p>
<br>
<p>Some keyboard tips:<p>
<br>
<ul>
<li>ALT+n or CTRL+PGDn moves to the next page.</li>
<li>ALT+p or CTRL+PGUp moves to the previous page.</li>
</ul>
<br>
<div class="columns">
<a href="/welcome"><div class="column"><button class="button is-link">Continue</button></div></a>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,27 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/main/static/bulma.css" rel="stylesheet">
<link href="/main/static/system-installer.css" rel="stylesheet">
<link rel="shortcut icon" href="/main/static/icons/blippie.png" type="image/x-icon">
<link rel="stylesheet" href="/main/static/fork-awesome.css">
<script src="/main/static/htmx.min.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="frame">
{% include "header.html" %}
<div class="applet">
{% block body %}
{% endblock %}
</div>
{% include "footer.html" %}
</div> <!-- class "frame" -->
</body>
</html>

View File

@@ -0,0 +1,17 @@
<div class="modal is-active">
<div class="modal-background"></div>
<div class="modal-content">
<div style="background-color: #424242; padding: 15px; border-radius: 15px; borders: none; color: white;">
<h1 class="is-size-4"> Main menu </h1>
<br />
<p> There's nothing yet to do here.</p>
<br />
<div class="columns">
<a href="/welcome"><div class="column"><button class="button is-link">Continue</button></div></a>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,19 @@
<div class="modal is-active">
<div class="modal-background"></div>
<div class="modal-content">
<div style="background-color: #424242; padding: 15px; border-radius: 15px; boders: none; color: white;">
<h1 class="is-size-4"> Exit system installer </h1>
<br /><p class="title is-6"><span class="tag is-danger">Quitting is not yet implemented.</span>
<br />
<p> ALT+F4 will bring up a dialog that works though. </p>
<br />
<div class="columns">
<a href="/welcome"><div class="column"><button class="button is-link">Continue</button></div></a>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,62 @@
from yasi_applets.welcome import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
# we use this neat little trick to get config data from the main app
from flask import current_app
import gettext
# Set up Gettext
def set_language(LANG):
"""
Sets language for this applet
"""
# TODO: unhardcode this path
translations = gettext.translation("welcome", '/usr/share/yasi-daemon/yasi_applets/welcome/locales',
fallback=True, languages=[LANG])
translations.install()
_ = translations.gettext
@bp.route('/')
def index():
"""
The page you'd get if you access the root of
this app in a browser.
"""
return ("Welcome to System Installer Daemon POC <br />"
"Version: Unavailable")
@bp.route('/main/help',methods=['GET'])
def main_welcome():
"""
Manages the main help system.
"""
return render_template('help.html')
@bp.route('/main/quit',methods=['GET'])
def main_quit():
"""
Manages the quit dialog.
"""
return render_template('quit.html')
@bp.route('/main/menu',methods=['GET'])
def main_menu():
"""
Manages the main menu.
"""
return render_template('menu.html')
def build_stringlist():
"""
Return all the strings that is used in this applet.
"""
string_dict = {}
string_dict['next_text'] = _("Next")
string_dict['previous_text'] = _("Previous")
return string_dict

View File

@@ -0,0 +1 @@
/usr/share/fonts-fork-awesome/css/fork-awesome.css

1
src/yasi_applets/main/static/htmx.min.js vendored Symbolic link
View File

@@ -0,0 +1 @@
/usr/share/javascript/htmx/htmx.min.js

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<g fill="#2e3436">
<path d="m 3 0 c -1.644531 0 -3 1.355469 -3 3 v 10 c 0 1.644531 1.355469 3 3 3 h 10 c 1.644531 0 3 -1.355469 3 -3 v -10 c 0 -1.644531 -1.355469 -3 -3 -3 z m 0 2 h 10 c 0.570312 0 1 0.429688 1 1 v 10 c 0 0.570312 -0.429688 1 -1 1 h -10 c -0.570312 0 -1 -0.429688 -1 -1 v -10 c 0 -0.570312 0.429688 -1 1 -1 z m 0 0"/>
<path d="m 4 7 h 8 v 2 h -8 z m 0 0"/>
<path d="m 9 4 v 8 h -2 v -8 z m 0 0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -0,0 +1,37 @@
html {
/* Overwrite the white that is set by bulma.css */
body {
display: flex;
font-family: Noto Sans;
color: white;
overflow: hidden;
min-width: 1050px;
min-height: 600px;
}
.frame {
border-radius: 10px;
background-color: #0f1933;
padding: 15px 15px 15px 15px;
width: 100%;
min-height: 600px;
position: absolute;
top: 0px;
bottom: 0px;
}
.applet a:link a:hover a:active {
color: yellow;
}
.applet {
width: 100%;
height: 470px;
bottom: 0px;
overflow-y: scroll;
overflow-x: hidden;
}
.radio:hover {
color: #f1f1f1;
}

View File

@@ -0,0 +1,54 @@
html {
/* Overwrite the white that is set by bulma.css */
background: transparent;
}
body {
display: flex;
font-family: Sans; Roboto; Lato; Noto Sans;
color: white;
overflow: hidden;
min-width: 1050px;
min-height: 600px;
user-select: none;
}
html, body {margin: 0; height: 100%; overflow: hidden;}
.frame {
border-radius: 10px;
background-color: #404040;
padding: 15px 15px 15px 15px;
width: 100%;
min-height: 600px;
position: absolute;
top: 0px;
bottom: 0px;
user-select: none;
}
.applet a:link a:hover a:active {
color: yellow;
}
.applet::-webkit-scrollbar {
display: none;
}
.applet {
width: 100%;
height: 512px;
overflow-y: scroll;
overflow-x: hidden;
overflow: -moz-scrollbars-none;
}
.radio:hover {
color: #f1f1f1;
}
.pywebview-drag-region {
width: 100%;
height: 85px;
}

View File

@@ -0,0 +1,37 @@
html {
/* Overwrite the white that is set by bulma.css */
background-color: transparent;
}
body {
display: flex;
font-family: Noto Sans;
color: white;
overflow: hidden;
min-width: 1050px;
min-height: 600px;
}
.frame {
border-radius: 10px;
background-color: #e9e8e4;
padding: 15px;
max-width: 1050px;
}
.applet a:link a:hover a:active {
color: yellow;
}
.applet {
color: #383838;
width: 1040px;
height: 470px;
overflow-y: scroll;
overflow-x: hidden;
padding-right: 20px;
}
.radio:hover {
color: #404040;
}

View File

@@ -0,0 +1 @@
system-installer-dark.css

View File

@@ -0,0 +1,9 @@
from flask import Blueprint
bp = Blueprint('software', __name__,
template_folder='',
static_folder='static',
static_url_path='/software/static')
from yasi_applets.software import routes

View File

@@ -0,0 +1,81 @@
from yasi_applets.software import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
from flask import current_app
@bp.route('/software')
def webui_software():
"""
Software screen for the webui.
"""
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
next_step_url = menu[menu.index("software")+1]
if menu[menu.index("software")] == 1:
previous_step_url = False
else:
previous_step_url = menu[menu.index("software")-1]
sources_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-cloud-download" aria-hidden="true"></i> &nbsp; Edit Sources </button>'
blends_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-download" aria-hidden="true"></i> &nbsp; Install a Blend </button>'
bottom_menu = sources_button + blends_button
# Leave out useless buttons until they do more
bottom_menu = ''
build_summary()
return render_template('software.html',
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
previous_step = previous_step_url,
next_step = next_step_url,
bottom_menu = bottom_menu,
popcon=current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'],
desktop=current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'])
@bp.route('/software/settings', methods=['GET', 'POST'])
def software_settings():
"""
Receive settings for the software applet.
"""
if request.method == 'POST':
popcon = "popcon" in request.form
current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'] = popcon
print(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'])
build_summary()
return ('', 204)
@bp.route('/software/select-desktop', methods=['GET', 'POST'])
def software_select_desktop():
"""
Select a desktop environment for installation
"""
if request.method == 'POST':
desktop = request.form['software-desktop']
print(desktop)
current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'] = desktop
build_summary()
return ('', 204)
def build_menu():
"""
Define menu items and paths.
"""
# proper one once translations are done:
#current_app.config['CONFIG']['settings']['menu']['welcome'] = (build_stringlist()['menu_item'], "/welcome", 10)
current_app.config['CONFIG']['settings']['menu']['software'] = ("Software", "/software", 40)
def build_summary():
"""
Write up a summary of what this module will do.
"""
current_app.config['CONFIG']['Summary']['software'] = {}
current_app.config['CONFIG']['Summary']['software']['heading'] = "Software"
current_app.config['CONFIG']['Summary']['software']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']
current_app.config['CONFIG']['Summary']['software']['text'] = "Participate in Popularity Contest: " + str(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']) + "<br/>Desktop environment selected: " + str(current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'])
return("ok?")
build_menu()

View File

@@ -0,0 +1,80 @@
{% extends "layout.html" %}
{% block body %}
<p> <b> Would you like fries with that? </b></p>
<br>
<big> Popularity Contest </big>
<br><br>
<p>The Popularity Contest (popcon) is a programme where anonymous data is sent back to Debian, tracking the number of packages installed. More information can be obtained at https://popcon.debian.org.</p> <br>
<input style="background-color: #777777;" type="checkbox" id="popcon"
name="popcon" hx-post="/software/settings" hx-trigger="change"
{% if popcon %} checked {% endif %}>
<label for="popcon"> Participate in PopCon </label><br>
<br>
<big><h3> Desktop Environment </h3></big>
<br>
<p>Would you like to install a graphical environment for this system?</p>
<br>
<form>
<div class="control is-link">
<div class="select">
<select hx-post="/software/select-desktop" hx-target="body" name="software-desktop" style="width: 220px">
<option value="" {% if desktop == "None" %} selected=selected {% endif %}> None</option>
<option value="task-gnome-desktop" {% if desktop == "task-gnome-desktop" %} selected=selected {% endif %} >GNOME</option>
<option value="task-kde-desktop" {% if desktop == "task-kde-desktop" %} selected=selected {% endif %}>KDE Plasma</option>
<option value="task-xfce-desktop" {% if desktop == "task-xfce-desktop" %} selected=selected {% endif %}>Xfce</option>
<option value="task-lxde-desktop" {% if desktop == "task-lxde-desktop" %} selected=selected {% endif %}>LXDE</option>
<option value="task-lxqt-desktop" {% if desktop == "task-lxqt-desktop" %} selected=selected {% endif %}>LXQt</option>
<option value="task-mate-desktop" {% if desktop == "task-mate-desktop" %} selected=selected {% endif %}>MATE</option>
<option value="lomiri" {% if desktop == "lomiri" %} selected=selected {% endif %}>Lomiri</option>
<option value="task-cinnamon-desktop" {% if desktop == "task-cinnamon-desktop" %} selected=selected {% endif %}>Cinnamon</option>
</select>
</div>
</div>
</form>
<!--
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px;">
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
Desktop Environment</span>
<div style="padding: 15px; padding-top: 10px; padding-bottom: 5px; background-color: #fff; color: #000;">
<p>
<img src="/static/icons/console.png" width="48px" alt="" style="padding-right: 10px;" />
<img src="/static/icons/gnome.jpeg" width="48px" alt="" style="padding-right: 10px;" />
<img src="/static/icons/kde.jpeg" width="48px" alt="" style="padding-right: 10px;" />
<img src="/static/icons/xfce.jpeg" width="48px" alt="" style="padding-right: 10px;" />
<img src="/static/icons/mate.jpeg" width="48px" alt="" style="padding-right: 10px;" />
<img src="/static/icons/lxde.jpeg" width="48px" alt="" style="padding-right: 10px;" />
<p>
</div>
</div>
<br />
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px; margin-bottom: 20px;">
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
Select software from Debian archives</span>
<div style="padding-left: 15px; padding-right: 15px; padding-bottom: 5px; background-color: #fff; color: #000;">
<p><b>Select packages or selections of packages from the Debian archives.</b></p>
<button class="button is-dark">Games</button>
<button class="button is-dark">Productivity</button>
<button class="button is-dark">Creativity</button>
<button class="button is-dark">Server</button>
<button class="button is-dark">Development</button>
</div>
</div>
</div>
</div>
-->
{% endblock %}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,7 @@
from flask import Blueprint
bp = Blueprint('summary', __name__,
template_folder='')
from yasi_applets.summary import routes

View File

@@ -0,0 +1,45 @@
from yasi_applets.summary import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
from flask import current_app
@bp.route('/summary',methods=['GET', 'POST', 'PUT'])
def summary_index():
"""
The page you'd get if you access the root of
this app in a browser.
"""
build_menu()
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
previous_step_url = menu[menu.index("summary")-1]
next_step_url = "install"
config = current_app.config['CONFIG']
print (current_app.config['CONFIG']['Summary'])
html = (str(current_app.config['CONFIG']['Summary']['welcome']) + "<br>" + str(current_app.config['CONFIG']['Summary']['software']))
summary = config['Summary']
print("Config is: ")
print(config)
return render_template('summary.html',
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
previous_step=previous_step_url,
next_step=next_step_url,
config=config,
html=html,
summary=summary)
def build_menu():
"""
Define menu items and paths.
"""
# proper one once translations are done:
#current_app.config['CONFIG']['settings']['menu']['welcome'] = (build_stringlist()['menu_item'], "/welcome", 10)
current_app.config['CONFIG']['settings']['menu']['summary'] = ("Summary", "/summary", 60)
build_menu()

View File

@@ -0,0 +1,30 @@
{% extends "layout.html" %}
{% block body %}
<p><b> Ready to install! Please review all changes.</b></p>
<p> This is the last chance to back out before committing to install, please ensure all the details are correct. </p>
<br>
{% for module in summary %}
<h3> <big> {{ summary[module]['heading'] }} </big> </h3>
<!-- {{ summary[module]['bleh'] }}
{{ summary[module]['settings'] }} -->
{{ summary[module]['text']|safe }}
<br /><br />
{% endfor %}
<br><br/>
<!-- <p>Config is: <code> {{ config }} </code></p> -->
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,10 @@
from flask import Blueprint
bp = Blueprint('users', __name__,
template_folder='',
static_folder='static',
static_url_path='/users/static')
from yasi_applets.users import routes

Binary file not shown.

View File

@@ -0,0 +1,65 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-20 15:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: routes.py:33
msgid "Let's set up an initial user."
msgstr "Kom on stel 'n gebruiker op."
msgid "Users"
msgstr "Gebruikers"
#: routes.py:34
msgid "Full Name"
msgstr "Volle Naam"
#: routes.py:35
msgid "Username"
msgstr "Gebruikersnaam"
#: routes.py:36
msgid "This username is available"
msgstr "Hierdie gebruikersnaam is nie beskikbaar nie."
#: routes.py:37
msgid "This username is not available"
msgstr "Hierdie gebruikersnaam is nie beskikbaar nie."
#: routes.py:38
msgid "This username is reserved by the system"
msgstr "Hierdie gebruikersnaam is reserveerd deur vir die sisteem."
#: routes.py:39
msgid "The username must be one word, lowercase, with no special characters"
msgstr "Die gebruikersnaam moet een woord wees, kleinletters, met geen spesiale karakters."
#: routes.py:40
msgid "Password"
msgstr "Wagwoord"
#: routes.py:41
msgid "Password (confirm)"
msgstr "Wagwoord (bevestig)"
#: routes.py:42
msgid "These passwords do now match"
msgstr "Hierdie wagwoorde is nie dieselfde nie"
#: routes.py:43
msgid "This password is too short"
msgstr "Hierdie wagwoord is te kort"

View File

@@ -0,0 +1,62 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-06-20 15:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: routes.py:33
msgid "Let's set up an initial user."
msgstr ""
#: routes.py:34
msgid "Full Name"
msgstr ""
#: routes.py:35
msgid "Username"
msgstr ""
#: routes.py:36
msgid "This username is available"
msgstr ""
#: routes.py:37
msgid "This username is not available"
msgstr ""
#: routes.py:38
msgid "This username is reserved by the system"
msgstr ""
#: routes.py:39
msgid "The username must be one word, lowercase, with no special characters"
msgstr ""
#: routes.py:40
msgid "Password"
msgstr ""
#: routes.py:41
msgid "Password (confirm)"
msgstr ""
#: routes.py:42
msgid "These passwords do now match"
msgstr ""
#: routes.py:43
msgid "This password is too short"
msgstr ""

View File

@@ -0,0 +1,126 @@
from yasi_applets.software import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
import gettext
# we use this neat little trick to get config data from the main app
from flask import current_app
# Set up Gettext
def set_language(LANG):
"""
Sets language for this applet
"""
translations = gettext.translation("users", '/usr/share/yasi-daemon/yasi_applets/users/locales',
fallback=True, languages=[LANG])
translations.install()
_ = translations.gettext
set_language('')
@bp.route('/users')
def users_root():
"""
Users screen for the webui.
"""
set_language(current_app.config['CONFIG']['settings']['language'])
string_dict = build_stringlist()
build_menu()
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
next_step_url = menu[menu.index("users")+1]
if menu[menu.index("users")] == 1:
previous_step_url = False
else:
previous_step_url = menu[menu.index("users")-1]
root_button = '&nbsp; <button class="button not-allowed is-light"> <i class="fa fa-user" aria-hidden="true"></i> &nbsp; Setup root user </button>'
ldap_button = '&nbsp; <button class="button is-light"> <i class="fa fa-address-card" aria-hidden="true"></i> &nbsp; Connect LDAP </button>'
ad_button = '&nbsp; <button class="button is-light"> <i class="fa fa-address-card" aria-hidden="true"></i> &nbsp; Connect AD </button>'
csv_button = '&nbsp; <button class="button is-light"> <i class="fa fa-users" aria-hidden="true"></i> &nbsp; Import CSV </button>'
bottom_menu = root_button + ldap_button + ad_button + csv_button
bottom_menu = ""
initial_user = current_app.config['CONFIG']['recipe']['users']['users'][0]
build_summary()
return render_template('users.html', string_dict=string_dict,
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
previous_step=previous_step_url,
next_step=next_step_url,
bottom_menu=bottom_menu,
initial_user=initial_user)
@bp.route('/users/user-check/', methods=['GET', 'POST', 'PUT'])
def check_user():
if request.method == 'POST':
username = request.form["username"]
fullname = request.form["fullname"]
current_app.config['CONFIG']['recipe']['users']['users'][0]['username'] = username
current_app.config['CONFIG']['recipe']['users']['users'][0]['fullname'] = fullname
if username in ["root", "games"]:
return('<p class="has-text-danger"><b>That username is not available</b> </p>')
else:
return('<p class="has-text-success"><b>That username is available</b> </p>')
build_summary()
return("")
@bp.route('/users/password-check/', methods=['GET', 'POST', 'PUT'])
def check_password():
if request.method == 'POST':
password = request.form["password"]
password_confirm = request.form["password_confirm"]
current_app.config['CONFIG']['recipe']['users']['users'][0]['password'] = password
current_app.config['CONFIG']['recipe']['users']['users'][0]['password_confirm'] = password_confirm
if password != password_confirm:
return('<p class="has-text-danger"><b>Passwords do not match</b> </p>')
else:
return('<p class="has-text-success"><b>Passwords match</b> </p>')
build_summary()
return("")
def build_stringlist():
"""
Return all the strings that is used in this applet.
"""
string_dict = {}
string_dict['menu_item'] = _("Users")
string_dict['initial_user_text'] = _("Let's set up an initial user.")
string_dict['full_name'] = _("Full Name")
string_dict['user_name'] = _("Username")
string_dict['user_name_hint'] = _("One word, all lowercase")
string_dict['user_name_available'] = _("This username is available")
string_dict['user_name_not_available'] = _("This username is not available")
string_dict['user_name_reserved'] = _("This username is reserved by the system")
string_dict['user_name_characters'] = _("The username must be one word, lowercase, with no special characters")
string_dict['password'] = _("Password")
string_dict['password_confirm'] = _("Password (confirm)")
string_dict['password_nomatch'] = _("These passwords do now match")
string_dict['password_tooshort'] = _("This password is too short")
string_dict['next_text'] = _("Next")
string_dict['back_text'] = _("Back")
return string_dict
def build_menu():
"""
Define menu items and paths.
"""
current_app.config['CONFIG']['settings']['menu']['users'] = (build_stringlist()['menu_item'], "/users", 20)
def build_summary():
"""
Write up a summary of what this module will do.
"""
current_app.config['CONFIG']['Summary']['users'] = {}
current_app.config['CONFIG']['Summary']['users']['heading'] = "Users and Identity"
current_app.config['CONFIG']['Summary']['users']['settings'] = current_app.config['CONFIG']['recipe']['users']['users']
current_app.config['CONFIG']['Summary']['users']['text'] = "Add primary user with the username: " + str(current_app.config['CONFIG']['recipe']['users']['users'][0]['username'])
return("ok?")
build_menu()

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<linearGradient id="a" gradientUnits="userSpaceOnUse" x1="16.98286657496" x2="113.51232281881" y1="91.79046347784" y2="91.79046347784">
<stop offset="0" stop-color="#e6f0fc"/>
<stop offset="0.0383542" stop-color="#cadff8" stop-opacity="0.996078"/>
<stop offset="0.124655" stop-color="#d4e5f9" stop-opacity="0.992157"/>
<stop offset="0.901364" stop-color="#b2d0f4" stop-opacity="0.964706"/>
<stop offset="0.9589" stop-color="#d0e3f9" stop-opacity="0.964706"/>
<stop offset="1" stop-color="#98c1f1" stop-opacity="0.964706"/>
</linearGradient>
<linearGradient id="b" gradientUnits="userSpaceOnUse" x1="35.05556157496" x2="88.56691281881" y1="91.79046347784" y2="91.79046347784">
<stop offset="0" stop-color="#e6f0fc"/>
<stop offset="0.230125" stop-color="#cadff8" stop-opacity="0.996078"/>
<stop offset="0.383542" stop-color="#d4e5f9" stop-opacity="0.992157"/>
<stop offset="0.588996" stop-color="#b2d0f4" stop-opacity="0.964706"/>
<stop offset="0.753397" stop-color="#d0e3f9" stop-opacity="0.964706"/>
<stop offset="1" stop-color="#98c1f1" stop-opacity="0.964706"/>
</linearGradient>
<path d="m 65.007812 67.363281 c -24.257812 0.027344 -44.703124 16.957031 -49.898437 39.847657 c -1.597656 5.96875 1.65625 9.007812 5.269531 9.007812 h 88.402344 c 4.75 0 7.4375 -4.191406 6.222656 -8.734375 c -5.097656 -23.042969 -25.625 -40.109375 -49.996094 -40.121094 z m 0 0" fill="url(#a)"/>
<path d="m 89.351562 33.375 c 0 14.257812 -11.554687 25.8125 -25.8125 25.8125 c -14.257812 0 -25.816406 -11.554688 -25.816406 -25.8125 s 11.558594 -25.816406 25.816406 -25.816406 c 14.257813 0 25.8125 11.558594 25.8125 25.816406 z m 0 0" fill="url(#b)"/>
<path d="m 65.007812 64.082031 c -24.257812 0.03125 -44.703124 16.074219 -49.898437 38.96875 c -1.597656 5.96875 1.65625 9.007813 5.269531 9.007813 h 88.402344 c 4.75 0 7.4375 -4.191406 6.222656 -8.734375 c -5.097656 -23.042969 -25.625 -39.226563 -49.996094 -39.242188 z m 24.34375 -34.046875 c 0 14.257813 -11.554687 25.8125 -25.8125 25.8125 c -14.257812 0 -25.816406 -11.554687 -25.816406 -25.8125 c 0 -14.257812 11.558594 -25.816406 25.816406 -25.816406 c 14.257813 0 25.8125 11.558594 25.8125 25.816406 z m 0 0" fill="#f6f9fe" fill-opacity="0.996078"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,73 @@
{% extends "layout.html" %}
{% block body %}
<p><b> {{ string_dict['initial_user_text'] }} </b></p>
<br>
<form action="/users" method="POST">
<img src="/users/static/img/avatar-default.svg" width="160px" style="float: left; position: absolute;" />
<div style="margin-left: 180px;">
<div class="field">
<label>{{ string_dict['full_name'] }}</label>
<div class="control has-icons-left has-icons-right">
<input class="input" name="fullname" type="text" placeholder="Full Name" value="{% if initial_user['fullname'] %}{{ initial_user['fullname'] }}{% endif %}" hx-post="/users/user-check" hx-trigger="keyup changed delay:500ms" hx-target="#username-name">
<span class="icon is-small is-left">
<i class="fa fa-user-circle-o" aria-hidden="true"></i>
</span>
<!-- <span class="icon is-small is-right">
<img src="/static/icons/emblem-default-symbolic.svg">
</span> -->
</div>
</div>
<div class="field">
<label>{{ string_dict['user_name'] }}</label>
<div class="control has-icons-left has-icons-right">
<input class="input" type="text" placeholder="{{ string_dict['user_name'] }}" value="{% if initial_user['username'] %}{{ initial_user['username'] }}{% endif %}" name="username" hx-post="/users/user-check" hx-trigger="keyup changed delay:200ms" hx-trigger="load" hx-target="#username-status">
<span class="icon is-small is-left">
<i class="fa fa-user-circle-o" aria-hidden="true"></i>
</span>
<!-- <span class="icon is-small is-right">
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
</span> -->
</div>
<div id="username-status">
<p> {{ string_dict['user_name_hint'] }}</p>
</div>
</div>
<div class="field">
<label class="password">{{ string_dict['password'] }}</label>
<div class="control has-icons-left has-icons-right">
<input class="input" name="password" type="password" placeholder="{{ string_dict['password'] }}" value="{% if initial_user['password'] %}{{ initial_user['password'] }}{% endif %}" hx-post="/users/password-check" hx-trigger="keyup changed delay:200ms" hx-target="#password-status">
<span class="icon is-small is-left">
<i class="fa fa-address-card" aria-hidden="true"></i>
</span>
</div>
</div>
<div class="field">
<label class="password">{{ string_dict['password_confirm'] }}</label>
<div class="control has-icons-left has-icons-right">
<input class="input" name="password_confirm" type="password" placeholder="{{ string_dict['password_confirm'] }}" value="{% if initial_user['password_confirm'] %}{{ initial_user['password_confirm'] }}{% endif %}" hx-post="/users/password-check" hx-trigger="keyup changed delay:200ms" hx-target="#password-status">
<span class="icon is-small is-left">
<i class="fa fa-address-card" aria-hidden="true"></i>
</span>
<div id="password-status">
<p> </p>
</div>
</div>
</div>
</form>
</div> <!-- style 180 -->
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,8 @@
from flask import Blueprint
bp = Blueprint('welcome', __name__,
template_folder='',
static_folder='static',
static_url_path='/welcome/static')
from yasi_applets.welcome import routes

View File

@@ -0,0 +1,60 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: UTF-8\n"
msgid "Welcome"
msgstr "Welkom"
msgid "Users"
msgstr "Gebruikers"
msgid "Disks"
msgstr "Skywe"
msgid "Software"
msgstr "Sagteware"
msgid "Summary"
msgstr "Opsomming"
msgid "Power"
msgstr "Krag"
msgid "Internet"
msgstr "Internet"
msgid "Back"
msgstr "Terug"
msgid "Next"
msgstr "Volgende"
#: routes.py:27
msgid "Welcome! This setup program will install Debian on to your system."
msgstr "Welkom! Hierdie program sal jou deur die proses lei om Debian te installeer na jou sisteem."
#: routes.py:28
msgid "Please confirm the following details:"
msgstr "Bevestig asseblief die volgende:"
#: routes.py:29
msgid "Language:"
msgstr "Taal:"
#: routes.py:30
msgid "Keyboard Layout:"
msgstr "Knoppies Uitleg:"
#: routes.py:31
msgid "Time Zone:"
msgstr "Tyd Zone:"

View File

@@ -0,0 +1,33 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: en-za\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: UTF-8\n"
#: routes.py:27
msgid "Welcome! This setup program will install Debian on to your system."
msgstr "Howzit! This setup program will install Debian on to your system."
#: routes.py:28
msgid "Please confirm the following details:"
msgstr "Please confirm the following details:"
#: routes.py:29
msgid "Language:"
msgstr "Language:"
#: routes.py:30
msgid "Keyboard Layout:"
msgstr "Keyboard Layout:"
#: routes.py:31
msgid "Time Zone:"
msgstr "Time Zone:"

View File

@@ -0,0 +1,33 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: UTF-8\n"
#: routes.py:27
msgid "Welcome! This setup program will install Debian on to your system."
msgstr "Welcomen! This setup program will install Debian on to your system."
#: routes.py:28
msgid "Please confirm the following details:"
msgstr "Please confirmen the following details:"
#: routes.py:29
msgid "Language:"
msgstr "Language:"
#: routes.py:30
msgid "Keyboard Layout:"
msgstr "Keyboard Layout:"
#: routes.py:31
msgid "Time Zone:"
msgstr "Time Zone:"

View File

@@ -0,0 +1,33 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: UTF-8\n"
#: routes.py:27
msgid "Welcome! This setup program will install Debian on to your system."
msgstr "Bienvienue! This setup program will install Debian on to your system."
#: routes.py:28
msgid "Please confirm the following details:"
msgstr "Please confirmen the following details:"
#: routes.py:29
msgid "Language:"
msgstr "Language:"
#: routes.py:30
msgid "Keyboard Layout:"
msgstr "Keyboard Layout:"
#: routes.py:31
msgid "Time Zone:"
msgstr "Time Zone:"

View File

@@ -0,0 +1,38 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: routes.py:27
msgid "Welcome! This setup program will install Debian on to your system."
msgstr ""
#: routes.py:28
msgid "Please confirm the following details:"
msgstr ""
#: routes.py:29
msgid "Language:"
msgstr ""
#: routes.py:30
msgid "Keyboard Layout:"
msgstr ""
#: routes.py:31
msgid "Time Zone:"
msgstr ""

View File

@@ -0,0 +1,194 @@
from yasi_applets.welcome import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
# we use this neat little trick to get config data from the main app
from flask import current_app
import gettext
import dmm.lsblk as lsblk
import dmm.timezone as timezone
import subprocess
import socket
# Set up Gettext
def set_language(LANG):
"""
Sets language for this applet
"""
# TODO: unhardcode this path
translations = gettext.translation("welcome", '/usr/share/yasi-daemon/yasi_applets/welcome/locales',
fallback=True, languages=[LANG])
translations.install()
_ = translations.gettext
@bp.route('/welcome',methods=['GET', 'POST', 'PUT'])
def welcome_index():
"""
The page you'd get if you access the root of
this app in a browser.
"""
set_language(current_app.config['CONFIG']['settings']['language'])
if request.method == 'POST':
if "lang" in request.form.keys():
current_app.config['CONFIG']['settings']['language'] = request.form["lang"]
LANG = current_app.config['CONFIG']['settings']['language']
set_language(LANG)
FORMLANG = request.form["lang"]
if "keyboard" in request.form.keys():
print(request.form["keyboard"])
if "timezone" in request.form.keys():
print(request.form["timezone"])
global lang
lang = current_app.config['CONFIG']['settings']['language']
set_language(lang)
global string_dict
string_dict = build_stringlist()
blkid = lsblk.list_scsi_devices()
build_menu()
build_summary()
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
next_step_url = menu[menu.index("welcome")+1]
previous_step_url = menu[menu.index("welcome")-1]
print("index is: " , menu.index("welcome"))
if menu.index("welcome") == 0:
previous_step_url = False
else:
previous_step_url = menu[menu.index("users")-1]
power_button = '<button id="powerbutton" hx-get="/welcome/battery/button" hx-trigger="load, every 1s" hx-target="#powerbutton" class="button is-dark"> <span style="color: #ffffff;"> <i class="fa fa-question" aria-hidden="true"></i></span> &nbsp;</button>'
internet_button = '&nbsp; <button id="internetbutton" class="button is-dark" hx-get="/welcome/internet/button" hx-trigger="load, every 1s" hx-target="#internetbutton"><span style="color: #ffffff;"> <i class="fa fa-question" aria-hidden="true"></i></span> &nbsp;</button>'
bottom_menu = power_button + internet_button
return render_template('welcome.html',
string_dict=string_dict, selected_lang=lang,
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
timezones=timezone.list_timezones()[1].split("\n"),
previous_step=previous_step_url,
next_step=next_step_url,
bottom_menu=bottom_menu)
@bp.route('/welcome/battery',methods=['GET', 'POST', 'PUT'])
def welcome_battery():
"""
Are we running on battery?
How much power do we have?
"""
if "yes" in str(subprocess.check_output("LANG=C upower -d | grep on-battery", shell=True)):
on_battery = True
else:
on_battery = False
if on_battery:
percentage = str(subprocess.check_output('LANG=C upower -d | grep '
'percentage | head -1 | cut -f 2 -d":" | '
'sed "s/ //g"', shell=True)).strip("'b").strip("%\\n")
else:
percentage = False
status = {}
status = {"on_battery": on_battery, "percentage": percentage}
return status
@bp.route('/welcome/battery/button',methods=['GET', 'POST', 'PUT'])
def welcome_battery_button():
"""
Returns the html power button.
"""
on_battery, percentage = welcome_battery()['on_battery'], welcome_battery()['percentage']
if on_battery:
power_button = '<button id="powerbutton hx-get="/welcome/battery/button" hx-trigger="load, every 1s" hx-target="#powerbutton" class="button is-dark"> <span style="color: #ffa45c;"> <i class="fa fa-warning" aria-hidden="true"></i></span> &nbsp; Power: Battery: ' + percentage + '%</button>'
else:
power_button = """<button id="powerbutton hx-get="/welcome/battery/button" hx-trigger="load, every 1s" hx-target="#powerbutton" class="button is-dark"> <span style="color: #a0ff98;"> <i class="fa fa-check" aria-hidden="true"></i></span> &nbsp;""" + string_dict["power_text"] + "</button>"""
return str(power_button)
@bp.route('/welcome/internet', methods=['GET'])
def has_internet():
"""
Very rudimentary internet check.
Check if we can resolve deb.debian.org.
"""
try:
socket.getaddrinfo("deb.debian.org", 80, proto=socket.IPPROTO_TCP)
canhas = True
except socket.gaierror:
canhas = False
return canhas
@bp.route('/welcome/internet/button', methods=['GET'])
def welcome_internet_button():
"""
Draw updated button depending on internet status.
"""
if has_internet():
return('&nbsp; <button id="internetbutton" class="button is-dark" hx-get="/welcome/internet/button" hx-trigger="load, every 1s" hx-target="#internetbutton"><span style="color: #a0ff98;"> <i class="fa fa-check" aria-hidden="true"></i></span> &nbsp; Internet </button>')
else:
return('&nbsp; <button id="internetbutton" class="button is-dark" hx-get="/welcome/internet/button" hx-trigger="load, every 1s" hx-target="#internetbutton"><span style="color: #ffa45c;"> <i class="fa fa-warning" aria-hidden="true"></i></span> &nbsp; Internet </button>')
def build_stringlist():
"""
Return all the strings that is used in this applet."
"""
string_dict = {}
string_dict['menu_item'] = _("Welcome")
# In the future, these will be loaded from their own modules
string_dict['menu_item_users'] = _("Users")
string_dict['menu_item_disks'] = _("Disks")
string_dict['menu_item_software'] = _("Software")
string_dict['menu_item_summary'] = _("Summary")
string_dict['welcome_text'] = _("Welcome! This setup program will install Debian on to your system.")
string_dict['confirm_text'] = _("Please confirm the following details:")
string_dict['language_text'] = _("Language:")
string_dict['keylayout_text'] = _("Keyboard Layout:")
string_dict['timezone_text'] = _("Time Zone:")
string_dict['basicsettings_text'] = _("Basic Settings:")
string_dict['power_text'] = _("Power")
string_dict['internet_text'] = _("Internet")
string_dict['next_text'] = _("Next")
string_dict['back_text'] = _("Back")
lang_dict = {}
lang_dict['af'] = _("Afrikaans")
lang_dict['en'] = _("English (International)")
lang_dict['en-us'] = _("English (United States)")
lang_dict['en-uk'] = _("English (United Kingdom)")
lang_dict['en-za'] = _("English (South Africa)")
string_dict['lang_list'] = lang_dict
return string_dict
def build_menu():
"""
Define menu items and paths.
"""
current_app.config['CONFIG']['settings']['menu']['welcome'] = (build_stringlist()['menu_item'], "/welcome", 10)
#TODO: temporary hack: We need an automated way to translate all menu items
current_app.config['CONFIG']['settings']['menu']['users'] = (build_stringlist()['menu_item_users'], "/users", 20)
current_app.config['CONFIG']['settings']['menu']['disks'] = (build_stringlist()['menu_item_disks'], "/disks", 30)
current_app.config['CONFIG']['settings']['menu']['software'] = (build_stringlist()['menu_item_software'], "/software", 40)
current_app.config['CONFIG']['settings']['menu']['summary'] = (build_stringlist()['menu_item_summary'], "/summary", 50)
def build_summary():
"""
Write up a summary of what this module will do.
"""
html = ("<b><big>Basic settings</big></b><p> Language: " + lang + "</p>")
if not 'Summary' in current_app.config['CONFIG']:
current_app.config['CONFIG']['Summary'] = {}
current_app.config['CONFIG']['Summary']['welcome'] = {}
current_app.config['CONFIG']['Summary']['welcome']['heading'] = "Basic Settings"
print(current_app.config['CONFIG']['Summary']['welcome'])
text = "Language: " + str(current_app.config['CONFIG']['settings']['language'])
current_app.config['CONFIG']['Summary']['welcome']['text'] = text
return(html)
set_language(current_app.config['CONFIG']['settings']['language'])
build_menu

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@@ -0,0 +1,56 @@
{% extends "layout.html" %}
{% block body %}
<img style="width: 100%; border-radius: 8px;"
src="/welcome/static/img/banner.png"
alt="Debian Image banner" />
<!-- This odd, yet very efficient mechanism ensures that translations,
settings and summaries for each page gets loaded -->
<div hx-get="/users" hx-target="#none" hx-trigger="load"></div>
<div hx-get="/disks" hx-target="#none" hx-trigger="load"></div>
<div hx-get="/software" hx-target="#none" hx-trigger="load"></div>
<div hx-get="/summary" hx-target="#none" hx-trigger="load"></div>
<!-- TODO: Add hook to fix next tab again after loading summary -->
<div style="display: none;" id="none"></div>
<p><b> {{ string_dict['welcome_text'] }} </b></p>
<p>{{ string_dict['confirm_text'] }} </p> <br />
<div style="left: 25px; display: flex; align-items: center; gap: 1rem;">
<img style="width: 80px;" src="/welcome/static/img/lang_w.svg" alt="Language icon" />
<form action="/welcome" method="POST" style="display: flex; flex-direction: column; gap: 0.5rem;">
<label for="lang">{{ string_dict['language_text'] }}</label>
<div class="control is-link">
<div class="select">
<select id="lang" name="lang" hx-post="/welcome" hx-target="body" style="width: 220px;">
{% for lang in string_dict['lang_list'] %}
<option value="{{ lang }}" {% if lang == selected_lang %} selected {% endif %}>
{{ string_dict['lang_list'][lang] }}
</option>
{% endfor %}
</select>
</div>
</div>
</form>
</div>
<br />
<div style="left: 25px; display: flex; align-items: center; gap: 1rem;">
<img style="width: 80px;" src="/welcome/static/img/keyboard.svg" alt="Language icon" />
<form action="/welcome" method="POST" style="display: flex; flex-direction: column; gap: 0.5rem;">
<label for="keyboard">{{ string_dict['keylayout_text'] }}</label>
<div class="control is-link">
<div class="select">
<select name="keyboard" hx-post="/welcome" hx-target="body" style="width: 220px;">
<option>en-us</option>
<option>en-uk</option>
</select>
</div>
</div>
</form>
</div>
{% endblock %}

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Yasi Daemon
After=network.target
[Service]
ExecStart=yasi-daemon
Environment="FLASK_ENV=production"
User=yasi
Group=yasi
Restart=always
[Install]
WantedBy=multi-user.target