summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-07-02 13:55:07 +0200
committerDaniel Weipert <code@drogueronin.de>2023-10-30 09:52:23 +0100
commit0bfd764305eb955cda01043cf87e30c331085e9e (patch)
treef792a3962aae366e8ceca3241fb528f3f9706f29
parente0a40bd0535903f39dc51e18202d080e7bdf6f02 (diff)
[system] require interaction with update script
-rwxr-xr-x.local/bin/update30
1 files changed, 14 insertions, 16 deletions
diff --git a/.local/bin/update b/.local/bin/update
index 01dd987..fc02143 100755
--- a/.local/bin/update
+++ b/.local/bin/update
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
"""
+nvim '+PlugUpdate'
sudo pacman -Syu
+aur sync -unr
nix-channel --update && nix-env -u
-nvim '+PlugUpdate' '+PlugClean!' '+PlugUpdate' '+qall' > /dev/null 2>&1
-aur sync -unr # requires interactivity
"""
import sys, os
@@ -13,7 +13,7 @@ from time import localtime, strftime
def log(message: str):
- print(f'[{strftime("%Y-%m-%d %H:%M:%S", localtime())}] {message}')
+ print(f'[{strftime("%H:%M:%S", localtime())}] {message}')
lock_file = 'update.lock'
@@ -23,23 +23,21 @@ if os.path.exists(lock_file):
open(lock_file, 'a').close()
-log('Starting pacman process...')
-pacman_process = subprocess.Popen(['sudo', 'pacman', '-Syu', '--confirm'], stdout=subprocess.DEVNULL)
-log('Starting nix process...')
-nix_process = subprocess.Popen(['nix-channel', '--update'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+log('Running `nvim \'+PlugUpdate\'`...')
+subprocess.run(['nvim', '+PlugUpdate'])
-log('Starting nvim process...')
-nvim_process = subprocess.Popen(['nvim', '+PlugUpdate', '+PlugClean!', '+PlugUpdate!', '+qall'], stdout=subprocess.DEVNULL)
+log('Running `sudo pacman -Syu`...')
+subprocess.run(['sudo', 'pacman', '-Syu'])
-nix_process.wait()
-log('nix process done. Calling nix-env...')
-nix_env_process = subprocess.Popen(['nix-env', '-u'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
-
-pacman_process.wait()
-log('pacman process done. Calling aur sync...')
+log('Running `aur sync -unr`...')
subprocess.run(['aur', 'sync', '-unr'])
-nix_env_process.wait()
+log('Running `nix-channel --update`...')
+subprocess.run(['nix-channel', '--update'])
+
+log('Running `nix-env -u`...')
+subprocess.run(['nix-env', '-u'])
+
log('Cleaning up...')
os.remove(lock_file)