summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Davis2018-07-17 21:55:22 +0100
committerJoe Davis2018-07-17 21:55:22 +0100
commit970316572cf6adbcca90fde821874f2b1f1f50c0 (patch)
tree621e3e68d668391fa055e399aa9b25c939236eb9
downloadaur-970316572cf6adbcca90fde821874f2b1f1f50c0.tar.gz
initial commit
-rw-r--r--.SRCINFO13
-rw-r--r--PKGBUILD15
-rw-r--r--faur.134
-rwxr-xr-xfaur.sh79
4 files changed, 141 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..b0aaf8ee6fa8
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,13 @@
+pkgbase = faur
+ pkgver = 0.1
+ pkgrel = 1
+ arch = any
+ license = custom:ISC
+ depends = git
+ source = faur.1
+ source = faur.sh
+ md5sums = a01b73f1e9abd471e53b11440f94f492
+ md5sums = 72c778c3c8a782673e4971bfcaa28819
+
+pkgname = faur
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..997cd4c7217c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,15 @@
+# Maintainer: Joe Davis <me@jo.ie>
+pkgname='faur'
+pkgver='0.1'
+pkgrel='1'
+arch=('any')
+license=('custom:ISC')
+depends=('git')
+source=('faur.1'
+ 'faur.sh')
+md5sums=('a01b73f1e9abd471e53b11440f94f492'
+ '72c778c3c8a782673e4971bfcaa28819')
+
+package() {
+ install -D -m 755 "$srcdir/$pkgname.sh" "$pkgdir/usr/bin/$pkgname"
+}
diff --git a/faur.1 b/faur.1
new file mode 100644
index 000000000000..449d069f1ba8
--- /dev/null
+++ b/faur.1
@@ -0,0 +1,34 @@
+.\" Automatically generated by Pandoc 2.2.2
+.\"
+.TH "FAUR" "1" "July 17, 2018" "\- faur\-0.1" ""
+.hy
+.SH NAME
+.PP
+faur \- lightweight, opinionated AUR helper
+.SH SYNOPSIS
+.PP
+faur fetch [\f[I]pkgs\f[]]\&...
+.PP
+faur update
+.PP
+faur help
+.SH DESCRIPTION
+.PP
+faur downloads packages to the directory specified in $AURDIR.
+If $AURDIR is unset $HOME/aur is used as a default.
+Packages are cloned from the git repository located under $AUR_PATH, if
+unset https://aur.archlinux.org/ is used as a default value.
+.PP
+The update command checks to see which if any of the packages underneath
+$AURDIR need to be updated and notifies the user.
+.SH DEPENDENCY MANAGEMENT
+.PP
+faur \f[I]does not\f[] attempt to resolve dependencies, as doing so
+would discourage the user from reading PKGBUILD files before
+installation.
+.PP
+Users should bear in mind that the AUR is an \f[I]untrusted\f[] source
+of packages and always exercise caution when installing packages from
+it.
+.SH AUTHORS
+Joe Davis <me@jo.ie>.
diff --git a/faur.sh b/faur.sh
new file mode 100755
index 000000000000..bf6a6b49ce96
--- /dev/null
+++ b/faur.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+# Copyright (c) 2018, Joe Davis <me@jo.ie>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+set -e
+
+AURDIR=${AURDIR:-$HOME/aur}
+AUR_PATH=${AUR_PATH:-https://aur.archlinux.org/}
+
+PROG=$(basename "$0")
+
+usage() {
+ printf 'USAGE: %s fetch [pkg...]\n' "$PROG" 2>&1
+ printf ' %s update\n' "$PROG" 2>&1
+ printf ' %s help\n' "$PROG" 2>&1
+ exit $1
+}
+
+update() {
+ printf "The following packages need updating: "
+ none="none found"
+
+ for pkg in $*; do
+ out=$(cd "$pkg" && git pull)
+ if [ "$out" != "Already up to date." ]; then
+ none=''
+ printf '\n %s' "$pkg"
+ fi
+ done
+ echo $none
+}
+
+fetch() {
+ while [ $# -gt 0 ]; do
+ git clone "${AUR_PATH}$1.git"
+ shift
+ done
+}
+
+if [ $# -eq 0 ]; then
+ usage 1
+fi
+
+if [ "$1" = "help" ]; then
+ usage 0
+fi
+
+cd "$AURDIR"
+
+if [ "$1" = "fetch" ]; then
+ shift
+ if [ $# -eq 0 ]; then
+ usage 1
+ fi
+ fetch $*
+elif [ "$1" = "update" ]; then
+ # Skip folders containing spaces, newlines and those beginning with '.'
+ # This avoids problems with for loops over find output
+ PKGS=$(find . -maxdepth 1 \
+ ! -name ".*" \
+ ! -name "* *" ! -name "$(printf "*\\n*")" \
+ -type d)
+ update $PKGS
+else
+ echo "Unknown command: $1" 2>&1
+ usage
+ exit 1
+fi