-
Notifications
You must be signed in to change notification settings - Fork 28
/
builddist.sh
executable file
·136 lines (89 loc) · 2.27 KB
/
builddist.sh
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
if [ $EUID -ne 0 ];
then
echo "This must be run as root"
exit 1
fi
if [ $# -ne 2 ];
then
echo ""
echo "Usage $0 <version> <release>"
echo ""
exit 1
fi
###### VARIABLES ############
APPVERSION="$1"
APPRELEASE="$2"
ARCH=`uname -m`
APPNAME="edgar"
APPDIR="$APPNAME-$APPVERSION/"
DISTNAME="$APPNAME-$APPVERSION-$APPRELEASE.tar.gz"
RPMROOT="/home/$SUDO_USER/rpmbuild"
SPECNAME="$APPNAME.spec"
###### Main Operation ########
echo "Creating Distribution for $APPNAME (Version $APPVERSION, Release $APPRELEASE) ($ARCH)"
echo "Cleaning..."
rm -rf dist/*
mkdir -p dist
cd dist
echo "Getting Git Tag $APPVERSION-$APPRELEASE"
git clone --branch $APPVERSION --depth=1 https://github.com/riksweeney/edgar $APPDIR
echo "Removing unwanted data files..."
cp $APPDIR/edgar.spec.base edgar.spec
rm -rf $APPDIR/dev
rm -rf $APPDIR/test
rm -rf $APPDIR/.git
rm $APPDIR/disclaimer.txt
rm $APPDIR/*.spec*
rm $APPDIR/*.sh
rm $APPDIR/*.nsi
rm $APPDIR/*.txt
rm $APPDIR/*.dat
rm $APPDIR/makefile.*
rm $APPDIR/*.cbp
rm $APPDIR/*.workspace
rm $APPDIR/*.rc
rm $APPDIR/*.gitignore
for i in `find . -name *.wav | grep -v doc`;do
rm $i
done
for i in `find . -name *.xcf | grep -v doc`;do
rm $i
done
for i in `find . -name *.gif | grep -v doc`;do
rm $i
done
for i in `find . -name *.blend* | grep -v doc`;do
rm $i
done
for i in `find . -name *.jpg | grep -v doc`;do
rm $i
done
echo "Creating GZIP... $DISTNAME"
for f in `ls $APPDIR/locale/*.po`; do \
FILE=`echo $f | cut -d'/' -f4 | cut -d'.' -f1`
LINE="/usr/share/locale/$FILE/LC_MESSAGES/edgar.mo"
echo "Adding $LINE"
echo $LINE >> edgar.spec
done
tar zhcf $DISTNAME $APPDIR
echo "Removing Copied Data..."
rm -rf $APPDIR
echo "Preparing to Build..."
mkdir -p $RPMROOT
mkdir -p $RPMROOT/BUILD $RPMROOT/BUILDROOT $RPMROOT/RPMS $RPMROOT/SOURCES $RPMROOT/SPECS $RPMROOT/SRPMS
cp $DISTNAME $RPMROOT/SOURCES
echo "Building RPMs..."
rpmbuild -bb $SPECNAME --target $ARCH --define "name $APPNAME" --define "version $APPVERSION" --define "release $APPRELEASE" --define "_topdir $RPMROOT"
echo "Retrieving RPMs"
mv $RPMROOT/RPMS/$ARCH/*.* .
rm -rf $RPMROOT
echo "Running Alien..."
alien -k *.rpm
rm *.rpm
echo "Renaming..."
mv *.deb edgar-$APPVERSION-$APPRELEASE.$ARCH.deb
rm edgar.spec
cd ..
chown -R $SUDO_USER:$SUDO_USER dist
echo "All Done..."