upp to zsh works
This commit is contained in:
@@ -15,7 +15,6 @@ console = Console(theme=ap_theme)
|
|||||||
def main():
|
def main():
|
||||||
|
|
||||||
setup = 'z'
|
setup = 'z'
|
||||||
|
|
||||||
sudo_check()
|
sudo_check()
|
||||||
|
|
||||||
|
|
||||||
@@ -26,7 +25,6 @@ def main():
|
|||||||
os.system('xrandr -s 1920x1080')
|
os.system('xrandr -s 1920x1080')
|
||||||
except Exception():
|
except Exception():
|
||||||
print(Exception())
|
print(Exception())
|
||||||
pass
|
|
||||||
|
|
||||||
console.print('optimizing dnf.conf', style='ok')
|
console.print('optimizing dnf.conf', style='ok')
|
||||||
dnf_config()
|
dnf_config()
|
||||||
@@ -42,7 +40,7 @@ def main():
|
|||||||
console.print('Set up dotfiles for Desktop (D) or Laptop (L) ?', style='promp')
|
console.print('Set up dotfiles for Desktop (D) or Laptop (L) ?', style='promp')
|
||||||
setup = input('>').lower()
|
setup = input('>').lower()
|
||||||
if setup == 'l' or setup == 'd':
|
if setup == 'l' or setup == 'd':
|
||||||
copy_dotfile(setup)
|
copy_dotfiles(setup)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
@@ -61,6 +59,9 @@ def dnf_config():
|
|||||||
else:
|
else:
|
||||||
console.print(' dnf.conf already optimized :heavy_check_mark:', style='checkt')
|
console.print(' dnf.conf already optimized :heavy_check_mark:', style='checkt')
|
||||||
|
|
||||||
|
subprocess.check_call('sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm', shell=True)
|
||||||
|
subprocess.check_call('sudo dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm', shell=True)
|
||||||
|
console.print('rpmfusion added to repos :heavy_check_mark:', style='ok')
|
||||||
|
|
||||||
# install programs dnf
|
# install programs dnf
|
||||||
def install_programs_dnf():
|
def install_programs_dnf():
|
||||||
@@ -74,7 +75,6 @@ def install_programs_dnf():
|
|||||||
subprocess.check_call(['dnf', 'install', '-y', *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
|
||||||
@@ -86,15 +86,15 @@ def pip_modules(modules):
|
|||||||
for module in modules:
|
for module in modules:
|
||||||
try:
|
try:
|
||||||
importlib.import_module(module)
|
importlib.import_module(module)
|
||||||
except importerror:
|
except Importerror:
|
||||||
missing_modules.append(module)
|
missing_modules.append(module)
|
||||||
if missing_modules:
|
if missing_modules:
|
||||||
console.print(f"the following modules are missing: {', '.join(missing_modules)}", style='checkt')
|
console.print(f"the following modules are missing: {', '.join(missing_modules)}", style='checkt')
|
||||||
install_pip_modules(missing_modules)
|
install_pip_modules(missing_modules)
|
||||||
return false
|
return False
|
||||||
else:
|
else:
|
||||||
console.print("all modules are installed. :heavy_check_mark:", style='ok')
|
console.print("all modules are installed. :heavy_check_mark:", style='ok')
|
||||||
return true
|
return True
|
||||||
|
|
||||||
## checks for sudo
|
## checks for sudo
|
||||||
def sudo_check():
|
def sudo_check():
|
||||||
@@ -136,10 +136,10 @@ def zsh_fonts():
|
|||||||
subprocess.run('flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo', shell=True)
|
subprocess.run('flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo', shell=True)
|
||||||
progress.update(task, advance=1)
|
progress.update(task, advance=1)
|
||||||
|
|
||||||
|
# copy and override dotfiles
|
||||||
def copy_dotfiles(setup):
|
def copy_dotfiles(setup):
|
||||||
|
|
||||||
home = os.path.expanduser("~")
|
home = os.path.expanduser("~")
|
||||||
dotfiles_dir = os.getcwd()
|
|
||||||
|
|
||||||
# list of relevant configs
|
# list of relevant configs
|
||||||
lis = list(next(os.walk('.'))[1])
|
lis = list(next(os.walk('.'))[1])
|
||||||
@@ -155,21 +155,17 @@ def copy_dotfiles(setup):
|
|||||||
if ('.zshrc' in lis) :
|
if ('.zshrc' in lis) :
|
||||||
lis.remove('.zshrc')
|
lis.remove('.zshrc')
|
||||||
|
|
||||||
|
|
||||||
|
dotfiles_dir = os.getcwd()
|
||||||
destination = os.path.join(home,'.config')
|
destination = os.path.join(home,'.config')
|
||||||
|
|
||||||
# copying files recusrsively
|
# copying files recusrsively
|
||||||
for dir in lis:
|
for dir in lis:
|
||||||
source = os.path.join(home, 'repos/dotfiles', dir)
|
|
||||||
print(subprocess.run(f'cp -r {dotfiles_dir} {destination}', shell=True))
|
print(subprocess.run(f'cp -r {dotfiles_dir} {destination}', shell=True))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def executable_scripts():
|
def executable_scripts():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user