This commit is contained in:
acidburn
2023-04-12 03:18:17 -04:00
parent 28d9fa1f30
commit ebd838f70b
+18 -29
View File
@@ -2,7 +2,6 @@
import os import os
import re import re
import shutil
import subprocess import subprocess
import importlib import importlib
@@ -17,22 +16,17 @@ def main():
setup = 'z' setup = 'z'
# sudo_check() sudo_check()
# HOME = os.getenv('home')
# os.chdir(f'{home}/scripts/')
# console.print("Working on > ", os.getcwd())
# user_answer = input("set resolution 1920x1080? y/n: ").lower() user_answer = input("set resolution 1920x1080? y/n: ").lower()
#console.print("run aranddr to proper set up", style='ok') console.print("run aranddr to proper set up", style='ok')
# try: try:
# if user_answer == 'y': if user_answer == 'y':
# os.system('xrandr -s 1920x1080') os.system('xrandr -s 1920x1080')
# except exception(): except Exception():
# print(Exception()) print(Exception())
# pass pass
console.print('optimizing dnf.conf', style='ok') console.print('optimizing dnf.conf', style='ok')
dnf_config() dnf_config()
@@ -40,8 +34,8 @@ def main():
# modules_to_check = ["rich", "pandas"] # modules_to_check = ["rich", "pandas"]
# pip_modules(modules_to_check) # pip_modules(modules_to_check)
#install_programs_dnf() install_programs_dnf()
#zsh_fonts() zsh_fonts()
# Pass D or L to copy_dotfiles function # Pass D or L to copy_dotfiles function
while (True): while (True):
@@ -53,16 +47,15 @@ def main():
#END OF MAIN #END OF MAIN
def dnf_config(): def dnf_config():
# dnf conf # dnf conf
with open('tt.txt', 'r+') as f: with open('/etc/dnf/dnf.conf' , 'r+') as f:
text = 'max_parallel_downloads=10 \nfastestmirror=true' text = 'max_parallel_downloads=10 \nfastestmirror=true'
match = re.search(r'(max_parallel_downloads=10)', f.read()) match = re.search(r'(max_parallel_downloads=10)', f.read())
if not match: if not match:
with open('tt.txt', 'a+') as f: with open('/etc/dnf/dnf.conf', 'a+') as f:
f.write(text) f.write(text)
console.print(' changes made to dnf_config :heavy_check_mark:', style='ok') console.print(' changes made to dnf_config :heavy_check_mark:', style='ok')
else: else:
@@ -76,12 +69,12 @@ def install_programs_dnf():
with open("data.txt", 'r') as file: with open("data.txt", 'r') as file:
for line in file: for line in file:
programs.append(line.strip()) programs.append(line.strip())
print(programs)
try: try:
subprocess.check_call(['dnf', 'install', *programs]) subprocess.check_call(['dnf', 'install', '-y', *programs])
except: except:
console.print(exception(),":x:" , style='error') console.print(Exception(),":x:" , style='error')
continue
## pip ## pip
@@ -105,8 +98,8 @@ def pip_modules(modules):
## checks for sudo ## checks for sudo
def sudo_check(): def sudo_check():
user = os.getenv("sudo_user") user = os.getenv("SUDO_USER")
if user is none: if user is None:
console.print("this program need 'sudo'", style='error') console.print("this program need 'sudo'", style='error')
exit() exit()
else: else:
@@ -114,7 +107,6 @@ def sudo_check():
# Oh my zsh setup + flathub # Oh my zsh setup + flathub
def zsh_fonts(): def zsh_fonts():
with Progress() as progress: with Progress() as progress:
task = progress.add_task("[cyan]Installing Zhs etc...", total=5) task = progress.add_task("[cyan]Installing Zhs etc...", total=5)
while not progress.finished: while not progress.finished:
@@ -172,9 +164,6 @@ def copy_dotfiles(setup):
def executable_scripts(): def executable_scripts():
pass pass