Skip to content

Commit

Permalink
Merge pull request #101 from drauger-os-development/dev
Browse files Browse the repository at this point in the history
Initial support for Drauger OS 7.7
  • Loading branch information
Batcastle authored Dec 9, 2023
2 parents eba88bb + b812c4c commit 8e00c13
Show file tree
Hide file tree
Showing 23 changed files with 280 additions and 367 deletions.
6 changes: 3 additions & 3 deletions DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: system-installer
Version: 2.5.5
Maintainer: Thomas Castleman <contact@draugeros.org>
Version: 2.7.3
Maintainer: Thomas Castleman <batcastle@draugeros.org>
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), python3-dnspython
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, tzdata, laptop-detect (>=0.16)
Description: System Installer for Drauger OS
System Installer for Drauger OS
28 changes: 0 additions & 28 deletions DEBIAN/postrm

This file was deleted.

19 changes: 18 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,24 @@ fi

# Pshyc - we're compiling shit now
cd usr/bin
g++ -fPIE -m64 -o system-installer system-installer.cxx $(python3.10-config --ldflags --cflags --embed)
echo "Would you like to build with Python 3.10 or 3.11?"
read -p "Python 3.10 [1], Python 3.11 [2], Exit [0]: " ans
if $(echo "${ans,,}" | grep -qE "1|one|first|3.10"); then
vert="3.10"
elif $(echo "${ans,,}" | grep -qE "2|two|second|3.11"); then
vert="3.11"
elif $(echo "${ans,,}" | grep -qE "exit|quit|leave|e|q|x|0|no|zero"); then
echo "Exiting as requested..."
exit 1
else
echo "Input not recognized. Defaulting to Python 3.10"
fi
{
g++ -fPIE -m64 -o system-installer system-installer.cxx $(python"${vert}"-config --ldflags --cflags --embed)
} || {
echo "Build failed. Try making sure you have 'python${vert}-dev' and 'libpython${vert}-dev' installed" 1>&2
exit 2
}
cd ../..
##############################################################
# #
Expand Down
1 change: 1 addition & 0 deletions etc/system-installer/quick-install-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"EXTRAS":true,
"UPDATES":false,
"LOGIN":false,
"COMPAT_MODE": false,
"MODEL":"Acer laptop",
"LAYOUT":"English(US)",
"VARIENT":"English(US) - English(US, euro on 5)",
Expand Down
2 changes: 1 addition & 1 deletion usr/bin/system-installer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

using namespace std;

str VERSION = "2.5.9";
str VERSION = "2.7.3";
str R = "\033[0;31m";
str G = "\033[0;32m";
str Y = "\033[1;33m";
Expand Down
3 changes: 2 additions & 1 deletion usr/lib/python3/dist-packages/de_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# __init__.py
#
# Copyright 2022 Thomas Castleman <contact@draugeros.org>
# Copyright 2023 Thomas Castleman <batcastle@draugeros.org>
#
# 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 @@ -25,3 +25,4 @@
import de_control.enable as enable
import de_control.disable as disable
import de_control.modify as modify
import de_control._common as _common
24 changes: 13 additions & 11 deletions DEBIAN/postinst → ...thon3/dist-packages/de_control/_common.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
#!/bin/bash
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# postinst.sh
#
# Copyright 2023 Thomas Castleman <contact@draugeros.org>
#
# _common.py
#
# Copyright 2023 Thomas Castleman <batcastle@draugeros.org>
#
# 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.
#
#
if $(groups live | grep -vq "syslog"); then
usermod -aG syslog live
fi
#
"""Common internal functions for de_control"""
import os

def get_de():
return os.getenv("XDG_CURRENT_DESKTOP").upper()
20 changes: 13 additions & 7 deletions usr/lib/python3/dist-packages/de_control/disable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# disable.py
#
# Copyright 2022 Thomas Castleman <contact@draugeros.org>
# Copyright 2023 Thomas Castleman <batcastle@draugeros.org>
#
# 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 @@ -23,14 +23,20 @@
#
"""Disable DE/WM or DE/WM features"""
import subprocess
import de_control._common as com

def immersion():
"""disable Immersion within DE.
This may involve enabliong desktop icons, re-adding panels, and more.
This may involve enabling 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"])
de = com.get_de()
if de == "XFCE":
# restart panel
subprocess.Popen(["xfce4-panel"])
# bring back desktop icons
subprocess.Popen(["xfconf-query", "--channel", "xfce4-desktop",
"--property", "/desktop-icons/style", "--set", "2"])
elif de == "KDE":
# TODO: Add KDE Support
pass
22 changes: 14 additions & 8 deletions usr/lib/python3/dist-packages/de_control/enable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# enable.py
#
# Copyright 2022 Thomas Castleman <contact@draugeros.org>
# Copyright 2023 Thomas Castleman <batcastle@draugeros.org>
#
# 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 @@ -24,16 +24,22 @@
"""Enable DE/WM or DE/WM features"""
import subprocess
import psutil
import de_control._common as com

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()
de = com.get_de()
if de == "XFCE":
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()
elif de == "KDE":
# TODO: Add KDE Support
pass
33 changes: 20 additions & 13 deletions usr/lib/python3/dist-packages/de_control/modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# modify.py
#
# Copyright 2022 Thomas Castleman <contact@draugeros.org>
# Copyright 2023 Thomas Castleman <batcastle@draugeros.org>
#
# 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 @@ -24,6 +24,7 @@
"""Modify DE/WM settings and configuration"""
import sys
import os
import de_control._common as com


def __eprint__(*args, **kwargs):
Expand All @@ -36,18 +37,24 @@ def for_desktop(username):
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)
de = com.get_de()
if de == "XFCE":
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)
elif de == "KDE":
__eprint__("WARNING: KDE detected. KDE support not yet implemented.")
else:
__eprint__(f"WARNING: { de } not a recognized DE.")


def for_laptop():
Expand Down
23 changes: 10 additions & 13 deletions usr/share/system-installer/UI/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,13 @@ def select_config(self, widget):
response = dialog.run()
if response == Gtk.ResponseType.OK:
self.data = dialog.get_filename()
dialog.destroy()
self.complete()
elif response == Gtk.ResponseType.CANCEL:
self.data = 1
dialog.destroy()
self.exit("clicked")

dialog.destroy()
self.exit("clicked")

def add_filters(self, dialog):
"""Add Filters to Quick Install File Selection Window"""
Expand Down Expand Up @@ -1324,7 +1326,6 @@ def update_possible_root_parts(self, root_drive_dropdown):
if each["name"] == root_drive_dropdown.get_active_id():
if "children" in each:
parts = each["children"]
break
if parts == []:
return
setting = root_drive_dropdown.get_active_id()
Expand Down Expand Up @@ -1358,12 +1359,9 @@ def update_possible_home_parts(self, home_drive_dropdown):
parts = []
for each in drives:
if each["name"] == home_drive_dropdown.get_active_id():
if each["fstype"] is not None:
parts.append(each)
if "children" in each:
for each1 in each["children"]:
parts.append(each1)
break
setting = home_drive_dropdown.get_active_id()
self.home_parts.set_active_id(None)
self.home_parts.remove_all()
Expand Down Expand Up @@ -1398,7 +1396,6 @@ def update_possible_swap_parts(self, swap_drive_dropdown):
if each["name"] == swap_drive_dropdown.get_active_id():
if "children" in each:
parts = each["children"]
break
setting = swap_drive_dropdown.get_active_id()
self.swap_parts.set_active_id(None)
self.swap_parts.remove_all()
Expand Down Expand Up @@ -1430,7 +1427,6 @@ def update_possible_efi_parts(self, efi_drive_dropdown):
if each["name"] == efi_drive_dropdown.get_active_id():
if "children" in each:
parts = each["children"]
break
if parts == []:
return
setting = efi_drive_dropdown.get_active_id()
Expand Down Expand Up @@ -2007,11 +2003,12 @@ def locale(self, button):

time_zone = self.data["TIME_ZONE"].split("/")
self.time_menu = Gtk.ComboBoxText.new()
zones = ["Africa", "America", "Antarctica", "Arctic", "Asia",
"Atlantic", "Australia", "Brazil", "Canada", "Chile",
"Europe", "Indian", "Mexico", "Pacific", "US"]
for each6 in zones:
self.time_menu.append(each6, each6)
zones_pre = os.listdir("/usr/share/zoneinfo")
zones = []
for each in zones_pre:
if os.path.isdir(f"/usr/share/zoneinfo/{each}"):
if each not in ("right", "posix"):
self.time_menu.append(each, each)
if len(time_zone) > 0:
self.time_menu.set_active_id(time_zone[0])
self.time_menu.connect("changed", self.update_subregion)
Expand Down
17 changes: 12 additions & 5 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 2023 Thomas Castleman <contact@draugeros.org>
# Copyright 2023 Thomas Castleman <batcastle@draugeros.org>
#
# 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 @@ -374,8 +374,14 @@ def send_report(self, widget):
def preview_message(self, widget):
"""Preview Installation Report"""
self.clear_window()
with open(self.path, "r") as mail:
text = mail.read()
try:
with open(self.path, "r") as mail:
text = mail.read()
except FileNotFoundError:
# this is handled during file generation, so this should never be used
path = getenv("HOME") + "/installation_report.txt"
with open(path) as mail:
text = mail.read()
if len(text.split("\n")) > 36:
self.scrolling = True
self.set_default_size(775, 700)
Expand Down Expand Up @@ -419,7 +425,7 @@ def generate_message(self):
"""write installation report to disk"""
report_code = time.time()
output = {}
self.path = "/var/log/installation_report-%s.dosir" % (report_code)
self.path = "/tmp/installation_report-%s.dosir" % (report_code)
output['Installation Report Code'] = report_code
try:
ver = check_output(["system-installer", "-v"]).decode().split("\n")
Expand Down Expand Up @@ -469,7 +475,8 @@ def generate_message(self):
with open(self.path, "w+") as message:
json.dump(output, message, indent=1)
except PermissionError:
with open(getenv("HOME") + "/installation_report.txt", "w+") as message:
self.path = getenv("HOME") + "/installation_report.txt"
with open(self.path, "w+") as message:
json.dump(output, message, indent=1)

def message_accept(self, widget):
Expand Down
Loading

0 comments on commit 8e00c13

Please sign in to comment.