-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pullpkg
executable file
·53 lines (45 loc) · 1010 Bytes
/
pullpkg
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
47
48
49
50
51
52
53
#! /usr/bin/bash
set -x
# Pulls PKGBUILD from the Arch Repo and places it in the current directory
# Use -a (aur) to pull from the Arch User Repository
# Usage example: pullpkg.sh
# Usage function
usage() {
echo "Usage: $0 [-a] <package>"
}
# Check for aur flag
while getopts ":a" opt; do
case $opt in
a)
aur=true
;;
\?)
echo "Error: Invalid option: -$OPTARG" >&2
usage
exit 1
;;
esac
done
# Shift the parsed options out of the argument list
shift $((OPTIND - 1))
# Get the package name
package="$1"
# Check if the package name is empty
if [ -z "$package" ]; then
echo "Error: Package name is missing."
usage
exit 1
fi
# Pull the PKGBUILD function
get_pkgbuild()
{
if [ $aur = true ] ; then
paru -G "$package"
else
pkgctl repo clone "$package"
fi
}
echo "Pulling PKGBUILD for $package ..."
get_pkgbuild
# rm -rf "$package/.git" "$package/.SRCINFO"
echo "Done."