Fixed/protected package upgrades and inappropriate scripts execution.
[captive.git] / captive.spec.in
index d470b52..5398db1 100644 (file)
@@ -68,6 +68,7 @@ BuildRequires: readline-devel
 Requires: readline
 %endif
 BuildRequires: gcc >= 3.0
+Obsoletes: gnome-vfs-httpcaptive
 %if %{static}
 BuildRequires: fuse-devel
 BuildRequires: ntfsprogs-devel >= 1.8.0
@@ -75,7 +76,6 @@ BuildRequires: libgnomeui-devel
 Obsoletes: @PACKAGE@
 Obsoletes: @PACKAGE@-lufs
 Obsoletes: @PACKAGE@-install
-Obsoletes: gnome-vfs-httpcaptive
 # FIXME: ?: ntfsprogs-gnomevfs < 1.1
 %else
 Conflicts: @PACKAGE@-static
@@ -200,11 +200,22 @@ make DESTDIR=$RPM_BUILD_ROOT install-strip
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%pre
+
+%if ! %{static}
+%pre fuse
+%endif
+%if %{static}
+/usr/sbin/groupadd -r fuse 2>/dev/null || \
+   /usr/sbin/groupadd fuse 2>/dev/null || \
+   true
+%endif
+
 %post
 /sbin/ldconfig
 /usr/sbin/groupadd -r captive 2>/dev/null || \
    /usr/sbin/groupadd captive 2>/dev/null || \
-        true
+   true
 /usr/sbin/useradd -r -c "Captive Sandbox" -s /sbin/nologin -g captive -d %{_var}/lib/@PACKAGE@ captive 2>/dev/null || \
    /usr/sbin/useradd -c "Captive Sandbox" -s /sbin/nologin -g captive -d %{_var}/lib/@PACKAGE@ captive 2>/dev/null || \
    true
@@ -225,23 +236,32 @@ touch %{_var}/lock/subsys/@PACKAGE@
 %preun
 
 %if ! %{static}
+%preun fuse
+%endif
+# Only on real erase, not on upgrade:
+if [ $1 = 0 ];then
+       /usr/lib/lsb/remove_initd @PACKAGE@ 2>/dev/null || \
+                       /sbin/chkconfig --del @PACKAGE@
+       %{_initrddir}/@PACKAGE@ stop
+       rm -f %{_var}/lock/subsys/@PACKAGE@
+fi
+
+%if ! %{static}
 %preun install
 %endif
-%{_sbindir}/captive-install-fstab --remove
+# Only on real erase, not on upgrade:
+if [ $1 = 0 ];then
+       %{_sbindir}/captive-install-fstab --remove
+fi
 
 %postun
 /sbin/ldconfig
-# Remove stale sandbox chroot directories owned by 'captive.captive':
-rm -rf %{_var}/lib/@PACKAGE@/s-*
-rm -rf %{_var}/lib/@PACKAGE@/tmp/*
-
-%if ! %{static}
-%postun fuse
-%endif
-/usr/lib/lsb/remove_initd @PACKAGE@ 2>/dev/null || \
-               /sbin/chkconfig --del @PACKAGE@
-%{_initrddir}/@PACKAGE@ stop
-rm -f %{_var}/lock/subsys/@PACKAGE@
+# Only on real erase, not on upgrade:
+if [ $1 = 0 ];then
+       # Remove stale sandbox chroot directories owned by 'captive.captive':
+       rm -rf %{_var}/lib/@PACKAGE@/s-*
+       rm -rf %{_var}/lib/@PACKAGE@/tmp/*
+fi
 
 %files
 %defattr(-,root,root)
@@ -268,6 +288,9 @@ rm -f %{_var}/lock/subsys/@PACKAGE@
 /sbin/mount.@PACKAGE@
 /sbin/mount.@PACKAGE@-*
 %attr(644,root,root) %{_mandir}/man?/mount.@PACKAGE@.*
+%if %{static}
+%attr(4754,root,fuse) %{_libexecdir}/@PACKAGE@-fusermount
+%endif
 
 %if ! %{static}
 %files install