-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpmMacrosConfig
executable file
·114 lines (105 loc) · 2.72 KB
/
rpmMacrosConfig
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
#!/bin/sh
#------------------------------------------------------------------------------
#
# MyRPM - Rpm Utilities
# Copyright (c) Jean-Marie RENOUARD 2014 - LightPath
# Contact : Jean-Marie Renouard <jmrenouard at gmail.com>
#
# This program is open source, licensed under the Artistic Licence v2.0.
#
# Artistic Licence 2.0
# Everyone is permitted to copy and distribute verbatim copies of
# this license document, but changing it is not allowed.
#
#------------------------------------------------------------------------------
NAME="rpm .rpmmacros config."
VERSION="1.1"
printInfo() {
zenity --window-icon=/dev/null \
--info \
--text="$1"
}
printQuestion() {
zenity --window-icon=/dev/null \
--title "$1" \
--question \
--text "$2"
echo $?
}
printTextBox()
{
zenity --window-icon=/dev/null \
--title "$1" \
--entry\
--text "$2" \
--entry-text "$3"
}
printRadioBoxDistribution() {
ans=$(zenity --list\
--text "Distribution"\
--radiolist\
--column "Pick" \
--column "Distribution" \
FALSE "Centos 7" \
TRUE "Centos 6" \
FALSE "Centos 5" \
FALSE "Centos 4" \
FALSE "Red Hat Enterprise 7" \
FALSE "Red Hat Enterprise 6" \
FALSE "Red Hat Enterprise 5" \
FALSE "Red Hat Enterprise 4" \
FALSE "Fedora Core 18" \
FALSE "Fedora Core 19" \
FALSE "Fedora Core 20" \
FALSE "Fedora Core 21" \
);
echo $ans
}
if [ $(printQuestion "Configuration \".rpmmacros\"" "Do you want to continue ?") -eq "0" ]; then
echo "continuing ..."
else
printInfo "Bye !"
fi
P_NAME=$(printTextBox "Packager Name" "Packager Name" "Jean-Marie Renouard")
if [ "$?" -ne "0" ]; then
printInfo "Packager Name Canceled :("
exit 1
fi
P_EMAIL=$(printTextBox "Packager Email" "Packager Email" "[email protected]")
if [ "$?" -ne "0" ]; then
printInfo "Packager Email Canceled :("
exit 1
fi
V_NAME=$(printTextBox "Vendor Name" "Vendor Name" "LightPath")
if [ "$?" -ne "0" ]; then
printInfo "Vendor Name Canceled :("
exit 1
fi
V_URL=$(printTextBox "Vendor Url" "Vendor Url" "http://www.jmrenouard.fr")
if [ "$?" -ne "0" ]; then
printInfo "Vendor Url Canceled :("
exit 1
fi
D_NAME=$(printRadioBoxDistribution)
if [ "$?" -ne "0" ]; then
printInfo "Distribution Name Canceled :("
exit 1
fi
L_ARCH=`arch`
if [ $(printQuestion "Deploy \".rpmmacros\"" "Do you really want to deploy ?") -eq "0" ]; then
rm -f $HOME/.rpmmacros
(cat <<SETVAR
%_topdir $HOME/redhat
%packager $P_NAME<$P_EMAIL>
%vendor $V_NAME
%vendor_url $V_URL
%distribution $D_NAME
%_arch $L_ARCH
%dist_tag .1
%_tmppath /var/tmp
%_signature gpg
%_gpg_name $P_NAME
SETVAR
) > $HOME/.rpmmacros
mkdir -p $HOME/redhat/{RPMS,SRPMS,BUILD,SOURCES,SPECS}
fi