#!/bin/bash # upgpkg: Upgrades package versions in PKGBUILD and starts build. # Author: Abhishek Dasgupta # Thanks to cactus, profjim and daenyth for all the sed help! # Edited: Florian Pritz # I place this script in the public domain. VERSION=0.6 # from makepkg unset ALL_OFF BOLD BLUE GREEN RED YELLOW if [[ -t 2 ]]; then # prefer terminal safe colored and bold text when tput is supported if tput setaf 0 &>/dev/null; then ALL_OFF="$(tput sgr0)" BOLD="$(tput bold)" BLUE="${BOLD}$(tput setaf 4)" GREEN="${BOLD}$(tput setaf 2)" RED="${BOLD}$(tput setaf 1)" YELLOW="${BOLD}$(tput setaf 3)" else ALL_OFF="\033[1;0m" BOLD="\033[1;1m" BLUE="${BOLD}\033[1;34m" GREEN="${BOLD}\033[1;32m" RED="${BOLD}\033[1;31m" YELLOW="${BOLD}\033[1;33m" fi fi readonly ALL_OFF BOLD BLUE GREEN RED YELLOW die() { local message="$1" shift printf "$RED==> $(gettext "Error"):$ALL_OFF $(gettext "$message")\n" "$@" exit 1 } warn() { local message="$1" shift printf "$YELLOW==> $(gettext "Warning"):$ALL_OFF $(gettext "$message")\n" "$@" } scriptlet() { if [ -f "upgpkg" ]; then if [[ $(type -t upgpkg_$1) = "function" ]]; then upgpkg_$1 || die "\"%s\" scriptlet failed" $1 fi fi } help() { echo "upgpkg $VERSION" printf "$(gettext "usage: upgpkg [options] newver")\n" printf "$(gettext " -h this help")\n" printf "$(gettext " -g generate a template ./upgpkg file")\n" exit 2 } if [ -z "$1" ]; then help fi _newpkgver=$1 while getopts "gh" OPTION; do case $OPTION in g) cat > upgpkg <