various fixes
This commit is contained in:
@@ -152,7 +152,7 @@ The script pulls the latest CoreDesktop, then runs each step in ~/.local/share/c
|
|||||||
- updates the Arch keyring, then Arch and GNOME, then AUR packages, Flatpaks, Ruby, GNOME extensions and firmware
|
- updates the Arch keyring, then Arch and GNOME, then AUR packages, Flatpaks, Ruby, GNOME extensions and firmware
|
||||||
- warns you not to reboot if the initramfs failed to rebuild
|
- warns you not to reboot if the initramfs failed to rebuild
|
||||||
- runs any one-time migrations, the way existing machines pick up new CoreDesktop setup
|
- runs any one-time migrations, the way existing machines pick up new CoreDesktop setup
|
||||||
- lists packages that are no longer needed, and the command to remove them
|
- removes packages that were installed only because something else needed them, and are no longer needed by anything. It lists what it removed. To stop a package you use directly from being removed, run `sudo pacman -D --asexplicit <package>`
|
||||||
|
|
||||||
If a step fails, the other steps still run, and the failed ones are listed at the end.
|
If a step fails, the other steps still run, and the failed ones are listed at the end.
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ if command -v paccache &>/dev/null; then
|
|||||||
sudo paccache -ruk0
|
sudo paccache -ruk0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Report packages that were installed as dependencies and are no longer needed.
|
# Remove packages that were installed as dependencies and are no longer needed
|
||||||
# Not removed automatically: some may be tools you use directly.
|
# (packages something lists as an optional dependency are kept). To keep one
|
||||||
ORPHANS="$(pacman -Qtdq 2>/dev/null)"
|
# you use directly: sudo pacman -D --asexplicit <package>
|
||||||
if [ -n "$ORPHANS" ]; then
|
mapfile -t ORPHANS < <(pacman -Qtdq 2>/dev/null)
|
||||||
echo "Packages no longer needed by anything:"
|
if (( ${#ORPHANS[@]} > 0 )); then
|
||||||
echo "$ORPHANS" | sed 's/^/ /'
|
echo "Removing packages no longer needed by anything:"
|
||||||
echo "To remove them: sudo pacman -Rns \$(pacman -Qtdq)"
|
printf ' %s\n' "${ORPHANS[@]}"
|
||||||
|
sudo pacman -Rns --noconfirm "${ORPHANS[@]}" || exit 1
|
||||||
|
echo "To get one of these back, reinstall it with: sudo pacman -S <package>"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -118,7 +118,14 @@ PACMAN_UPDATE_LOG="$HOME/.local/state/coredesktop/pacman-update.log"
|
|||||||
initramfs_build_failed() {
|
initramfs_build_failed() {
|
||||||
[ -f "$PACMAN_UPDATE_LOG" ] || return 1
|
[ -f "$PACMAN_UPDATE_LOG" ] || return 1
|
||||||
grep -q "Updating linux initcpios" "$PACMAN_UPDATE_LOG" || return 1
|
grep -q "Updating linux initcpios" "$PACMAN_UPDATE_LOG" || return 1
|
||||||
grep -q "==> ERROR" "$PACMAN_UPDATE_LOG" || ! grep -q "Image generation successful" "$PACMAN_UPDATE_LOG"
|
grep -q "==> ERROR" "$PACMAN_UPDATE_LOG" && return 0
|
||||||
|
|
||||||
|
# Every image built must report success. Older mkinitcpio says "==> Image
|
||||||
|
# generation successful", newer says "==> Initcpio image generation successful".
|
||||||
|
local built succeeded
|
||||||
|
built="$(grep -c "==> Building image from preset" "$PACMAN_UPDATE_LOG")"
|
||||||
|
succeeded="$(grep -cE "==> (Initcpio i|I)mage generation successful" "$PACMAN_UPDATE_LOG")"
|
||||||
|
(( succeeded == 0 || succeeded < built ))
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install a script atomically (copy to a temp file, then rename over the target)
|
# Install a script atomically (copy to a temp file, then rename over the target)
|
||||||
|
|||||||
Reference in New Issue
Block a user