Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- #
- # Download, build and install an Archlinux's aur package
- #
- # Usage: $ aurinstall PACKAGE_SNAPSHOT_URL
- #
- set -o nounset
- set -o errexit
- declare -r AUR_BUILDS_DIR=$HOME/.aur_builds
- function usage() {
- echo "Usage: $0 PACKAGE_SNAPSHOT_URL"
- }
- function _check_required_programs() {
- required=(tar wget makepkg)
- for p in ${required[@]}; do
- hash "${p}" 2>&- || \
- {
- echo >&2 " Required program \"${p}\" not installed or in search PATH.";
- exit 1;
- }
- done
- }
- function main() {
- if [[ $# -ne 1 ]] ; then
- usage;
- exit 1;
- fi
- local package_url=$1
- _check_required_programs
- mkdir -p $AUR_BUILDS_DIR
- cd $AUR_BUILDS_DIR
- # 1. Fetch snapshot
- # -nc skip if file exists
- wget -nc $package_url
- # 2. Extract files
- tar -xvf $(basename "$package_url")
- extracted_dir=`tar -xvf $(basename "$package_url") | head -1 | cut -f1 -d"/"`
- cd $extracted_dir
- # 3. Build and install
- # -i install, -s syncdeps, -L log, --noconfirm skip pacman confirmation
- makepkg -isL --noconfirm
- }
- main "$@"
Add Comment
Please, Sign In to add comment