Skip to content

Commit

Permalink
Merge pull request #99 from drauger-os-development/testing
Browse files Browse the repository at this point in the history
Documentation updates, QoL improvements
  • Loading branch information
Batcastle authored Sep 20, 2023
2 parents cb7770c + bfbbdce commit 843c378
Show file tree
Hide file tree
Showing 20 changed files with 195 additions and 64 deletions.
4 changes: 2 additions & 2 deletions DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: system-installer
Version: 2.5.0
Version: 2.5.5
Maintainer: Thomas Castleman <[email protected]>
Homepage: https://github.com/drauger-os-development/system-installer
Section: admin
Architecture: amd64
Priority: important
Depends: arch-install-scripts, python3 (>=3.6.7-1~18.04), bash, gir1.2-gtk-3.0 (>=3.24.12-1ubuntu1), coreutils (>=8.28-1ubuntu1), apt (>=1.6.11), squashfs-tools (>=1:4.3-6ubuntu0.18.04.1), zenity (>=3.28.1-1), grub2-common (>=2.02-2ubuntu8.13), initramfs-tools (>=0.130ubuntu3.8), systemd (>=237-3ubuntu10.24), locales (>=2.27-3ubuntu1), procps (>=2:3.3.12-3ubuntu1.1), grep (>=3.1-2), keyboard-configuration, util-linux (>=2.34-0.1ubuntu2), python3-parted (>=3.11.2), python3-psutil (>=5.5.0), python3-apt (>=2.0.0), python3-urllib3 (>=1.26.5-1~exp1), python3-gnupg (>=0.4.5), python3-xmltodict (>=0.11.0)
Depends: arch-install-scripts, python3 (>=3.6.7-1~18.04), bash, gir1.2-gtk-3.0 (>=3.24.12-1ubuntu1), coreutils (>=8.28-1ubuntu1), apt (>=1.6.11), squashfs-tools (>=1:4.3-6ubuntu0.18.04.1), zenity (>=3.28.1-1), grub2-common (>=2.02-2ubuntu8.13), initramfs-tools (>=0.130ubuntu3.8), systemd (>=237-3ubuntu10.24), locales (>=2.27-3ubuntu1), procps (>=2:3.3.12-3ubuntu1.1), grep (>=3.1-2), keyboard-configuration, util-linux (>=2.34-0.1ubuntu2), python3-parted (>=3.11.2), python3-psutil (>=5.5.0), python3-apt (>=2.0.0), python3-urllib3 (>=1.26.5-1~exp1), python3-gnupg (>=0.4.5), python3-xmltodict (>=0.11.0), python3-dnspython
Description: System Installer for Drauger OS
System Installer for Drauger OS
9 changes: 9 additions & 0 deletions build.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is for defining some simple build settings
# start a line with a hashtag (#) to denote a comment
#
# ALL URLs should be rsync URLS
#
# META_URL contains the meta package for the kernel
META_URL=rsync://rsync.draugeros.org/apt/pool/main/l/linux-meta
# PACK_URL contains the actual kernel image and header packages
PACK_URL=rsync://rsync.draugeros.org/apt/pool/main/l/linux-upstream
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ ARCH=$(cat DEBIAN/control | grep 'Architecture: '| sed 's/Architecture: //g')
FOLDER="$PAK\_$VERSION\_$ARCH"
FOLDER=$(echo "$FOLDER" | sed 's/\\//g')
OPTIONS="$1"
SETTINGS=$(grep -v "^#" build.conf | sed 's/=/ /g')
META_URL=$(echo "$SETTINGS" | grep "META_URL" | awk '{print $2}')
PACK_URL=$(echo "$SETTINGS" | grep "PACK_URL" | awk '{print $2}')
mkdir ../"$FOLDER"
##############################################################
# #
Expand All @@ -19,8 +22,8 @@ mkdir ../"$FOLDER"
if [ "$OPTIONS" != "--pool" ]; then
cd usr/share/system-installer
echo -e "\t###\tDOWNLOADING\t###\t"
rsync -vr rsync://rsync.draugeros.org/apt/pool/main/l/linux-upstream kernel
rsync -vr rsync://rsync.draugeros.org/apt/pool/main/l/linux-meta kernel
rsync -vr "$PACK_URL" kernel
rsync -vr "$META_URL" kernel
echo -e "\t###\tDELETING CRUFT\t###\t"
list=$(ls kernel)
for each in $list; do
Expand Down Expand Up @@ -115,6 +118,8 @@ fi
rm "$base"/usr/bin/system-installer
# delete C++ source from package
rm "$FOLDER"/usr/bin/system-installer.cxx
# delete Python cache files
find "$FOLDER" -maxdepth 10 -type d -name __pycache__ -exec rm -rfv {} \;
#build the shit
dpkg-deb --build "$FOLDER"
rm -rf "$FOLDER"
2 changes: 1 addition & 1 deletion development.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The following are not required but may help out

To install all of the dependencies at once, use
```bash
sudo apt install -y python3 gir1.2-gtk-3.0 p7zip-full python3-parted python3-gnupg arch-install-scripts coreutils squashfs-tools pylint
sudo apt install -y python3 gir1.2-gtk-3.0 p7zip-full python3-parted python3-dev python3-gnupg arch-install-scripts coreutils squashfs-tools pylint
```

# How to get started
Expand Down
1 change: 1 addition & 0 deletions etc/system-installer/oem-install.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"LANG": "OEM",
"TIME_ZONE": "OEM",
"AUTO_PART": true,
"COMPAT_MODE": true,
"ROOT": "OEM",
"EFI": "OEM",
"HOME": "OEM",
Expand Down
14 changes: 9 additions & 5 deletions etc/system-installer/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"upload": "rsync://rsync.draugeros.org/reports-upload"
},
"ping servers": [
"https://apt.draugeros.org",
"https://ubuntu.com",
"https://debian.org"
"draugeros.org",
"ubuntu.com",
"debian.org",
"google.com",
"example.com"
],
"ping count": 2,
"partitioning": {
Expand Down Expand Up @@ -46,6 +48,8 @@
"mdswh": 128
}
},
"run_post_oem": ["/usr/share/drauger-welcome/main_ui.py"],
"kernel_meta_pkg": "linux-drauger"
"run_post_oem": ["/usr/bin/drauger-welcome"],
"kernel_meta_pkg": "linux-drauger",
"remove_pkgs": ["system-installer",
"persistence-daemon"]
}
30 changes: 30 additions & 0 deletions testing_distros.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Testing Distros

This list details which distros have been tested and are known working with `system-installer`. Config changes to get `system-installer` working are acceptable.

## To test:
- [ ] Get the distro booted up in a VM or on a live USB/CD/DVD
- [ ] Run `git clone https://github.com/drauger-os-development/system-installer` to clone the repo
- [ ] `cd` into the folder: `cd system-installer`
- [ ] Make any necessary changes to the default config to get `system-installer` to work.
- [ ] Install Packages needed to build: `sudo apt install python3-dev libpython3-dev`
- [ ] Build the package: `./build.sh`
- [ ] Install the package: `sudo apt install ../system-installer_*.deb`
- [ ] Run `system-installer` in a terminal and try to install the OS!

## When testing, please do these things:
- [ ] Install using the auto-partitioner (on both EFI and BIOS)
- [ ] Install using the manual partitioner (on both EFI and BIOS)
- [ ] Install with and without Restricted Extras enabled

## For extra credit, try:
- [ ] Installing using Quick Install
- [ ] Installing using OEM install (this includes the End User Experience)
- [ ] Sending an Installation Report
- [ ] Installing with a RAID array configured in the installer


## Tested Distros ✅
**Drauger OS 7.5.1** - KNOWN WORKING

**Drauger OS 7.6** - KNOWN WORKING
4 changes: 2 additions & 2 deletions usr/bin/system-installer.cxx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* system-installer.cxx
*
* Copyright 2022 Thomas Castleman <[email protected]>
* Copyright 2023 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 Expand Up @@ -46,7 +46,7 @@

using namespace std;

str VERSION = "2.5.0";
str VERSION = "2.5.5";
str R = "\033[0;31m";
str G = "\033[0;32m";
str Y = "\033[1;33m";
Expand Down
72 changes: 56 additions & 16 deletions usr/share/system-installer/UI/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,47 @@ def reset(self, button):
self.show_all()

def oem_startup(self, widget):
"""Start up OEM installation"""
self.clear_window()

# show a confirmation window

label = Gtk.Label()
label.set_markup("""
<b>Are you sure you want to do an OEM installation?</b>
OEM installation should <b>ONLY</b> be used by OEMs, or those installing\t\t
Drauger OS for other people, ahead of time. It has several limitations\t\t
over a normal or quick installation:
* Takes up the entire drive it is installed to
* Locale, keyboard, and password must be set AFTER installation\t\t
* Hostname and username can not be set by the user
* Restricted Extras AND Updates are automatically installed
* A Swap file will automatically be generated to enable Hybrid Sleep\t\t
""")
label.set_justify(Gtk.Justification.LEFT)
label = self._set_default_margins(label)
self.grid.attach(label, 1, 1, 3, 1)

button1 = Gtk.Button.new_with_label("Proceed -->")
button1.connect("clicked", self.oem_run)
button1 = self._set_default_margins(button1)
self.grid.attach(button1, 3, 2, 1, 1)

button2 = Gtk.Button.new_with_label("Exit")
button2.connect("clicked", self.exit)
button2 = self._set_default_margins(button2)
self.grid.attach(button2, 2, 2, 1, 1)

button3 = Gtk.Button.new_with_label("<-- Back")
button3.connect("clicked", self.reset)
button3 = self._set_default_margins(button3)
self.grid.attach(button3, 1, 2, 1, 1)

self.show_all()

def oem_run(self, widget):
"""Start up OEM installation"""
self.data = "/etc/system-installer/oem-install.json"
self.complete()
Expand Down Expand Up @@ -1632,23 +1673,23 @@ def options(self, button):
self.grid.attach(label1, 1, 2, 2, 1)

self.extras = Gtk.CheckButton.new_with_label("Install Restricted Extras")
if self.data["EXTRAS"] == 1:
if self.data["EXTRAS"]:
self.extras.set_active(True)
self.extras = self._set_default_margins(self.extras)
self.grid.attach(self.extras, 1, 3, 2, 1)

# label2 = Gtk.Label()
# label2.set_markup("""
# Update the system during installation""")
# label2.set_justify(Gtk.Justification.LEFT)
# label2 = self._set_default_margins(label2)
# self.grid.attach(label2, 1, 4, 2, 1)
label2 = Gtk.Label()
label2.set_markup("""
Update the system during installation""")
label2.set_justify(Gtk.Justification.LEFT)
label2 = self._set_default_margins(label2)
self.grid.attach(label2, 1, 4, 2, 1)

# self.updates = Gtk.CheckButton.new_with_label("Update during Installation")
# if self.data["UPDATES"] == 1:
# self.updates.set_active(True)
# self.updates = self._set_default_margins(self.updates)
# self.grid.attach(self.updates, 1, 5, 2, 1)
self.updates = Gtk.CheckButton.new_with_label("Update during Installation")
if self.data["UPDATES"]:
self.updates.set_active(True)
self.updates = self._set_default_margins(self.updates)
self.grid.attach(self.updates, 1, 5, 2, 1)

label2 = Gtk.Label()
label2.set_markup("""
Expand All @@ -1658,13 +1699,13 @@ def options(self, button):
self.grid.attach(label2, 1, 6, 2, 1)

self.login = Gtk.CheckButton.new_with_label("Enable Auto-Login")
if self.data["LOGIN"] == 1:
if self.data["LOGIN"]:
self.login.set_active(True)
self.login = self._set_default_margins(self.login)
self.grid.attach(self.login, 1, 7, 2, 1)

self.compat_mode = Gtk.CheckButton.new_with_label("Enable Bootloader Compatibility Mode")
if self.data["COMPAT_MODE"] == 1:
if self.data["COMPAT_MODE"]:
self.compat_mode.set_active(True)
self.compat_mode = self._set_default_margins(self.compat_mode)

Expand Down Expand Up @@ -1694,8 +1735,7 @@ def options(self, button):
def options_next(self, button):
"""Set update and extras settings"""
self.data["EXTRAS"] = self.extras.get_active()
# self.data["UPDATES"] = self.updates.get_active()
self.data["UPDATES"] = False
self.data["UPDATES"] = self.updates.get_active()
self.data["LOGIN"] = self.login.get_active()
self.data["COMPAT_MODE"] = self.compat_mode.get_active()
global OPTIONS_COMPLETION
Expand Down
6 changes: 3 additions & 3 deletions usr/share/system-installer/UI/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# report.py
#
# Copyright 2022 Thomas Castleman <[email protected]>
# Copyright 2023 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 Expand Up @@ -462,7 +462,7 @@ def generate_message(self):
if custom == self.default_message:
output['CUSTOM MESSAGE'] = "NONE"
else:
output['CUSTOM MESSAGE'] = custom
output['CUSTOM MESSAGE'] = custom.split("\n")
else:
output['CUSTOM MESSAGE'] = "NONE"
try:
Expand Down Expand Up @@ -702,7 +702,7 @@ def ram_info():
if ram_capacity[each] == []:
del ram_capacity[each]
swap_capacity = check_output(["swapon", "--show"]).decode().split("\n")
return {"RAM": ram_capacity, "SWAP": swap_capacity}
return {"RAM": dict(ram_capacity), "SWAP": swap_capacity}


def disk_info():
Expand Down
42 changes: 27 additions & 15 deletions usr/share/system-installer/check_internet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# check_internet.py
#
# Copyright 2022 Thomas Castleman <[email protected]>
# Copyright 2023 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 All @@ -22,19 +22,25 @@
#
#
"""Ping servers to see if we have internet"""
from subprocess import check_output, CalledProcessError
import json
import dns.resolver as res
import common


def ping(mirror, count):
"""Ping the mirrors"""
def ping(mirror):
"""Try doing a DNS resolution on the mirrors"""
# We need just the domain name, so we have to parse things down a bit
mirror = mirror.split("/")[2]
command = ["ping", "-c", str(count), "-q", mirror]
# get the ping times
output = check_output(command).decode("utf-8").split("\n")[-2]
return float(output.split("/")[-2])
if mirror[:4] == "http":
mirror = mirror.split("/")[2]
if mirror[-1] == "/":
mirror = mirror[:-1]
try:
res.resolve(mirror, "A")
return True
except (res.NoNameservers, res.NoAnswer):
return False
except res.NXDOMAIN:
return None


def has_internet():
Expand All @@ -44,18 +50,24 @@ def has_internet():
with open("/etc/system-installer/settings.json", "r") as mirrors_file:
mirrors = json.load(mirrors_file)

ping_count = mirrors["ping count"]
mirrors = mirrors["ping servers"]

# get only the unique mirrors
mirrors = common.unique(mirrors)
# Get our ping times
results = []
try:
# Ping all listed servers, in case one or more is blocked
for each in mirrors:
ping(each, ping_count)

except CalledProcessError:
results.append(ping(each))
except:
return False

return True
true = 0
false = 0
for each in results:
if each:
true += 1
else:
false += 1

return (true > false)
2 changes: 1 addition & 1 deletion usr/share/system-installer/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# common.py
#
# Copyright 2022 Thomas Castleman <[email protected]>
# Copyright 2023 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
5 changes: 5 additions & 0 deletions usr/share/system-installer/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ def copy_log_to_disk():
additional_settings = oem.pre_install.show_main()
for each in additional_settings:
SETTINGS[each] = additional_settings[each]
if "COMPAT_MODE" not in SETTINGS:
# this is an old quick install file. It has likely worked for the user before.
# honor the file, but offer to update it
# TODO: Add offer to update Quick Install File
SETTINGS["COMPAT_MODE"] = False

except TypeError:
pass
Expand Down
3 changes: 2 additions & 1 deletion usr/share/system-installer/modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# __init__.py
#
# Copyright 2022 Thomas Castleman <[email protected]>
# Copyright 2023 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 Expand Up @@ -32,3 +32,4 @@
import modules.make_user as make_user
import modules.purge as purge
import modules.verify_install as verify_install
import modules.common as common
1 change: 1 addition & 0 deletions usr/share/system-installer/modules/common.py
Loading

0 comments on commit 843c378

Please sign in to comment.