diff options
author | M0Rf30 | 2015-06-17 15:58:06 +0200 |
---|---|---|
committer | M0Rf30 | 2015-06-17 15:58:06 +0200 |
commit | febc4776ce58d1e18409436d832a8696ea6d432e (patch) | |
tree | 2a08f22f67048779dd9a9d676fd644668f1731f7 | |
download | aur-febc4776ce58d1e18409436d832a8696ea6d432e.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | PKGBUILD | 21 | ||||
-rw-r--r-- | unreal.sh | 136 |
3 files changed, 171 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..fc93b02a4b14 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,14 @@ +pkgbase = makepkg-unreal + pkgdesc = Some shell functions to ease the installation of various Unreal games. + pkgver = 0.2 + pkgrel = 1 + url = http://aur.archlinux.org/packages.php?ID=26545 + arch = any + license = custom + depends = xdelta + conflicts = makepkg-lib-unreal + source = unreal.sh + md5sums = e6e0b08d1981f2a8c0c254fc63a71e1e + +pkgname = makepkg-unreal + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..a7a8bde2038a --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,21 @@ +# Maintainer: M0Rf30 +# Contributor: quantax -- contact via Arch Linux forum or AUR + +pkgname=makepkg-unreal +pkgver=0.2 +pkgrel=1 +pkgdesc="Some shell functions to ease the installation of various Unreal games." +arch=(any) +url="http://aur.archlinux.org/packages.php?ID=26545" +license=('custom') # Is a license applicable to this crap at all? +conflicts=(makepkg-lib-unreal) +depends=(xdelta) +source=(unreal.sh) + +package() { + cd "$srcdir" + install --mode=644 -D -- unreal.sh \ + "$pkgdir/usr/lib/makepkg/unreal.sh" +} + +md5sums=('e6e0b08d1981f2a8c0c254fc63a71e1e') diff --git a/unreal.sh b/unreal.sh new file mode 100644 index 000000000000..7b9b8bf35d8a --- /dev/null +++ b/unreal.sh @@ -0,0 +1,136 @@ +# This file provides several functions to ease packaging of Unreal based games +# for Arch Linux. It should be sourced in the PKGBUILD's build() function. +# +# For an example of the usage of the functions take a look at the "ut1999" +# PKGBUILD on the Arch Linux AUR. + +# Usage: _unreal_handle_files command from_dir to_dir ignore_regex < file_list +# +# Tries to find the basename of the files read from standard input in +# "from_dir" case insensitively and applies "command" which has the +# form "cmd source dest" (like cp or mv) to it, where the "dest" is +# "to_dir"/entry from stdin. The files given by the case insensitive +# egrep style regular expression "ignore_regex" won't be searched. You +# probably want to make sure that the target directories already exist. +# +# This function usually doesn't get called directly but by +# _unreal_(copy|install|move)_files with "command" already filled in. +_unreal_handle_files() { + local dir + + while read stdin; do + find -- "$2" -regextype posix-egrep \ + -iname "$(basename -- "${stdin}")" -a ! -iregex "$4" \ + -print | while read file + do + $1 "${file}" "$3/${stdin}" || return 1 + done + done +} + +# Usage: _unreal_copy_files from_dir to_dir ignore_regexp < file_list +# +# Calls _unreal_handle_files with "cp" as command. +_unreal_copy_files() { + _unreal_handle_files "cp --force --" "$@" || return 1 +} + +# Usage: _unreal_install_files from_dir to_dir ignore_regexp < file_list +# +# Basically calls _unreal_handle_files with "install" as command. +_unreal_install_files() { + _unreal_handle_files "install --mode=644 -D --" "$@" || return 1 +} + +# Usage: _unreal_move_files from_dir to_dir ignore_regexp < file_list +# +# Just calls _unreal_handle_files with "mv" as command. +_unreal_move_files() { + _unreal_handle_files "mv --force --" "$@" || return 1 +} + +# Usage: _unreal_decompress_files from_dir to_dir ingore_regex < file_list +# +# Reads a "file_list" from standard input, tries to find their basenames +# in "from_dir" case insensitively and decompresses them with the +# command "to_dir/ucc". The direcories given by the case insensitive +# egrep style regular expression "ignore_dir_regex" won't be searched. +# +# ucc stores the decomressed files in "to_dir/System". So you might +# want to apply the same "file_list" (minus the .uz ending) to +# _unreal_move_files to correct the location. +_unreal_decompress_files() { + while read stdin; do + find -- "$1" -regextype posix-egrep \ + -iname "$(basename -- "${stdin}")" -a ! -iregex "$3" \ + -print | while read file + do + "$2/ucc" decompress "${file}" -nohomedir || return 1 + done + done +} + +# Usage: _unreal_loki_patcher continue_on_fail from_dir to_dir ignore_regex +# +# Apply the Xdelta patches and gzip replacement files residing in the +# parallel directory structure in "from_dir" to the files in "to_dir", +# where files matching the egrep regular expression "ignore_regex" +# will be ignored. If "continue_on_fail" is "true" the function whill +# continue even if a single patch couldn't be applied. If it is "false" +# the function will terminate when only a single patch doesn't apply +# correctly. +# +# This function usually doesn't get called directly but by +# _unreal_fail_{fast,safe}_patcher with "continue_on_fail" already +# filled in. +_unreal_loki_patcher() { + local dest + cd "$2" + mkdir -p xdelta.tmp + + find . -regextype posix-egrep \ + -type f -a ! -iregex ".*/xdelta.tmp/.*" -a ! -iregex "$4" \ + -print | while read file + do + case "$(file -b -- "${file}")" in + (*XDelta*) + dest="$(echo "${file}" | sed 's/\.0$//')" + xdelta patch -- "${file}" "$3/${dest}" \ + "xdelta.tmp/$(basename -- "${dest}")" \ + && install --mode=644 -D -- \ + "xdelta.tmp/$(basename -- "${dest}")" "$3/${dest}" \ + || "$1" || return 1 + ;; + (*gzip*) + gzip --decompress --stdout -- "${file}" > "$3/${file}" \ + || "$1" || return 1 + ;; + (*executable*) + install --mode=755 -D -- "${file}" "$3/${file}" \ + || "$1" || return 1 + ;; + (*) + install --mode=644 -D -- "${file}" "$3/${file}" \ + || "$1" || return 1 + ;; + esac + done + cd - > /dev/null +} + +# Usage: _unreal_fail_safe_patcher from_dir to_dir ignore_regex +# +# Tries to apply the patches found in "form_dir" to "to_dir", but +# doesn't exit if a single patch doesn't apply. +_unreal_fail_safe_patcher() { + _unreal_loki_patcher "true" "$@" || return 1 +} + +# Usage: _unreal_fail_fast_patcher from_dir to_dir ignore_regex +# +# Like _unreal_fail_safe_patcher, but exits if only a single patch +# couldn't be applied successfully. +_unreal_fail_fast_patcher() { + _unreal_loki_patcher "false" "$@" || return 1 +} + |