]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/contrib-rpm/rpm_wizard.sh
b2ceb9bf85ad72c4552b44adcd786d05e0ced45a
[bacula/bacula] / bacula / platforms / contrib-rpm / rpm_wizard.sh
1 #!/bin/sh
2
3 # shell script wizard to build bacula rpm using gnome dialogs
4 # requires zenity to be installed
5 # 30 Jul 2006 D. Scott Barninger
6 #
7 # Copyright Kern Sibbald 2006-2015
8 # License: BSD 2-Clause
9
10
11 # usage ./rpm_wizard.sh
12
13 # check for zenity
14 HAVE_ZENITY=`which zenity`
15 if [ -z $HAVE_ZENITY ];
16 then
17         echo You need zenity installed to run this script;
18         exit;
19 fi
20
21 zenity --question --text "Bacula rpm rebuilding wizard. Do you wish to continue?"
22
23 RESULT="$?"
24 if [ "$RESULT" = "1" ];
25 then
26         exit;
27 fi
28
29 # get packager name and email adddress
30 PACKAGER=`zenity --text-info --editable --height=25 --width=300 --title="Enter Your Name <your_email_address>"`
31
32 # get location of src rpm
33 SELECTED_FILE=`zenity --file-selection --title "Choose SRPM file to rebuild"`
34
35 RESULT="$?"
36 if [ "$RESULT" = "1" ];
37 then
38         exit;
39 fi
40
41 # select build platform
42 PLATFORM=`zenity --title "Select Platform" --text "Please choose a build platform." --list --radiolist --column "Select" --column "Platform" False rh7 False rh8 False rh9 False fc1 False fc3 False fc4 False fc5 False fc6 False fc7 False fc8 False fc9 False wb3 False rhel3 False rhel4 False rhel5 False centos3 False centos4 False centos5 False sl3 False sl4 False sl5 False su9 False su10 False su102 False su103 False su110 False su111 False mdk False mdv`
43
44 RESULT="$?"
45 if [ "$RESULT" = "1" ];
46 then
47         exit;
48 fi
49
50 # select database support
51 DATABASE=`zenity --title "Select Database" --text "Please choose database support." --list --radiolist --column "Select" --column "Database" False sqlite False mysql False mysql4 False mysql5 False postgresql False client_only`
52
53 RESULT="$?"
54 if [ "$RESULT" = "1" ];
55 then
56         exit;
57 fi
58
59 # select other build options
60 OPTIONS=`zenity --title "Select Options" --text "Please choose other options." --list --checklist --column "Select" --column "Other" False build_bat False build_wxconsole False nobuild_gconsole False build_x86_64 False build_python`
61
62 RESULT="$?"
63 if [ "$RESULT" = "1" ];
64 then
65         exit;
66 fi
67
68 OPTION1=`echo $OPTIONS|cut --delimiter=\| -f1`
69 OPTION2=`echo $OPTIONS|cut --delimiter=\| -f2`
70 OPTION3=`echo $OPTIONS|cut --delimiter=\| -f3`
71 OPTION4=`echo $OPTIONS|cut --delimiter=\| -f4`
72 OPTION5=`echo $OPTIONS|cut --delimiter=\| -f5`
73
74 # construct rpmbuild command
75 COMMAND="rpmbuild --rebuild --define 'build_$PLATFORM 1' --define 'build_$DATABASE 1' --define 'contrib_packager ${PACKAGER}'"
76
77 if [ ! -z $OPTION1 ];
78 then
79         COMMAND="${COMMAND} --define '$OPTION1 1'";
80 fi
81 if [ ! -z $OPTION2 ];
82 then
83         COMMAND="${COMMAND} --define '$OPTION2 1'";
84 fi
85 if [ ! -z $OPTION3 ];
86 then
87         COMMAND="${COMMAND} --define '$OPTION3 1'";
88 fi
89 if [ ! -z $OPTION4 ];
90 then
91         COMMAND="${COMMAND} --define '$OPTION4 1'";
92 fi
93 if [ ! -z $OPTION5 ];
94 then
95         COMMAND="${COMMAND} --define '$OPTION5 1'";
96 fi
97
98 COMMAND="${COMMAND} ${SELECTED_FILE}"
99
100 zenity --question --text "Ready to rebuild the src rpm with $COMMAND. Do you wish to continue?"
101
102 RESULT="$?"
103 if [ "$RESULT" = "1" ];
104 then
105         exit;
106 fi
107
108 # execute the build
109 echo $COMMAND | sh
110
111 # ChangeLog
112 # 30 Jul 2006 initial release
113 # 05 Aug 2006 add option for build_python
114 # 27 Jan 2007 add fc6
115 # 29 Apr 2007 add sl3 & sl4 target and bat option
116 # 06 May 2007 add fc7 target
117 # 10 Nov 2007 add rhel5 and su103 targets
118 # 12 Jan 2008 add fc8 target
119 # 23 May 2008 add fc9 target
120 # 28 Jun 2008 add su110 target
121 # 31 Dec 2008 add su111 target