initial commit
This commit is contained in:
commit
ce4fcbd465
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*~
|
||||
.DS_Store
|
||||
*.pkg.tar.zst
|
||||
*.pkg.tar.zst.sig
|
20
PKGBUILD
Normal file
20
PKGBUILD
Normal file
@ -0,0 +1,20 @@
|
||||
# Maintainer: Sebastian Hugentobler <shu@vanwa.ch>
|
||||
|
||||
pkgname=aur-update
|
||||
pkgver=0.1.0
|
||||
pkgrel=1
|
||||
pkgdesc="Simple updater for local aur repositories."
|
||||
arch=("any")
|
||||
url="https://code.vanwa.ch"
|
||||
license=('MIT')
|
||||
depends=("git" "base-devel")
|
||||
source=(
|
||||
"aur-update"
|
||||
)
|
||||
sha256sums=("f4e09dfe9753a26b90df2f8ba463f2856b2cd82268c5f13d8551391bc03f8c79")
|
||||
|
||||
package() {
|
||||
cd "$srcdir/"
|
||||
|
||||
install -Dm 755 aur-update "$pkgdir/usr/bin/aur-update"
|
||||
}
|
58
aur-update
Executable file
58
aur-update
Executable file
@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
shopt -s dotglob
|
||||
|
||||
root_dir="/aur"
|
||||
|
||||
display_help() {
|
||||
echo "Usage: $0 [option...] " >&2
|
||||
echo
|
||||
echo " -r, root directory, every subdir with a \".git\" directory inside is treated as an aur repo [default: $root_dir]"
|
||||
echo " -h, display this help and exit"
|
||||
echo
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while getopts ":hr:" opt; do
|
||||
case $opt in
|
||||
h)
|
||||
display_help
|
||||
exit 0
|
||||
;;
|
||||
r)
|
||||
root_dir=$OPTARG
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
display_help
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
display_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
update() {
|
||||
for d in "$@"/*; do
|
||||
echo "checking $d..."
|
||||
test -d "$d" -a \! -L "$d" || continue
|
||||
cd "$d"
|
||||
if [ -d ".git" ]; then
|
||||
git_status="$(git pull)"
|
||||
if [ "$git_status" != "Already up to date." ]; then
|
||||
makepkg -sirc --noconfirm
|
||||
fi
|
||||
fi
|
||||
cd ..
|
||||
done
|
||||
}
|
||||
|
||||
parse_args "$@"
|
||||
update "$root_dir"
|
Loading…
Reference in New Issue
Block a user