-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaur.plugin.bash
More file actions
46 lines (44 loc) · 1.42 KB
/
aur.plugin.bash
File metadata and controls
46 lines (44 loc) · 1.42 KB
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
46
aur-add-remote-origin() {
local remoteGitUrl
if [ ! -d .git ]; then
echo "You aren't inside the root of Git repository." >&2
return 1
fi
remoteGitUrl=`git remote -v 2>/dev/null`
if [[ $? == 128 ]]; then
echo "Missing git repository. I make them in the current directory"
git init
echo "Done"
fi
remoteGitUrl=`echo $remoteGitUrl | awk '/origin/ {if (NR == 1) print $2}'`
local packageName baseRemoteUrl
packageName=`basename $PWD`
baseRemoteUrl='ssh://aur@aur.archlinux.org'
if [[ $remoteGitUrl =~ aur4 ]]; then
remoteGitUrl="${baseRemoteUrl}/${packageName}.git"
git remote set-url origin $remoteGitUrl
return
fi
if [ -n "$remoteGitUrl" ]; then
echo "Package has already defined remote url for git repository: '$remoteGitUrl'"
return
fi
remoteGitUrl="${baseRemoteUrl}/${packageName}.git"
echo "Adding remote url '$remoteGitUrl' as origin"
git remote add origin $remoteGitUrl
}
aur-commit-update() {
if [[ -f PKGBUILD ]]; then
local pkgver=$(makepkg --printsrcinfo | awk '/pkgver/ {print $3}')
if [[ -n $pkgver ]]; then
INFO 'Creating new .SRCINFO'
mksrcinfo
INFO 'Adding updated files to the stage'
git add -u
git commit -m "Upgraded to $pkgver"
git push
fi
else
WARN 'Missing PKGBUILD'
fi
}