forked from lahwaacz/Scripts
/
update-cgit-descriptions
executable file
·45 lines (40 loc) · 1.24 KB
/
update-cgit-descriptions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/bash
function get_pkgdesc()
{
local path="$1"
if [[ ! -f "$path/PKGBUILD" ]]; then
if [[ -f "$path/trunk/PKGBUILD" ]]; then
path="$path/trunk"
else
return 0
fi
fi
pushd "$path" > /dev/null
if [[ -f ".SRCINFO" ]]; then
cat .SRCINFO | awk -F "=" '/pkgdesc/ {print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
else
makepkg --printsrcinfo | awk -F "=" '/pkgdesc/ {print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
fi
popd > /dev/null
}
for path in "/srv/http/git/"*/*; do
pushd "$path" > /dev/null
pkgname=$(basename "$path")
pkgdesc=$(get_pkgdesc "$path")
if [[ "$pkgdesc" != "" ]]; then
git config --local gitweb.description "$pkgdesc"
fi
popd > /dev/null
done
for path in "/srv/http/git/abs/"*; do
pkgname=$(basename "$path")
pushd "$path" > /dev/null
git config --local gitweb.homepage "https://www.archlinux.org/packages/?name=$pkgname"
popd > /dev/null
done
for path in "/srv/http/git/"{aur,aur_mine}/*; do
pkgname=$(basename "$path")
pushd "$path" > /dev/null
git config --local gitweb.homepage "https://aur.archlinux.org/packages/$pkgname/"
popd > /dev/null
done