Skip to content

Commit

Permalink
Merge pull request #42 from drauger-os-development/testing
Browse files Browse the repository at this point in the history
Lots of bug fixes and other things
  • Loading branch information
Batcastle authored Oct 3, 2021
2 parents c1ab32d + 01c8cd8 commit e5bf621
Show file tree
Hide file tree
Showing 26 changed files with 704 additions and 303 deletions.
3 changes: 1 addition & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# These are supported funding model platforms

liberapay: Batcastle
liberapay: Drauger_OS_Development
github: Batcastle
custom: "https://www.paypal.com/pools/c/89GtByYaTT"
2 changes: 1 addition & 1 deletion DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: system-installer
Version: 2.0.1
Version: 2.1.0
Maintainer: Thomas Castleman <[email protected]>
Homepage: https://github.com/drauger-os-development/system-installer
Section: admin
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# system-installer
System Installer for Drauger OS.
System Installation Utility for Drauger OS.

`system-installer` aims to provide a fast, modular method of installing a Debian-based operating system. As of now, it is not advised for use on systems that Linux new-comers will frequent, due to it's reliance upon `gparted` and the users understanding of how partitioning works.

Expand All @@ -10,15 +10,15 @@ System Installer for Drauger OS.

[Click here for notes on hacking on `system-installer`](https://github.com/drauger-os-development/system-installer/blob/master/hacking.md)

`system-installer` currently works only on Drauger OS, but may be adapted to work on other Debian-based OSs later.
`system-installer` currently works only on Drauger OS, but is being adapted to work on other Debian-based OSs as well.


## Notable features


* Add PPAs inside the installer, post installation
* Quick-install config file support
* One of the *fastest* installation utilities in Linux today (2-to-3 minutes (ish)) on a quad-core CPU with 4 GB of RAM and decent, reliable internet)
* One of the *fastest* installation utilities in Linux today (1-to-2.5 minutes (ish)) on a quad-core CPU with 4 GB of RAM and decent, reliable internet)


## Development
Expand Down
2 changes: 2 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO
* create lib to handle ALL package management functions that can easily be swapped out, making more distro agnostic.
17 changes: 4 additions & 13 deletions development.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,16 @@ The following packages are required in order to do development for `system-istal

* `python3`
* `gir1.2-gtk-3.0`
* `bash`
* `procps`
* `grep`
* `zenity`
* `bc`
* `p7zip-full`

The following are not required but may help out
* `arch-install-scripts`
* `coreutils`
* `squashfs-tools`
* `pylint`

You can find a number of tests to make sure your programs work correctly in the `tests` directory. These are currently tailored to how these programs are written, i.e. they work on BASH and Python scripts. None of the UI is tested yet. Feel free to write more tests and request their addition in a pull request.


Any and all shell scripts will eventually be converted to Python 3 or C/C++, preferably performing the same operations in as multi-threaded a fashion as possible, in order to accelerate installation. Furthermore, as time progresses, `system-installer` should become increasingly modular in order to allow others to change `system-installer` to better fit their needs and use case.

You can find a number of tests to make sure your programs work correctly in the `tests` directory. These are currently tailored to how these programs are written, i.e. they work Python scripts. None of the UI is tested yet. Feel free to write more tests and request their addition in a pull request.

All Python code should conform to `PEP8` as closely as possible. If you open a pull request `pep8speaks` will provide feedback on your `PEP8` conformance.
All Python code should conform to `PEP8` as closely as possible. If you open a pull request `pep8speaks` will provide feedback on your `PEP8` conformance.

A good rule of thumb is if your Python code gets a score of `7.5` or higher from `pylint`, and works correctly, the chances of having your pull request accepted is fairly high, but no pull request is guaranteed to be accepted.
A good rule of thumb is if your Python code gets a score of `7.5` or higher from `pylint`, and works correctly, the chances of having your pull request accepted is fairly high, but no pull request is guaranteed to be accepted.
36 changes: 18 additions & 18 deletions etc/system-installer/settings.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"squashfs_Location":"/run/live/medium/live/filesystem.squashfs",
"distro":"Drauger OS",
"report":{
"squashfs_Location": "/run/live/medium/live/filesystem.squashfs",
"distro": "Drauger OS",
"report": {
"recv_keys": "https://download.draugeros.org/keys/public_keys.asc",
"upload": "rsync://download.draugeros.org/reports-upload"
},
"ping servers":[
"ping servers": [
"https://apt.draugeros.org",
"https://ubuntu.com",
"https://debian.org"
],
"ping count":2,
"partitioning":{
"EFI":{
"START":0,
"END":200
"ping count": 2,
"partitioning": {
"EFI": {
"START": 0,
"END": 200
},
"ROOT":{
"START":201,
"END":"35%",
"fs":"ext4"
"START": 201,
"END": "40%",
"fs": "ext4"
},
"HOME":{
"START":"35%",
"END":"100%",
"fs":"ext4"
"START": "40%",
"END": "100%",
"fs": "ext4"
},
"min root size":19327,
"mdswh":128
"min root size": 23000,
"mdswh": 128
},
"run_post_oem":["/usr/share/drauger-welcome/main_ui.py"]
"run_post_oem": ["/usr/share/drauger-welcome/main_ui.py"]
}
21 changes: 11 additions & 10 deletions hacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ Settings are defined in `/etc/system-installer/settings.json`
- Location of the squashfs file to unpack
- `distro`
- Name of the distro `system-installer` is running on. Use this for branding.
- `report_to`
- Email address to send installation reports to
- Must be a valid email address
- Installation reporting is opt-in only
- This will be changed to a set of URLs soon as installation repoting has become much more complex
- `report`
- `recv_keys`
- URL to download Public GPG keys from for encryption.
- `upload`
- `rsync` URL to upload to.
- `ping servers`
- URLs to ping to check for internet access
- DO NOT use IP addresses.
Expand All @@ -131,16 +131,17 @@ Settings are defined in `/etc/system-installer/settings.json`
- All of supported entries must be defined in each of `ROOT`, `HOME`, or `EFI`
- `min root size` must be an integer that dictates the minimum size of the root partition in MiB
- `mdswh` stands for 'minimum drive size with home', and is the size smallest drive you can install Drauger OS to and have a seperate `/home` partition on the same drive.
- `run_post_oem`
- A program to run once set up is complete after an OEM installation. This should probably launch a welcome screen for the end user at some point.

Notable files for hacking
---

```
build.sh
/usr/share/system-installer/installer.py
/usr/share/system-installer/modules/master.py
/usr/share/system-installer/modules/install_extras.sh
/usr/share/system-installer/modules/manual-partitioner.sh
/usr/share/system-installer/modules/systemd_boot_config.py
/usr/share/system-installer/modules
/usr/share/system-installer/UI
/usr/lib/python3/dist-packages/de_control
/etc/system-installer/settings.json
```
3 changes: 0 additions & 3 deletions known-bugs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
List of known bugs
- built in manual partitioner is TERRIBLE
- This needs a rewrite, to stop relying on Gparted
- built in auto-partitioner isn't great but it works

- systems with 16+ drives in them cannot have root on the 16th drive during installation
- This is due to a parsing issue when installing to the correct NVMe drive
Expand All @@ -12,5 +11,3 @@ List of known bugs
- What few systems do have enough drives for this issue to arise are either;
- A server (which Drauger OS should not be running on)
- A SUPER high-end machine which likely supports UEFI

- installer.py only supports default.json for now
13 changes: 6 additions & 7 deletions usr/bin/system-installer
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
"""Command line executable for System Installer"""
from sys import argv, stderr
import subprocess
import de_control.disable as de_disable
import de_control.enable as de_enable
from os import path
ARGC = len(argv)
VERSION = "2.0.1"
VERSION = "2.1.0"
HELP = """
system-installer, Version %s
Expand All @@ -48,11 +50,6 @@ def eprint(args, *kwargs, color=R):
print(NC, file=stderr)


def restart_xfce_panel():
"""Restart Xfce4-panel"""
subprocess.Popen(["xfce4-panel"])


def launch(boot_time=False):
"""Launch system-isntaller"""
command1 = ["/usr/bin/xhost"]
Expand All @@ -66,14 +63,16 @@ def launch(boot_time=False):
with open("/tmp/system-installer.log", "w+") as log_file:
log_file.write("STARTING IN BOOT-TIME MODE")
command.insert(1, "--boot-time")
de_enable.immersion()

command = " ".join(command)
try:
exit_code = subprocess.check_call(command, shell=True)
except subprocess.CalledProcessError:
# Assume the worst
exit_code = 256
if boot_time:
restart_xfce_panel()
de_disable.immersion()
if ((exit_code == 256) and (not path.exists("/tmp/system-installer.log"))):
eprint("Error accessing /usr/share/system-installer/engine.py: No such file or directory")
with open("/tmp/system-installer.log", "w+") as log_file:
Expand Down
27 changes: 27 additions & 0 deletions usr/lib/python3/dist-packages/de_control/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# __init__.py
#
# Copyright 2021 Thomas Castleman <[email protected]>
#
# 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., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
"""DE/WM control lib for system-installer."""
import de_control.enable as enable
import de_control.disable as disable
import de_control.modify as modify
36 changes: 36 additions & 0 deletions usr/lib/python3/dist-packages/de_control/disable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# disable.py
#
# Copyright 2021 Thomas Castleman <[email protected]>
#
# 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., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
"""Disable DE/WM or DE/WM features"""
import subprocess

def immersion():
"""disable Immersion within DE.
This may involve enabliong desktop icons, re-adding panels, and more.
"""
# restart panel
subprocess.Popen(["xfce4-panel"])
# bring back desktop icons
subprocess.Popen(["xfconf-query", "--channel", "xfce4-desktop",
"--property", "/desktop-icons/style", "--set", "2"])
39 changes: 39 additions & 0 deletions usr/lib/python3/dist-packages/de_control/enable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# enable.py
#
# Copyright 2021 Thomas Castleman <[email protected]>
#
# 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., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
"""Enable DE/WM or DE/WM features"""
import subprocess
import psutil

def immersion():
"""Enable Immersion within DE.
This may involve disabling desktop icons, removing panels, and more.
"""
subprocess.Popen(["xfconf-query", "--channel", "xfce4-desktop",
"--property", "/desktop-icons/style", "--set", "0"])
# Kill Xfce4 Panel, makes this more emersive
for proc in psutil.process_iter():
# check whether the process name matches
if proc.name() == "xfce4-panel":
proc.terminate()
57 changes: 57 additions & 0 deletions usr/lib/python3/dist-packages/de_control/modify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# modify.py
#
# Copyright 2021 Thomas Castleman <[email protected]>
#
# 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., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
"""Modify DE/WM settings and configuration"""
import sys
import os


def __eprint__(*args, **kwargs):
"""Make it easier for us to print to stderr"""
print(*args, file=sys.stderr, **kwargs)


def for_desktop(username):
"""Make modifications to the DE/WM to optimize for the DESKTOP
experience.
"""
__eprint__("DESKTOP DETECTED. EDITING PANEL ACCORDINGLY.")
try:
os.remove("/home/" + username + "/.config/xfce4/panel/battery-12.rc")
except FileNotFoundError:
pass
with open("/home/" + username + "/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml", "r") as file:
xml = file.read().split("\n")
for each in range(len(xml) - 1, -1, -1):
if "battery" in xml[each]:
del xml[each]
xml = "\n".join(xml)
with open("/home/" + username + "/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml", "w") as file:
file.write(xml)


def for_laptop():
"""make modifications to the DE/WM to optimize for the LAPTOP
experience.
"""
pass
2 changes: 1 addition & 1 deletion usr/share/system-installer/UI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# __init__.py
#
# Copyright 2020 Thomas Castleman <[email protected]>
# Copyright 2021 Thomas Castleman <[email protected]>
#
# 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
Expand Down
Loading

0 comments on commit e5bf621

Please sign in to comment.