Skip to content

Commit

Permalink
add -y to apt autoremove to prevent lockup, and fix spinner variable …
Browse files Browse the repository at this point in the history
…on sudo cmds
  • Loading branch information
jessebot committed Nov 6, 2022
1 parent fd54036 commit 3c17ca4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion onboardme/config/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apt:
update: "sudo apt-get update -y"
upgrade: "sudo apt-get upgrade -y"
install: "sudo apt-get install -y "
cleanup: "sudo apt-get autoremove"
cleanup: "sudo apt-get autoremove -y"
packages:
default:
- terminator
Expand Down
20 changes: 8 additions & 12 deletions onboardme/pkg_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
from .subproc import subproc


SPINNER = True


def brew_install_upgrade(package_groups=['default']):
"""
Run the install/upgrade of packages managed by brew, also updates brew
Expand Down Expand Up @@ -101,32 +98,30 @@ def run_pkg_mngrs(pkg_mngrs=[], pkg_groups=[]):
log.debug(f"package manager commands are: {pkg_cmds}")
for pre_cmd in ['setup', 'update', 'upgrade']:
if pre_cmd in pkg_cmds:
print_sub_header(f"{pkg_mngr} [b]{pre_cmd}[/b] step")
if 'sudo' in pre_cmd:
SPINNER = True
if 'sudo' in pkg_cmds[pre_cmd]:
SPINNER = False
subproc([pkg_cmds[pre_cmd]], spinner=SPINNER)
print_msg(f"[b]{pre_cmd}[/b] step Completed.")
print_sub_header(f"[b]{pre_cmd.title()}[/b] completed.")

# list of actually installed packages
installed_pkgs = subproc([pkg_cmds['list']], quiet=True)

for pkg_group in pkg_groups:
if pkg_group in required_pkg_groups:
if pkg_group != 'default':
msg = (f"Installing [i]{pkg_group}[/i] {pkg_emoji} "
f"[b]{pkg_mngr}[/b] packages")
print_sub_header(msg)
# msg = (f"Installing [i]{pkg_group}[/i] packages")
# print_msg(msg)

install_pkg_group(installed_pkgs,
required_pkg_groups[pkg_group],
pkg_cmds['install'])

f_msg = f'[green]{pkg_mngr}[/green] {pkg_group} '
print_msg(f_msg + 'packages installed.')
print_sub_header(f'{pkg_group.title()} packages installed.')

if 'cleanup' in pkg_cmds:
subproc([pkg_cmds['cleanup']])
print_msg("[b]Cleanup[/b] step Completed.")
print_sub_header("[b]Cleanup[/b] step Completed.")
return


Expand All @@ -135,6 +130,7 @@ def install_pkg_group(installed_pkgs=[], pkgs_to_install=[], install_cmd=""):
installs packages if they are not already intalled with intall_cmd
Returns True.
"""
SPINNER = True
install_pkg = False
# the spinner status thing rich provides breaks with input
if 'sudo' in install_cmd:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def readme():
lic_class],
python_requires='>3.10',
keywords='onboardme, onboarding, desktop-setup, setuptools, development',
version='0.14.13_a4',
version='0.14.13_a9',
project_urls={
'Documentation': 'https://jessebot.github.io/onboardme/onboardme',
'Source': 'http://github.com/jessebot/onboardme',
Expand Down

0 comments on commit 3c17ca4

Please sign in to comment.