]> git.sur5r.net Git - bacula/bacula/commitdiff
Use awk to add user on non-suse platforms.
authorScott Barninger <scott@barninger.com>
Sun, 3 Sep 2006 15:12:16 +0000 (15:12 +0000)
committerScott Barninger <scott@barninger.com>
Sun, 3 Sep 2006 15:12:16 +0000 (15:12 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3405 91ce42f0-d328-0410-95d8-f526ca767f89

gui/bacula-gui.spec.in

index b35765e2f42551816c64336dd2c8d97846b88117..a1648c8a1cc50ff016a4195a4fb32aa92394937e 100644 (file)
@@ -44,6 +44,7 @@ exit 1
 %endif
 
 %define groupmod /usr/sbin/groupmod
+$define groupfile /etc/group
 
 Summary: Bacula - The Network Backup Solution
 Name: bacula-gui
@@ -346,9 +347,9 @@ rm -rf docs
 # add the web server user to group bacula
 %{groupmod} -A %{dataowner} bacula
 %else
-echo
-echo "You must add user %{dataowner} to group bacula."
-echo
+# do it the hard way
+cp -p %{groupfile} %{groupfile}.old
+awk '{if (/bacula:/) print $0",%{dataowner}"; else print $0}' %{groupfile}.old > %{groupfile}
 %endif
 
 %postun bimagemgr
@@ -366,9 +367,9 @@ echo
 # add the web server user to group bacula
 %{groupmod} -A %{dataowner} bacula
 %else
-echo
-echo "You must add user %{dataowner} to group bacula."
-echo
+# do it the hard way
+cp -p %{groupfile} %{groupfile}.old
+awk '{if (/bacula:/) print $0",%{dataowner}"; else print $0}' %{groupfile}.old > %{groupfile}
 %endif
 
 %postun brestore
@@ -384,7 +385,7 @@ echo
 %changelog
 * Sun Sep 03 2006 D. Scott Barninger <barninger at fairfieldcomputers.com>
 - seems that groupmod -A or -R is only available on SuSE
-- add warning for other platforms
+- use awk or add warning for other platforms
 * Sat Aug 26 2006 D. Scott Barninger <barninger at fairfieldcomputers.com>
 - add brestore menu entry and post script
 - add /etc/bweb/bweb-postgresql.sql