Skip to content

Instantly share code, notes, and snippets.

@rochacon
Created April 10, 2015 05:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rochacon/797b9590093846b8ea28 to your computer and use it in GitHub Desktop.
Save rochacon/797b9590093846b8ea28 to your computer and use it in GitHub Desktop.
AUR Sync

aur-sync is a simple script to keep AUR packages up to date.

How to use it:

# 1. First you need to create some directories where the work will happen:
mkdir -p /tmp/aur-sync-ws
mkdir -p /tmp/aur-sync-ws/build
mkdir -p /tmp/aur-sync-ws/src
cd /tmp/aur-sync-ws

# 2. Write the AUR packages to be synced to a file
cat > aur-packages <<EOF
playerctl
telegram-bin
EOF

# 3. Run the aur-sync.sh script passing it the aur-packages file
./aur-sync.sh aur-packages

# The script will download, extract, build and install the latest version of those packages.
# Note: sudo password and pacman confirmation are required for each package update.
chromium-pepper-flash
dropbox-cli
dropbox
google-talkplugin
libgcrypt15
playerctl
spotify
telegram-bin
#!/bin/bash
set -eux
root_dir="$PWD"
PKGS=$(cat "${1:-aur-packages}")
for pkg in $PKGS; do
# Return to root_dir
cd "$root_dir"
# Download package
src_file="src/${pkg}.tar.gz"
wget -O "$src_file" "https://aur.archlinux.org/packages/${pkg:0:2}/${pkg}/${pkg}.tar.gz"
# Extract it to build folder
build_dir="build/${pkg}"
if [ -d "$build_dir" ]; then
echo "Cleaning build dir: ${build_dir}"
rm -r "$build_dir"
fi
tar xvzf "$src_file" -C "build/"
# Build package
cd "$build_dir"
makepkg
# Install package
sudo pacman -U ${pkg}*.pkg.tar.xz
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment