diff options
author | paulbdavis | 2018-02-20 01:22:12 -0700 |
---|---|---|
committer | paulbdavis | 2018-02-20 01:22:12 -0700 |
commit | 903d56539365c0b93696afebdd30d9d0cd3c35c8 (patch) | |
tree | 438f611985ba95bbc6fd0b1357b244a7d3d14aa5 | |
download | aur-903d56539365c0b93696afebdd30d9d0cd3c35c8.tar.gz |
init
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | PKGBUILD | 17 | ||||
-rw-r--r-- | reposync.sh | 38 |
4 files changed, 74 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..436efed62626 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,14 @@ +pkgbase = reposync + pkgdesc = Wrapper for aursync + pkgver = 0.0.3 + pkgrel = 1 + arch = any + license = MIT + depends = aurutils + depends = sudo + depends = bash + source = reposync.sh + sha256sums = c9bf9ffd6f35c413668f71f9c433eec06ceeac29ffe61f58617791b84a9b89bf + +pkgname = reposync + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..bb5e23f1b778 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.pkg.tar* +/*.bz2 +/pkg +/src +/*.zip diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..c5a042fd9b61 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,17 @@ +# Maintainer: Paul Davis <paul@dangersalad.com> +pkgname=reposync +pkgver=0.0.3 +pkgrel=1 +arch=('any') +license=('MIT') +source=(reposync.sh) +pkgdesc="Wrapper for aursync" +sha256sums=('c9bf9ffd6f35c413668f71f9c433eec06ceeac29ffe61f58617791b84a9b89bf') +depends=('aurutils' 'sudo' 'bash') + +package () { + install -Dm755 $srcdir/reposync.sh $pkgdir/usr/bin/reposync +} + + + diff --git a/reposync.sh b/reposync.sh new file mode 100644 index 000000000000..1e6da1695334 --- /dev/null +++ b/reposync.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Wraps aursync command to mount an amazon s3 bucket which contains a repository + +cfg_name=dangersalad-reposync.config +cfg_file="${DANGERSALAD_REPOSYNC_CONFIG:-/etc/xdg/$cfg_name}" +cfg_file_system="$cfg_file" + +set -uo pipefail +trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR + +if [[ ! -f $cfg_file ]] +then + cfg_file="${XDG_CONFIG_HOME:-$HOME/.config}/$cfg_name" + if [[ ! -f $cfg_file ]] + then + echo "Missing config file $cfg_file_system and $cfg_file" + exit 1 + fi +fi + +source "$cfg_file" + +exit_cmd="" +defer() { exit_cmd="$@; $exit_cmd"; } +trap 'bash -c "$exit_cmd"' EXIT + +repo="$(mktemp -d)" +defer "rmdir '$repo'" + +s3fs "${bucket}" "$repo" -o "nosuid,nodev,default_acl=public-read,url=$bucket_url" +defer "fusermount -u '$repo'" +mkdir -p "$repo/${repo_path}" + +echo "Performing system update" +sudo pacman -Syu + +echo "Performing repository sync" +aursync --sign --repo "$repo_name" --root "$repo/$repo_path" "$@" |