-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchitect-aur
executable file
·86 lines (67 loc) · 2.33 KB
/
architect-aur
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/bash
echo "Architect v. 0.8.1, 2014-10-31"
echo "By Viktor Nova"
# Uncomment ONE (and only one) of these to match your target system
PKGTYPE="deb"
#PKGTYPE="rpm"
#PKGTYPE="tar" # Pick this for Slackware
#PKGTYPE="solaris"
PKGARCH="`uname -m`"
#PKGARCH="i686" #Uncomment this if you are on a 32-bit x86 distribution (ABS compiles all 32-bit x86 packages with i686 optimization by default, but most other Linux distributions )
PKGEXT=$PKGTYPE # TODO - make this work for "tar" and "solaris" (only works for deb/rpm at the moment)
#########################################
## This section is adapted from aur.sh ##
## https://github.com/stuartpb/aur.sh ##
#########################################
d=${BUILDDIR:-$PWD}
echo "d is $d"
for p in ${@##-*}
do
cd $d
wget -e robots=off -r -np -nH --cut-dirs 3 --reject "index.html" "http://pkgbuild.com/git/aur-mirror.git/plain/$p/"
#curl "https://http://pkgbuild.com/git/aur-mirror.git/plain/$p/"
cd $p
makepkg -d ${@##[^\-]*}
done
### end of aur.sh
if [ $? -ne 0 ]
then
echo "Build failed, aborting package creation"
exit 1
fi
PKGNAME=$p
echo -e "\nArch package created:"
ls --color $PKGNAME*.tar.gz
read -p "Enter a version number for this package that is valid on your distribution: " PKGVERSION
if [ -d "pkg/$PKGNAME" ]; then
pushd pkg/$PKGNAME
echo "Stripping pacman metadata from package directory"
rm -f .MTREE .PKGINFO
ls -l --color
popd
echo "Creating native package with FPM"
fpm -s dir -t $PKGTYPE -n $PKGNAME -v $PKGVERSION -p $PKGNAME-VERSION_ARCH.$PKGEXT -C pkg/$PKGNAME/ . && \
echo -e "Righteous, deb package has been created.\n" && \
ls --color *.$PKGTYPYE && \
exit 0
echo "there mighta been a problem with FPM"
exit 1
fi
echo "Error, dude. The directory pkg/$PKGNAME don't exist yo."
exit 1
cd pkg/$PKGNAME && \
rm -f .MTREE .PKGINFO && \
fpm -s dir -t deb -n $PKGNAME -v $VERSION . && \
cd ../..
echo -e "Righteous, deb package has been created.\n" && \
ls --color *.deb
done
cd $d
# ------------------------------------------------------
# read -p "What is the package name? " PKGNAME
# FPM takes the argument "--depends DEPENDENCY", and it can be declared multiple times
#
# Arch's makepkg generates a .PKGINFO file that has lines like this:
# depend = pcre
# depend = libgl
# ..etc so it would be easy to use awk to parse that into a legitimate argument to do it