diff --git a/ChangeLog b/ChangeLog index 1a267a6a..97b669b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2008-04-21 Curtis Gedak + + * Makefile.am: Enhanced for new calling script gparted + - Added gparted script installation in sbin + - Added installdir parsing for gparted and gparted.desktop + + * gparted.desktop.in: Renamed gparted.desktop.in + to gparted.desktop.in.in + - This is to permit installdir parsing in gparted.desktop + + * gparted.in: Added new calling script gparted + - This is to permit using hal-lock to acquire device + locks to prevent automounting prior to executing gpartedbin. + - Closes GParted bug #324220 + + * src/GParted_Core.cc: Removed gparted-disable-automount.fdi handling + - Removed signal handler patch from 2008-01-28 + - Removed initial work on disabling automount from 2006-08-09 + - /usr/share/hal/fdi/policy/gparted-disable-automount.fdi is + no longer created. + - This is to permit preferred alternative of using hal-lock. + + * src/Makefile.am: Renamed gparted binary to gpartedbin + - This is to permit a calling script to be named gparted. + 2008-04-20 Curtis Gedak * src/Dialog_Disklabel.cc: Improved ability to translate text diff --git a/Makefile.am b/Makefile.am index 67f6a033..927776a1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,18 +2,32 @@ SUBDIRS = compose doc include pixmaps po src @INTLTOOL_DESKTOP_RULE@ +DESKTOP_IN_IN_FILES = gparted.desktop.in.in DESKTOP_IN_FILES = gparted.desktop.in DESKTOP_FILES =$(DESKTOP_IN_FILES:.desktop.in=.desktop) desktopdir = $(datadir)/applications desktop_DATA = $(DESKTOP_FILES) +sbin_SCRIPTS = gparted +CLEANFILES = $(sbin_SCRIPTS) $(DESKTOP_IN_FILES) + +do_subst = sed -e 's,[@]installdir[@],$(sbindir),g' + +gparted.desktop.in: gparted.desktop.in.in Makefile + $(do_subst) < $(srcdir)/gparted.desktop.in.in > gparted.desktop.in + +gparted: gparted.in Makefile + $(do_subst) < $(srcdir)/gparted.in > gparted + chmod +x gparted + EXTRA_DIST = \ - $(DESKTOP_IN_FILES) \ + $(DESKTOP_IN_IN_FILES) \ $(DESKTOP_FILES) \ intltool-extract.in \ intltool-merge.in \ - intltool-update.in + intltool-update.in \ + gparted.in DISTCLEANFILES = \ intltool-extract \ diff --git a/gparted.desktop.in b/gparted.desktop.in.in similarity index 85% rename from gparted.desktop.in rename to gparted.desktop.in.in index a9097208..d6914e6d 100644 --- a/gparted.desktop.in +++ b/gparted.desktop.in.in @@ -1,7 +1,7 @@ [Desktop Entry] _Name=GParted Partition Editor _Comment=Create, reorganize, and delete partitions -Exec=gksu gparted +Exec=gksu @installdir@/gparted Icon=gparted Terminal=false Type=Application diff --git a/gparted.in b/gparted.in new file mode 100755 index 00000000..67da549d --- /dev/null +++ b/gparted.in @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Purpose: Acquire device locks prior to running gparted. +# This is to prevent devices from being automounted. +# File system problems can occur if devices are mounted +# prior to the completion of GParted's operations. +# See GParted bug #324220 +# http://bugzilla.gnome.org/show_bug.cgi?id=324220 +# +# +# Following is a quote from HAL 0.5.10 Specification. +# http://people.freedesktop.org/~david/hal-spec/hal-spec.html#locking-guidelines +# +# In order to prevent HAL-based automounters from mounting partitions +# that are being prepared, applications that access block devices +# directly (and pokes the kernel to reload the partitioning table) +# should lock out automounters by either a) obtaining the +# org.freedesktop.Hal.Device.Storage lock on each drive being processed; +# or b) obtaining the global org.freedesktop.Hal.Device.Storage lock. +# + +hal-lock --interface org.freedeskdesktop.Hal.Device.Storage --exclusive \ + --run @installdir@/gpartedbin $* diff --git a/po/ChangeLog b/po/ChangeLog index c7fcb8d4..be43d03e 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,10 @@ +2008-04-21 Curtis Gedak + + * POTFILES.skip: Created file and added gparted.desktop.in + + * POTFILES.in: Renamed gparted.desktop.in to gparted.desktop.in.in + - This is to permit parsing of installdir for gparted.desktop + 2008-04-20 Vincent van Adrighem * nl.po: Translation updated by Tino Meinen. diff --git a/po/POTFILES.in b/po/POTFILES.in index 45c739c0..3c20f2db 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,6 @@ # List of source files containing translatable strings. # Please keep this file sorted alphabetically. -gparted.desktop.in +gparted.desktop.in.in src/Dialog_Base_Partition.cc src/Dialog_Disklabel.cc src/Dialog_Partition_Copy.cc diff --git a/po/POTFILES.skip b/po/POTFILES.skip new file mode 100644 index 00000000..2455aa13 --- /dev/null +++ b/po/POTFILES.skip @@ -0,0 +1,4 @@ +# List of source files containing translatable strings, but should be skipped. +# Please keep this file sorted alphabetically. +gparted.desktop.in + diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 109a5231..867a1372 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -39,8 +39,6 @@ #include "../include/ufs.h" #include -#include -#include #include std::vector libparted_messages ; //see ped_exception_handler() @@ -48,13 +46,6 @@ std::vector libparted_messages ; //see ped_exception_handler() namespace GParted { -// Clean up the fdi when terminating -void sig_fdi_cleanup( int signum ) -{ - remove( "/usr/share/hal/fdi/policy/gparted-disable-automount.fdi" ); - raise( signum ); -} - GParted_Core::GParted_Core() { lp_device = NULL ; @@ -64,44 +55,6 @@ GParted_Core::GParted_Core() ped_exception_set_handler( ped_exception_handler ) ; - //make sure that the fdi is cleaned up on all but the most forceful - //program exits - struct sigaction sa; - sa.sa_handler = sig_fdi_cleanup; - sigemptyset( &sa.sa_mask ); - sa.sa_flags = SA_RESETHAND; - if( sigaction( SIGHUP, &sa, NULL ) == -1 || - sigaction( SIGINT, &sa, NULL ) == -1 || - sigaction( SIGQUIT, &sa, NULL ) == -1 || - sigaction( SIGILL, &sa, NULL ) == -1 || - sigaction( SIGABRT, &sa, NULL ) == -1 || - sigaction( SIGFPE, &sa, NULL ) == -1 || - sigaction( SIGSEGV, &sa, NULL ) == -1 || - sigaction( SIGPIPE, &sa, NULL ) == -1 || - sigaction( SIGALRM, &sa, NULL ) == -1 || - sigaction( SIGTERM, &sa, NULL ) == -1 || - sigaction( SIGUSR1, &sa, NULL ) == -1 || - sigaction( SIGUSR2, &sa, NULL ) == -1 || - sigaction( SIGBUS, &sa, NULL ) == -1 || - sigaction( SIGXCPU, &sa, NULL ) == -1 || - sigaction( SIGXFSZ, &sa, NULL ) == -1 ) - perror( "Could not set signal handler" ); - - //disable automount //FIXME: temporary hack, till i find a better solution... - std::ofstream fdi_file( "/usr/share/hal/fdi/policy/gparted-disable-automount.fdi" ) ; - if ( fdi_file ) - { - fdi_file << "" ; - fdi_file << "" ; - fdi_file << "" ; - fdi_file << "false" ; - fdi_file << "" ; - fdi_file << "" ; - fdi_file << "" ; - - fdi_file .close() ; - } - //get valid flags ... for ( PedPartitionFlag flag = ped_partition_flag_next( static_cast( NULL ) ) ; flag ; @@ -2371,9 +2324,6 @@ GParted_Core::~GParted_Core() { if ( p_filesystem ) delete p_filesystem ; - - //remove .fdi file.. - remove( "/usr/share/hal/fdi/policy/gparted-disable-automount.fdi" ) ; } } //GParted diff --git a/src/Makefile.am b/src/Makefile.am index 4bffdef4..04e2aa6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,9 +7,9 @@ AM_CFLAGS = -Wall AM_CXXFLAGS = -Wall -sbin_PROGRAMS = gparted +sbin_PROGRAMS = gpartedbin -gparted_SOURCES = \ +gpartedbin_SOURCES = \ Device.cc \ Dialog_Base_Partition.cc \ Dialog_Disklabel.cc \ @@ -55,7 +55,7 @@ gparted_SOURCES = \ ufs.cc \ xfs.cc -gparted_LDFLAGS = -lparted -lgthread-2.0 +gpartedbin_LDFLAGS = -lparted -lgthread-2.0 -gparted_LDADD = $(GTKMM_LIBS) +gpartedbin_LDADD = $(GTKMM_LIBS)