From 9b1ef262bcc8d47a6d20b4efc673557560df6647 Mon Sep 17 00:00:00 2001 From: deimosian Date: Fri, 7 Apr 2023 11:43:45 +0000 Subject: feat(archlinux): unify `upgrade` function (#11597) Co-authored-by: Carlo Sala --- plugins/archlinux/archlinux.plugin.zsh | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'plugins/archlinux/archlinux.plugin.zsh') diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 4f1364779..e3b1b1261 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -23,7 +23,6 @@ alias pacfiles='pacman -F' alias pacls='pacman -Ql' alias pacown='pacman -Qo' alias pacupd="sudo pacman -Sy" -alias upgrade='sudo pacman -Syu' function paclist() { # Based on https://bbs.archlinux.org/viewtopic.php?id=93683 @@ -109,7 +108,6 @@ if (( $+commands[aura] )); then alias auupd="sudo aura -Sy" alias auupg='sudo sh -c "aura -Syu && aura -Au"' alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"' - alias upgrade='sudo aura -Syu' # extra bonus specially for aura alias auown="aura -Qqo" @@ -136,7 +134,6 @@ if (( $+commands[pacaur] )); then alias painsd='pacaur -S --asdeps' alias pamir='pacaur -Syy' alias paupd="pacaur -Sy" - alias upgrade='pacaur -Syu' fi if (( $+commands[trizen] )); then @@ -158,7 +155,6 @@ if (( $+commands[trizen] )); then alias trinsd='trizen -S --asdeps' alias trmir='trizen -Syy' alias trupd="trizen -Sy" - alias upgrade='trizen -Syu' fi if (( $+commands[yay] )); then @@ -180,5 +176,30 @@ if (( $+commands[yay] )); then alias yainsd='yay -S --asdeps' alias yamir='yay -Syy' alias yaupd="yay -Sy" - alias upgrade='yay -Syu' fi + +# Check Arch Linux PGP Keyring before System Upgrade to prevent failure. +function upgrade() { + echo "[oh-my-zsh] Checking Arch Linux PGP Keyring" + local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')" + local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')" + if [ $installedver != $currentver ]; then + echo "[oh-my-zsh] Arch Linux PGP Keyring is out of date." + echo "[oh-my-zsh] Updating before full system upgrade." + sudo pacman -Syu --needed --noconfirm archlinux-keyring + else + echo "[oh-my-zsh] Arch Linux PGP Keyring is up to date." + fi + echo "[oh-mh-zsh] Proceeding with full system upgrade." + if (( $+commands[yay] )); then + yay -Syu + elif (( $+commands[trizen] )); then + trizen -Syu + elif (( $+commands[pacaur] )); then + pacaur -Syu + elif (( $+commands[aura] )); then + sudo aura -Syu + else + sudo pacman -Syu + fi +} -- cgit v1.2.3-70-g09d2 From 90ec2d1a68049d8b7e57b87c3661d8cacf54655c Mon Sep 17 00:00:00 2001 From: deimosian Date: Sun, 9 Apr 2023 04:24:55 -0400 Subject: fix(archlinux): keyring update function (#11607) --- plugins/archlinux/archlinux.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/archlinux/archlinux.plugin.zsh') diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index e3b1b1261..ce7bfdf23 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -186,7 +186,7 @@ function upgrade() { if [ $installedver != $currentver ]; then echo "[oh-my-zsh] Arch Linux PGP Keyring is out of date." echo "[oh-my-zsh] Updating before full system upgrade." - sudo pacman -Syu --needed --noconfirm archlinux-keyring + sudo pacman -Sy --needed --noconfirm archlinux-keyring else echo "[oh-my-zsh] Arch Linux PGP Keyring is up to date." fi -- cgit v1.2.3-70-g09d2 From 4586808f86bf3bfdf97685380472b63597ce43c0 Mon Sep 17 00:00:00 2001 From: deimosian Date: Sun, 9 Apr 2023 06:58:38 -0400 Subject: feat(archlinux): improve update function messages (#11608) --- plugins/archlinux/archlinux.plugin.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/archlinux/archlinux.plugin.zsh') diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index ce7bfdf23..da170f488 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -180,17 +180,17 @@ fi # Check Arch Linux PGP Keyring before System Upgrade to prevent failure. function upgrade() { - echo "[oh-my-zsh] Checking Arch Linux PGP Keyring" + echo ":: Checking Arch Linux PGP Keyring..." local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')" local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')" if [ $installedver != $currentver ]; then - echo "[oh-my-zsh] Arch Linux PGP Keyring is out of date." - echo "[oh-my-zsh] Updating before full system upgrade." + echo " Arch Linux PGP Keyring is out of date." + echo " Updating before full system upgrade." sudo pacman -Sy --needed --noconfirm archlinux-keyring else - echo "[oh-my-zsh] Arch Linux PGP Keyring is up to date." + echo " Arch Linux PGP Keyring is up to date." + echo " Proceeding with full system upgrade." fi - echo "[oh-mh-zsh] Proceeding with full system upgrade." if (( $+commands[yay] )); then yay -Syu elif (( $+commands[trizen] )); then -- cgit v1.2.3-70-g09d2 From 5901f30b44fc5a3055e6b801d3d71af6d2359ee8 Mon Sep 17 00:00:00 2001 From: WH-2099 Date: Thu, 25 May 2023 18:43:01 +0800 Subject: feat(archlinux): optimize `paclist` and `pacdisowned` (#11398) Co-authored-by: ratijas --- plugins/archlinux/README.md | 1 + plugins/archlinux/archlinux.plugin.zsh | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'plugins/archlinux/archlinux.plugin.zsh') diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index fd772c61a..5e015dbaa 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -181,3 +181,4 @@ whether the package manager is installed, checked in the following order: - Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info - Jeff M. Hubbard - jeffmhubbard@gmail.com - K. Harishankar(harishnkr) - hari2menon1234@gmail.com +- WH-2099 - wh2099@outlook.com \ No newline at end of file diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index da170f488..796ff7adf 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -25,27 +25,28 @@ alias pacown='pacman -Qo' alias pacupd="sudo pacman -Sy" function paclist() { - # Based on https://bbs.archlinux.org/viewtopic.php?id=93683 - pacman -Qqe | \ - xargs -I '{}' \ - expac "${bold_color}% 20n ${fg_no_bold[white]}%d${reset_color}" '{}' + local pkgs=$(LC_ALL=C pacman -Qqe) + for pkg in ${(f)pkgs}; do + pacman -Qs --color=auto "^${pkg}\$" || break + done } function pacdisowned() { - local tmp db fs - tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ - db=$tmp/db - fs=$tmp/fs + local tmp_dir db fs + tmp_dir=$(mktemp --directory) + db=$tmp_dir/db + fs=$tmp_dir/fs - mkdir "$tmp" - trap 'rm -rf "$tmp"' EXIT + trap "rm -rf $tmp_dir" EXIT pacman -Qlq | sort -u > "$db" - find /bin /etc /lib /sbin /usr ! -name lost+found \ + find /etc /usr ! -name lost+found \ \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" comm -23 "$fs" "$db" + + rm -rf $tmp_dir } alias pacmanallkeys='sudo pacman-key --refresh-keys' -- cgit v1.2.3-70-g09d2 From c0e811c90df387eca4223c7d4dbb3f2d32a684c7 Mon Sep 17 00:00:00 2001 From: WH-2099 Date: Mon, 19 Jun 2023 18:32:37 +0800 Subject: perf(archlinux): improve `paclist` performance (#11764) --- plugins/archlinux/archlinux.plugin.zsh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'plugins/archlinux/archlinux.plugin.zsh') diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 796ff7adf..fca6548c0 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -25,10 +25,7 @@ alias pacown='pacman -Qo' alias pacupd="sudo pacman -Sy" function paclist() { - local pkgs=$(LC_ALL=C pacman -Qqe) - for pkg in ${(f)pkgs}; do - pacman -Qs --color=auto "^${pkg}\$" || break - done + pacman -Qqe | xargs -I{} -P0 --no-run-if-empty pacman -Qs --color=auto "^{}\$" } function pacdisowned() { -- cgit v1.2.3-70-g09d2