]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/platforms/redhat/bacula.spec.in
Resolve bug 605
[bacula/bacula] / bacula / platforms / redhat / bacula.spec.in
index ff92632a4e4e09af5624d262e0a2364c2c0aacff..368360417b0a16a0f360f26b6404a17be449bf24 100644 (file)
@@ -8,12 +8,16 @@
 %define depkgs_version 28Mar06
 %define sqlite_bindir /usr/lib/bacula/sqlite
 %define working_dir /var/bacula
+
+# NOTE these defines are used in some rather complex useradd and groupadd
+# commands. If you change them examine the post scripts for consequences.
 %define director_daemon_user bacula
 %define storage_daemon_user bacula
 %define file_daemon_user root
 %define daemon_group bacula
 # group that has write access to tape devices, usually disk on Linux
 %define storage_daemon_group disk
+
 %define user_file /etc/passwd
 %define group_file /etc/group
 %define useradd /usr/sbin/useradd
@@ -137,6 +141,21 @@ exit 1
 # specifically disallow gconsole if desired
 %{?nobuild_gconsole:%define gconsole 0}
 
+# Should we build wxconsole, only wxWidgets >=2.6 is supported
+# currently only SuSE 10 and FC4
+%define wxconsole 0
+%{?build_wxconsole:%define wxconsole 1}
+
+# define the basic package description
+%define blurb Bacula - It comes by night and sucks the vital essence from your computers.
+%define blurb2 Bacula is a set of computer programs that permit you (or the system
+%define blurb3 administrator) to manage backup, recovery, and verification of computer
+%define blurb4 data across a network of computers of different kinds. In technical terms,
+%define blurb5 it is a network client/server based backup program. Bacula is relatively
+%define blurb6 easy to use and efficient, while offering many advanced storage management
+%define blurb7 features that make it easy to find and recover lost or damaged files.
+%define blurb8 Bacula source code has been released under the GPL version 2 license.
+
 Summary: Bacula - The Network Backup Solution
 Name: bacula
 Version: @VERSION@
@@ -295,16 +314,20 @@ BuildRequires: rh-postgresql-devel >= 7
 BuildRequires: postgresql-devel >= 7
 %endif
 
+%if %{wxconsole}
+BuildRequires: wxGTK-devel >= 2.6
+%endif
+
 %description
-Bacula - It comes by night and sucks the vital essence from your computers.
+%{blurb}
 
-Bacula is a set of computer programs that permit you (or the system 
-administrator) to manage backup, recovery, and verification of computer 
-data across a network of computers of different kinds. In technical terms, 
-it is a network client/server based backup program. Bacula is relatively 
-easy to use and efficient, while offering many advanced storage management 
-features that make it easy to find and recover lost or damaged files. 
-Bacula source code has been released under the GPL version 2 license.
+%{blurb2}
+%{blurb3}
+%{blurb4}
+%{blurb5}
+%{blurb6}
+%{blurb7}
+%{blurb8}
 
 %if %{mysql}
 %package mysql
@@ -386,15 +409,15 @@ Requires: postgresql-server >= 7
 %description postgresql
 %endif
 
-Bacula - It comes by night and sucks the vital essence from your computers.
+%{blurb}
 
-Bacula is a set of computer programs that permit you (or the system 
-administrator) to manage backup, recovery, and verification of computer 
-data across a network of computers of different kinds. In technical terms, 
-it is a network client/server based backup program. Bacula is relatively 
-easy to use and efficient, while offering many advanced storage management 
-features that make it easy to find and recover lost or damaged files. 
-Bacula source code has been released under the GPL version 2 license.
+%{blurb2}
+%{blurb3}
+%{blurb4}
+%{blurb5}
+%{blurb6}
+%{blurb7}
+%{blurb8}
 
 %if %{mysql}
 This build requires MySQL to be installed separately as the catalog database.
@@ -439,15 +462,15 @@ Requires: libtermcap
 %endif
 
 %description client
-Bacula - It comes by night and sucks the vital essence from your computers.
+%{blurb}
 
-Bacula is a set of computer programs that permit you (or the system 
-administrator) to manage backup, recovery, and verification of computer 
-data across a network of computers of different kinds. In technical terms, 
-it is a network client/server based backup program. Bacula is relatively 
-easy to use and efficient, while offering many advanced storage management 
-features that make it easy to find and recover lost or damaged files. 
-Bacula source code has been released under the GPL version 2 license.
+%{blurb2}
+%{blurb3}
+%{blurb4}
+%{blurb5}
+%{blurb6}
+%{blurb7}
+%{blurb8}
 
 This is the File daemon (Client) only package. It includes the command line 
 console program.
@@ -458,15 +481,15 @@ Summary: Bacula - The Network Backup Solution
 Group: System Environment/Daemons
 
 %description updatedb
-Bacula - It comes by night and sucks the vital essence from your computers.
+%{blurb}
 
-Bacula is a set of computer programs that permit you (or the system 
-administrator) to manage backup, recovery, and verification of computer 
-data across a network of computers of different kinds. In technical terms, 
-it is a network client/server based backup program. Bacula is relatively 
-easy to use and efficient, while offering many advanced storage management 
-features that make it easy to find and recover lost or damaged files. 
-Bacula source code has been released under the GPL version 2 license.
+%{blurb2}
+%{blurb3}
+%{blurb4}
+%{blurb5}
+%{blurb6}
+%{blurb7}
+%{blurb8}
 
 This package installs scripts for updating older versions of the bacula
 database.
@@ -580,20 +603,55 @@ Requires: usermode
 
 %if %{gconsole}
 %description gconsole
-Bacula - It comes by night and sucks the vital essence from your computers.
+%{blurb}
 
-Bacula is a set of computer programs that permit you (or the system 
-administrator) to manage backup, recovery, and verification of computer 
-data across a network of computers of different kinds. In technical terms, 
-it is a network client/server based backup program. Bacula is relatively 
-easy to use and efficient, while offering many advanced storage management 
-features that make it easy to find and recover lost or damaged files. 
-Bacula source code has been released under the GPL version 2 license.
+%{blurb2}
+%{blurb3}
+%{blurb4}
+%{blurb5}
+%{blurb6}
+%{blurb7}
+%{blurb8}
 
 This is the Gnome Console package. It is an add-on to the client or
 server packages.
 %endif
 
+%if %{wxconsole}
+%package wxconsole
+Summary: Bacula - The Network Backup Solution
+Group: System Environment/Daemons
+Requires: wxGTK >= 2.6, libstdc++, openssl
+%endif
+
+%if %{wxconsole} && %{su10}
+Requires: gtk2 >= 2.8
+%endif
+
+%if %{wxconsole} && %{fc3}  
+Requires: gtk2 >= 2.4
+%endif
+
+%if %{wxconsole} && %{fc4}  
+Requires: gtk2 >= 2.6
+%endif
+
+%if %{wxconsole}
+%description wxconsole
+%{blurb}
+
+%{blurb2}
+%{blurb3}
+%{blurb4}
+%{blurb5}
+%{blurb6}
+%{blurb7}
+%{blurb8}
+
+This is the WXWindows Console package. It is an add-on to the client or
+server packages.
+%endif
+
 %prep
 
 %setup
@@ -640,7 +698,6 @@ patch platforms/suse/bacula-dir.in platforms/suse/bacula-dir-suse-sqlite.patch
 %endif
 
 # 64 bit lib location hacks
-# this is the location on redhat type platforms, don't know about others yet
 %if %{x86_64}
 export LDFLAGS=-L/usr/lib64
 %endif
@@ -682,6 +739,9 @@ make
 %endif
 %if %{postgresql}
         --with-postgresql \
+%endif
+%if %{wxconsole}
+       --enable-wx-console \
 %endif
         --with-working-dir=%{working_dir} \
         --with-pid-dir=/var/run \
@@ -795,6 +855,10 @@ cp -p scripts/bacula.desktop.gnome2.xsu $RPM_BUILD_ROOT/usr/share/applications/b
 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
 %endif
+%if %{wxconsole} && %{su10}
+cp -p src/wx-console/wxwin16x16.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/wxwin16x16.xpm
+cp -p scripts/wxconsole.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/wxconsole.desktop
+%endif
 %if %{rh8} || %{rh9} || %{wb3} || %{fc1} || %{fc3} || %{fc4} || %{mdk}
 %define iftrick 1
 %else
@@ -811,6 +875,13 @@ ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/gnome-console
 cp -p src/tray-monitor/generic.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/bacula-tray-monitor.xpm
 cp -p scripts/bacula-tray-monitor.desktop $RPM_BUILD_ROOT/usr/share/applications/bacula-tray-monitor.desktop
 %endif
+%if %{wxconsole} && %{iftrick}
+cp -p src/wx-console/wxwin16x16.xpm $RPM_BUILD_ROOT/usr/share/pixmaps/wxwin16x16.xpm
+cp -p scripts/wxconsole.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/wxconsole.desktop
+cp -p scripts/wxconsole.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/wxconsole
+cp -p scripts/wxconsole.pamd $RPM_BUILD_ROOT/etc/pam.d/wxconsole
+ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/wxconsole
+%endif
 
 # install sqlite
 %if %{sqlite}
@@ -845,6 +916,11 @@ touch $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/rpm_release
 cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/bacula/bin/bacula-fd
 rm -f src/filed/static-bacula-fd
 
+%if %{wxconsole}
+mv $RPM_BUILD_ROOT/usr/sbin/wx-console $RPM_BUILD_ROOT/usr/sbin/wxconsole
+mv $RPM_BUILD_ROOT/etc/bacula/wx-console.conf $RPM_BUILD_ROOT/etc/bacula/wxconsole.conf
+%endif
+
 # now clean up permissions that are left broken by the install
 chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
 chmod o-rwx $RPM_BUILD_ROOT/var/bacula
@@ -1006,19 +1082,19 @@ fi
 # this will be a unique group on redhat type systems or the group users on some systems
 HAVE_BACULA=`grep %{storage_daemon_user} %{user_file} 2>/dev/null`
 if [ -z "$HAVE_BACULA" ]; then
-        %{useradd} -r -c "Bacula" -d %{working_dir} -M -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
+        %{useradd} -r -c "Bacula" -d %{working_dir} -g %{storage_daemon_group} -M -s /sbin/nologin %{storage_daemon_user} > /dev/null 2>&1
         echo "The user %{storage_daemon_user} has been added to %{user_file}."
         echo "See the manual chapter \"Running Bacula\" for details."
 fi
 HAVE_BACULA=`grep %{director_daemon_user} %{user_file} 2>/dev/null`
 if [ -z "$HAVE_BACULA" ]; then
-        %{useradd} -r -c "Bacula" -d %{working_dir} -M -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
+        %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{director_daemon_user} > /dev/null 2>&1
         echo "The user %{director_daemon_user} has been added to %{user_file}."
         echo "See the manual chapter \"Running Bacula\" for details."
 fi
 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
 if [ -z "$HAVE_BACULA" ]; then
-        %{useradd} -r -c "Bacula" -d %{working_dir} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
+        %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
         echo "The user %{file_daemon_user} has been added to %{user_file}."
         echo "See the manual chapter \"Running Bacula\" for details."
 fi
@@ -1208,7 +1284,7 @@ fi
 # this will be a unique group on redhat type systems or the group users on some systems
 HAVE_BACULA=`grep %{file_daemon_user} %{user_file} 2>/dev/null`
 if [ -z "$HAVE_BACULA" ]; then
-        %{useradd} -r -c "Bacula" -d %{working_dir} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
+        %{useradd} -r -c "Bacula" -d %{working_dir} -g %{daemon_group} -M -s /sbin/nologin %{file_daemon_user} > /dev/null 2>&1
         echo "The user %{file_daemon_user} has been added to %{user_file}."
         echo "See the manual chapter \"Running Bacula\" for details."
 fi
@@ -1270,9 +1346,6 @@ echo "The database update scripts were installed to /etc/bacula/updatedb"
 %attr(-, root, %{daemon_group}) /etc/bacula/gconsole
 %attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/gnome-console.conf
 /usr/share/pixmaps/bacula.png
-%endif
-
-%if %{gconsole}
 /usr/share/applications/bacula.desktop
 %endif
 
@@ -1317,7 +1390,57 @@ if [ -d /etc/bacula ]; then
 fi
 %endif
 
+%if %{wxconsole}
+%files wxconsole
+%defattr(-,root,root)
+/usr/sbin/wxconsole
+%attr(-, root, %{daemon_group}) %dir /etc/bacula
+%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/wxconsole.conf
+/usr/share/pixmaps/wxwin16x16.xpm
+/usr/share/applications/wxconsole.desktop
+%endif
+
+%if %{wxconsole} && ! %{su9} && ! %{su10}
+# add the console helper files
+%config(noreplace,missingok) /etc/pam.d/wxconsole
+%config(noreplace,missingok) /etc/security/console.apps/wxconsole
+/usr/bin/wxconsole
+%endif
+
+%if %{wxconsole}
+%pre wxconsole
+# create the daemon group
+HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
+if [ -z "$HAVE_BACULA" ]; then
+        %{groupadd} -r %{daemon_group} > /dev/null 2>&1
+        echo "The group %{daemon_group} has been added to %{group_file}."
+        echo "See the manual chapter \"Running Bacula\" for details."
+fi
+
+%post wxconsole
+# generate passwords if needed
+if [ -d /etc/bacula ]; then
+        cd /etc/bacula
+        for file in *.conf; do
+                for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
+                        need_password=`grep $string $file 2>/dev/null`
+                        if [ -n "$need_password" ]; then
+                                pass=`openssl rand -base64 33`
+                                sed "s-$string-$pass-g" $file > $file.new
+                                cp -f $file.new $file; rm -f $file.new
+                        fi
+                done
+        done
+fi
+%endif
+
 %changelog
+* Thu Apr 27 2006 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- add -g param back to useradd statements Bug 605
+* Mon Apr 17 2006 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- redundant code cleanup
+* Sun Apr 16 2006 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- add wxconsole package
 * Fri Apr 14 2006 D. Scott Barninger <barninger@fairfieldcomputers.com>
 - 1.38.8 release
 - dependency update for Mandriva