1
0
Fork 0
mirror of https://codeberg.org/Mo8it/dotfiles.git synced 2024-10-17 20:52:40 +00:00

Remove update script

This commit is contained in:
Mo 2023-06-25 22:27:35 +02:00
parent 72b56e7713
commit 6c0788e091
2 changed files with 10 additions and 82 deletions

View file

@ -9,50 +9,42 @@ layout {
tab name="update" split_direction="horizontal" focus=true {
pane split_direction="vertical" {
pane {
command "fish"
args "-c" "~/.scripts/update.py rpm-ostree"
close_on_exit true
command "rpm-ostree"
args "upgrade"
}
pane {
focus true
command "fish"
args "-c" "~/.scripts/update.py flatpak"
close_on_exit true
args "-c" "flatpak update -y && flatpak --delete-data --unused"
}
}
pane split_direction="vertical" {
pane {
command "fish"
args "-c" "~/.scripts/update.py cargo"
close_on_exit true
args "-c" "rustup update stable && cargo install-update -a"
}
pane {
cwd "/home/mo/code/compile/helix"
command "fish"
args "-c" "git pull -r && cargo +stable install --path helix-term"
close_on_exit true
}
}
pane split_direction="vertical" {
pane {
cwd "/home/mo/servers/ansible"
command "fish"
args "-c" "ansible-playbook playbooks/update_dnf.yaml; read -P Enter"
close_on_exit true
command "ansible-playbook"
args "playbooks/update_dnf.yaml"
}
pane {
cwd "/home/mo/servers/ansible"
command "fish"
args "-c" "ansible-playbook playbooks/update_apt.yaml; read -P Enter"
close_on_exit true
command "ansible-playbook"
args "playbooks/update_apt.yaml"
}
pane {
cwd "/home/mo/servers/ansible"
command "fish"
args "-c" "ansible-playbook playbooks/update_local.yaml"
close_on_exit true
command "pipx"
args "upgrade-all"
}
}
}

View file

@ -1,64 +0,0 @@
#!/usr/bin/env python3
import subprocess
from getpass import getpass
from sys import argv
def run(command, **kwargs):
return subprocess.run(command, shell=True, **kwargs)
def cap_live_lines(command, **kwargs):
lines = []
with subprocess.Popen(
command, shell=True, stdout=subprocess.PIPE, text=True, **kwargs
) as proc:
for line in proc.stdout:
print(line, end="")
lines.append(line.strip())
return lines
def press_to_exit():
getpass("\n<<-<>===EXIT===<>->>")
def update_rpm_ostree():
lines = cap_live_lines("rpm-ostree upgrade")
if "no upgrade" not in lines[-1].lower():
press_to_exit()
def update_flatpak():
lines = cap_live_lines("flatpak update -y")
done_updates = "nothing to do" not in lines[-1].lower()
run("flatpak remove --delete-data --unused")
if done_updates:
press_to_exit()
def update_cargo():
lines = cap_live_lines("rustup update stable && cargo install-update -a")
if "no packages need updating" not in lines[-2].lower():
press_to_exit()
def main(input):
if input == "rpm-ostree":
update_rpm_ostree()
elif input == "flatpak":
update_flatpak()
elif input == "cargo":
update_cargo()
else:
print(f"Input {input} not valid!")
if __name__ == "__main__":
main(argv[1])