]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/contrib-rpm/rpm_wizard.sh
su102 again.
[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 wb3 False rhel3 False rhel4 False centos3 False centos4 False su9 False su10 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 "Platform" 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 "Platform" 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
72 # construct rpmbuild command
73 COMMAND="rpmbuild --rebuild --define 'build_$PLATFORM 1' --define 'build_$DATABASE 1' --define 'contrib_packager ${PACKAGER}'"
74
75 if [ ! -z $OPTION1 ];
76 then
77         COMMAND="${COMMAND} --define '$OPTION1 1'";
78 fi
79 if [ ! -z $OPTION2 ];
80 then
81         COMMAND="${COMMAND} --define '$OPTION2 1'";
82 fi
83 if [ ! -z $OPTION3 ];
84 then
85         COMMAND="${COMMAND} --define '$OPTION3 1'";
86 fi
87 if [ ! -z $OPTION4 ];
88 then
89         COMMAND="${COMMAND} --define '$OPTION4 1'";
90 fi
91
92 COMMAND="${COMMAND} ${SELECTED_FILE}"
93
94 zenity --question --text "Ready to rebuild the src rpm with $COMMAND. Do you wish to continue?"
95
96 RESULT="$?"
97 if [ "$RESULT" = "1" ];
98 then
99         exit;
100 fi
101
102 # execute the build
103 echo $COMMAND | sh
104
105 # ChangeLog
106 # 30 Jul 2006 initial release
107 # 05 Aug 2006 add option for build_python
108 # 27 Jan 2007 add fc6