This repository has been archived by the owner on Oct 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.sh
70 lines (55 loc) · 1.47 KB
/
build.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
#!/bin/bash
# File: build.sh
# Description: Build TigerOS RPM Packages
# Author: Tim Zabel <tjz8659@rit.edu>
# Steps:
# 1. check if local or remote build
# --- If remote, clone repo from $1 arg
# 2. tar *-1.0 directory
# 3. fedpkg --release $2 local
# 4. mv .rpm out of noarch/
# 5. tar rpm and src.rpm together into $1.tar.gz
# Otherwise, display usage message
# Usage: $0 [--local] [--remote] <package-name> <fedora release>
# Example: ./build.sh --local tigeros-scripts 29
#TODO:
# 1. check local / remote flags
# 2. add red failure variable
# 3. create remote scenario
# Variables
green=`tput setaf 2`
reset=`tput sgr0`
package=$1
release=$2
version=29
tarfile="$package-1.0-$release.fc$version.tar.gz"
usage() {
echo; echo "This script creates an srpm and rpm out of the given package."
echo "Usage: $@$0 <package-name> <release> " ; echo
}
main() {
if [ "$#" != 2 ] ; then
usage
exit 1
fi
# Good to go
echo ; echo "Compressing $1-1.0 directory..." ; echo
tar zcvf $tarfile $package-1.0
# RPM Building
echo ; echo "Creating RPM Package..." ; echo
fedpkg --release f$version local
if [ "$?" != 0 ] ; then
echo "RPM Building failed!"
exit 1
fi
# Tar RPM
mv noarch/* $PWD && rm -rf noarch
tar zcvf $package-repos.tar.gz *.rpm
rm $tarfile *.rpm .build*
# Show results
if [ "$?" == 0 ] ; then
echo ; echo "$(green)Complete!$(reset)" ; echo
fi
exit 0
}
main $@