change to update format
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
MINISERVER="$HOME/.local/share/MiniServer"
|
||||
|
||||
source "$MINISERVER/utils.sh"
|
||||
source "$MINISERVER/packages.conf"
|
||||
|
||||
STATUS=0
|
||||
|
||||
# A machine that hasn't updated in a while can have a keyring too old to verify
|
||||
# the new packages. Update it first; the -Su below completes this -Sy.
|
||||
echo "Updating Arch keyring..."
|
||||
sudo pacman -Sy --needed --noconfirm archlinux-keyring || STATUS=1
|
||||
|
||||
# script(1) keeps pacman's progress bars while logging its output for the
|
||||
# initramfs check
|
||||
echo "Updating Arch..."
|
||||
mkdir -p "$(dirname "$PACMAN_UPDATE_LOG")"
|
||||
: > "$PACMAN_UPDATE_LOG"
|
||||
sudo script -qefc "pacman -Su --noconfirm" "$PACMAN_UPDATE_LOG" || STATUS=1
|
||||
|
||||
if initramfs_build_failed; then
|
||||
echo -e "\e[31mRebuilding the initramfs failed. Don't reboot until it's fixed - see the output above or $PACMAN_UPDATE_LOG.\e[0m"
|
||||
STATUS=1
|
||||
fi
|
||||
|
||||
echo "Checking for new packages..."
|
||||
install_packages "${SERVERS[@]}"
|
||||
install_packages "${UTILITIES[@]}"
|
||||
|
||||
exit $STATUS
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Updating AUR..."
|
||||
|
||||
YAY_FLAGS="--noconfirm --answerdiff=None --answeredit=None --answerclean=None"
|
||||
|
||||
# Only rebuild yay when yay itself is broken (e.g. a pacman upgrade bumped
|
||||
# libalpm). A failing AUR package is not fixed by a rebuild, so let that error
|
||||
# show and fail the hook instead.
|
||||
if ! yay --version &>/dev/null; then
|
||||
echo "yay is broken (likely a libalpm bump). Rebuilding yay..."
|
||||
sudo pacman -R --noconfirm yay
|
||||
cd /tmp
|
||||
rm -rf yay
|
||||
git clone https://aur.archlinux.org/yay.git
|
||||
cd yay
|
||||
makepkg -si --noconfirm
|
||||
cd ..
|
||||
rm -rf yay
|
||||
cd
|
||||
fi
|
||||
|
||||
yay -Sua $YAY_FLAGS
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# pm2 is installed by install.sh with npm into ~/.local
|
||||
is_installed() {
|
||||
[ -x "$HOME/.local/bin/pm2" ]
|
||||
}
|
||||
|
||||
run_update() {
|
||||
echo "Updating pm2..."
|
||||
npm update -g pm2 --prefix "$HOME/.local"
|
||||
}
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Sibling projects installed with the `sibling` command
|
||||
SIBLINGS="$HOME/.local/share/siblings"
|
||||
|
||||
is_installed() {
|
||||
compgen -G "$SIBLINGS/*/.git" > /dev/null
|
||||
}
|
||||
|
||||
run_update() {
|
||||
echo "Updating sibling projects..."
|
||||
local dir name failed=0
|
||||
for dir in "$SIBLINGS"/*/; do
|
||||
[ -d "$dir/.git" ] || continue
|
||||
name="$(basename "$dir")"
|
||||
echo " $name"
|
||||
if ! git -C "$dir" pull --ff-only --quiet; then
|
||||
echo " Could not pull $name."
|
||||
failed=1
|
||||
continue
|
||||
fi
|
||||
if [ -f "$dir/update.sh" ]; then
|
||||
(cd "$dir" && bash update.sh) || { echo " $name's update.sh failed."; failed=1; }
|
||||
fi
|
||||
done
|
||||
return $failed
|
||||
}
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if command -v paccache &>/dev/null; then
|
||||
echo "Trimming pacman package cache..."
|
||||
sudo paccache -rk2
|
||||
sudo paccache -ruk0
|
||||
fi
|
||||
|
||||
# Report packages that were installed as dependencies and are no longer needed.
|
||||
# Not removed automatically: some may be tools you use directly.
|
||||
ORPHANS="$(pacman -Qtdq 2>/dev/null)"
|
||||
if [ -n "$ORPHANS" ]; then
|
||||
echo "Packages no longer needed by anything:"
|
||||
echo "$ORPHANS" | sed 's/^/ /'
|
||||
echo "To remove them: sudo pacman -Rns \$(pacman -Qtdq)"
|
||||
fi
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$HOME/.local/share/MiniServer/utils.sh"
|
||||
|
||||
if initramfs_build_failed; then
|
||||
echo -e "\e[31mDon't reboot yet: the initramfs failed to rebuild (see $PACMAN_UPDATE_LOG).\e[0m"
|
||||
# If the running kernel's modules are gone, a newer kernel was installed
|
||||
elif [ ! -d "/usr/lib/modules/$(uname -r)" ]; then
|
||||
echo "A newer kernel has been installed. Please reboot when convenient."
|
||||
fi
|
||||
Reference in New Issue
Block a user