]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/contrib-rpm/rpm_wizard.sh
Add suse 10.3
[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 (C) 2006 Free Software Foundation Europe e.V.
8 # licensed under GPL-v2
9
10 # usage ./rpm_wizard.sh
11
12 # check for zenity
13 HAVE_ZENITY=`which zenity`
14 if [ -z $HAVE_ZENITY ];
15 then
16         echo You need zenity installed to run this script;
17         exit;
18 fi
19
20 zenity --question --text "Bacula rpm rebuilding wizard. Do you wish to continue?"
21
22 RESULT="$?"
23 if [ "$RESULT" = "1" ];
24 then
25         exit;
26 fi
27
28 # get packager name and email adddress
29 PACKAGER=`zenity --text-info --editable --height=25 --width=300 --title="Enter Your Name <your_email_address>"`
30
31 # get location of src rpm
32 SELECTED_FILE=`zenity --file-selection --title "Choose SRPM file to rebuild"`
33
34 RESULT="$?"
35 if [ "$RESULT" = "1" ];
36 then
37         exit;
38 fi
39
40 # select build platform
41 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 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 mdk False mdv`
42
43 RESULT="$?"
44 if [ "$RESULT" = "1" ];
45 then
46         exit;
47 fi
48
49 # select database support
50 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`
51
52 RESULT="$?"
53 if [ "$RESULT" = "1" ];
54 then
55         exit;
56 fi
57
58 # select other build options
59 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`
60
61 RESULT="$?"
62 if [ "$RESULT" = "1" ];
63 then
64         exit;
65 fi
66
67 OPTION1=`echo $OPTIONS|cut --delimiter=\| -f1`
68 OPTION2=`echo $OPTIONS|cut --delimiter=\| -f2`
69 OPTION3=`echo $OPTIONS|cut --delimiter=\| -f3`
70 OPTION4=`echo $OPTIONS|cut --delimiter=\| -f4`
71 OPTION5=`echo $OPTIONS|cut --delimiter=\| -f5`
72
73 # construct rpmbuild command
74 COMMAND="rpmbuild --rebuild --define 'build_$PLATFORM 1' --define 'build_$DATABASE 1' --define 'contrib_packager ${PACKAGER}'"
75
76 if [ ! -z $OPTION1 ];
77 then
78         COMMAND="${COMMAND} --define '$OPTION1 1'";
79 fi
80 if [ ! -z $OPTION2 ];
81 then
82         COMMAND="${COMMAND} --define '$OPTION2 1'";
83 fi
84 if [ ! -z $OPTION3 ];
85 then
86         COMMAND="${COMMAND} --define '$OPTION3 1'";
87 fi
88 if [ ! -z $OPTION4 ];
89 then
90         COMMAND="${COMMAND} --define '$OPTION4 1'";
91 fi
92 if [ ! -z $OPTION5 ];
93 then
94         COMMAND="${COMMAND} --define '$OPTION5 1'";
95 fi
96
97 COMMAND="${COMMAND} ${SELECTED_FILE}"
98
99 zenity --question --text "Ready to rebuild the src rpm with $COMMAND. Do you wish to continue?"
100
101 RESULT="$?"
102 if [ "$RESULT" = "1" ];
103 then
104         exit;
105 fi
106
107 # execute the build
108 echo $COMMAND | sh
109
110 # ChangeLog
111 # 30 Jul 2006 initial release
112 # 05 Aug 2006 add option for build_python
113 # 27 Jan 2007 add fc6
114 # 29 Apr 2007 add sl3 & sl4 target and bat option
115 # 06 May 2007 add fc7 target
116 # 10 Nov 2007 add rhel5 and su103 targets