Skip to content

Commit 85494dc

Browse files
committed
cosmetic update + new functions, unfinished
1 parent 8995cee commit 85494dc

File tree

8 files changed

+104
-36
lines changed

8 files changed

+104
-36
lines changed

AUTHORS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
_theUnixManager_ is a project by **Archetypum** with:
2+
- **Kinderfeld** as the lead developer and initial creator.
3+
(https://github.com/Kinderfeld)
4+
- **WretchOfLights** as the documentation writer.
5+
(https://github.com/WretchOfLights)
6+
- **wazups** as the illustrator
7+
(https://github.com/wazups)

CHANGELOG.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
# theUnixManager v1.0.0-stable
1+
# theUnixManager v1.1.1-stable
22

3-
This is the first stable release of theUnixManager.
3+
Next stable release of theUnixManager python version.
44

55
Features:
66

7-
* 7 init systems support (systemd, sysvinit, init, s6, runit, launchd, openrc).
8-
* 52 GNU/Linux and BSD UNIX distributions support (and beyond!).
9-
* 16 package managers support (apt, aptitude, dpkg, portage, dnf, yum, zypper, apk, xpbs, qi, slackpkg, guix, pacman, pkg, pkg_add, pkgin).
7+
* _sudo_ and _doas_ support.
8+
9+
* **7** init systems support (_systemd_, _sysvinit_, _init_, _s6_, _runit_, _launchd_, _openrc_).
10+
11+
* **52** _GNU/Linux_ and _BSD UNIX_ distributions support (and beyond!).
12+
13+
* **16** package managers support (_apt_, _aptitude_, _dpkg_, _portage_, _dnf_, _yum_, _zypper_, _apk_, _xpbs_, _qi_, _slackpkg_, _guix_, _pacman_, _pkg_, _pkg_add_, _pkgin_).
1014

1115
Nothing left to say here anymore, its just first stable release.
1216

1317
"cloc ." statistics:
1418

1519
```text
16-
13 text files.
17-
12 unique files.
18-
4 files ignored.
20+
14 text files.
21+
13 unique files.
22+
2 files ignored.
1923
20-
github.com/AlDanial/cloc v 1.96 T=0.03 s (464.8 files/s, 104345.4 lines/s)
24+
github.com/AlDanial/cloc v 1.96 T=0.02 s (706.5 files/s, 190803.3 lines/s)
2125
-------------------------------------------------------------------------------
2226
Language files blank comment code
2327
-------------------------------------------------------------------------------
24-
Python 3 411 344 1497
25-
Markdown 9 161 0 281
28+
Bourne Shell 2 501 356 2230
29+
Markdown 10 154 0 269
30+
Text 1 0 0 1
2631
-------------------------------------------------------------------------------
27-
SUM: 12 572 344 1778
32+
SUM: 13 655 356 2500
2833
-------------------------------------------------------------------------------
2934
```
File renamed without changes.

README.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# theUnixManager
22
![theUnixManagerEdited](https://github.com/user-attachments/assets/6c0b3fbc-1d09-4d35-9dde-33b22a468c45)
33

4-
theUnixManager - ultimate package manager && init system handling library made by Archetypum
4+
**theUnixManager** - ultimate package manager && init system handling library made by Archetypum
55
that simplifies interaction with UNIX systems and creation of system-related python scripts.
66

77
## Installation (as root):
@@ -24,24 +24,14 @@ tum.package_handling(distro, package_list=["git", "vim", "htop", "emacs"], comma
2424
tum.init_system_handling(init_system, command="start", service="ssh")
2525
```
2626

27-
## Credits
28-
29-
theUnixManager is a project by Archetypum with:
30-
- Kinderfeld as the lead developer and creator.
31-
(https://github.com/Kinderfeld)
32-
- WretchOfLights as the documentation writer.
33-
(https://github.com/WretchOfLights)
34-
- wazups as the illustrator
35-
(https://github.com/wazups)
36-
3727
## License
3828

39-
theUnixManager uses GNU Lesser General Public License V3.
29+
_theUnixManager_ uses **GNU Lesser General Public License v3**.
4030

4131
More information in:
4232

43-
- LICENSE.md
44-
- https://www.fsf.org
45-
- https://www.gnu.org
33+
- _LICENSE.md_
34+
- _https://www.fsf.org_
35+
- _https://www.gnu.org_
4636

4737
![gnu](https://github.com/user-attachments/assets/66935a97-374f-4dbc-9f1c-428070fda139)

VERSION.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v1.1.1-stable

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"""
66
:authors: Archetypum
7-
:license: GNU Lesser General Public License V3, see LICENSE.md file.
7+
:license: GNU Lesser General Public License v3, see LICENSE-LGPL.md file.
88
:copyright: (c) 2025 Archetypum
99
"""
1010

@@ -14,16 +14,16 @@
1414

1515
setup(
1616
name="theUnixManager",
17-
version="1.0.0",
18-
license="GNU Lesser General Public License V3, see LICENSE.md file",
17+
version="1.1.1",
18+
license="GNU Lesser General Public License v3, see LICENSE-LGPL.md file",
1919
author="Archetypum",
2020
author_email="archetypum@tutamail.com",
2121
description=(
2222
"Ultimate package manager and init system handling library made by Archetypum that simplifies interaction with UNIX systems and creation of system-related Python scripts."
2323
),
2424
long_description=long_description,
25-
url="https://github.com/Archetypum/theUnixManager-python",
26-
download_url="https://github.com/Archetypum/theUnixManager/releases/tag/v1.0.0-stable",
25+
url="https://github.com/Archetypum/theUnixManager",
26+
download_url="https://github.com/Archetypum/theUnixManager/releases/tag/v1.1.1-stable",
2727
packages=["the_unix_manager"],
2828
install_requires=[],
2929
classifiers=[

the_unix_manager/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
"""
44
:authors: Archetypum
5-
:license: GNU Lesser General Public License V3, see LICENSE.md file.
5+
:license: GNU Lesser General Public License v3, see LICENSE-LGPL.md file.
66
77
:copyright: (c) 2025 Archetypum
88
"""
99

1010
from .the_unix_manager import *
1111

1212
__author__: str = "Archetypum"
13-
__version__: str = "1.0.0"
13+
__version__: str = "1.1.1"
1414
__email__: str = "archetypum@tutamail.com"

the_unix_manager/the_unix_manager.py

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* test this on more systems.
1515
* many more?
1616
17-
theUnixManager is licensed by GNU Lesser General Public License V3.
17+
theUnixManager is licensed by GNU Lesser General Public License v3.
1818
Date: 18.10.2024
1919
---------------------------------------
2020
"""
@@ -116,7 +116,7 @@ def the_unix_manager_version() -> str:
116116
"""
117117

118118
try:
119-
with open("VERSION.txt", "r") as version_file:
119+
with open("/etc/theunixmanager/python/VERSION.txt", "r") as version_file:
120120
return version_file.read().strip()
121121
except FileNotFoundError:
122122
return f"{RED}[!] Error: 'VERSION.txt' file not found.\nBroken installation?{RESET}"
@@ -135,12 +135,20 @@ def the_unix_manager_tester() -> None:
135135
test_results: dict = {}
136136
init_system: str = get_init_system()
137137
distro: str = get_user_distro()
138+
your_editor: str = get_preferred_editor()
139+
root_command: str = sudo_or_doas()
138140

139141
print(f"user distro: {distro}")
140142
test_results["get_user_distro"] = prompt_user("[?] is that true?")
141143

142144
print(f"user init system: {init_system}")
143145
test_results["get_init_system"] = prompt_user("[?] is that true?")
146+
147+
print(f"user preferred editor: {your_editor}")
148+
test_results["get_preferred_editor"] = prompt_user("[?] is that true?")
149+
150+
print(f"root command: {root_command}")
151+
test_results["sudo_or_doas"] = prompt_user("[?] is that true?")
144152

145153
print(f"{BLACK}black text{RESET}")
146154
test_results["black_text"] = prompt_user("[?] is that true?")
@@ -518,6 +526,63 @@ def get_init_system() -> str:
518526
return "unknown"
519527

520528

529+
def get_preferred_editor() -> str:
530+
"""
531+
Gets user preffered text editor and stores it in '/etc/theunixmanager/bash/EDITOR.txt'.
532+
533+
Returns:
534+
text_editor (str): User's preferred editor.
535+
"""
536+
537+
editor_config_path: str = "/etc/theunixmanager/python/EDITOR.txt"
538+
539+
if os.path.isfile(editor_file):
540+
with open(editor_file, "r") as editor_config_file:
541+
stored_editor: str = editor_config_file.read().strip()
542+
if stored_editor:
543+
return stored_editor
544+
545+
print(f"{ORANGE}\n[!] Error: No preferred editor found at {editor_config_path}.{RESET}")
546+
user_editor: str = input("[==>] Enter your preferred editor manually: ")
547+
with open(editor_file, "w") as editor_config_file:
548+
file.write(user_editor)
549+
550+
return user_editor
551+
552+
553+
def sudo_or_doas() -> str | None:
554+
"""
555+
Checks for the preferred command (either sudo or doas) in '/etc/theunixmanager/bash/COMMAND.txt'.
556+
If no preference is found, it checks whether sudo or doas is available on the system and stores
557+
the preference accordingly. If both are available, sudo is chosen.
558+
559+
Returns:
560+
result (str): The preferred command ('sudo' or 'doas').
561+
"""
562+
563+
command_file: str = "/etc/theunixmanager/python/EDITOR.txt"
564+
565+
if os.path.isfile(command_file):
566+
with open(command_file, "r") as command_config_file:
567+
stored_command: str = command_config_file.read().strip()
568+
if stored_command in ["sudo", "doas"]:
569+
return stored_command
570+
571+
if which("sudo"):
572+
with open(command_file, "w") as command_config_file:
573+
command_config_file.write("sudo")
574+
return "sudo"
575+
576+
elif which("doas"):
577+
with open(command_file, "w") as file:
578+
file.write("doas")
579+
return "doas"
580+
581+
else:
582+
print(f"{RED}[!] Error: Neither sudo nor doas is available.{RESET}")
583+
return None
584+
585+
521586
class SystemdManagement:
522587
"""
523588
A class for managing services using systemd.

0 commit comments

Comments
 (0)