Adding postinstall script in SUNWfirefox-apoc-adapter to touch 
".autoreg" as well,  in order to trigger the registration if users want 
to install apoc adapter back.
One thing I'm not sure that if we need to let postrun to execute the 
logic that in postinstall and postremove?

Dave.
Dave Lin wrote:
> Hi All,
>
> To fully fix this bug, we need to make change both in code file 
> nsXPComInit.cpp(part 1) and spec file SUNWfirefox.spec(part 2).
>
> Here comes the patch for SUNWfirefox.spec. The patch works like this,
> the file  ".autoreg" will be delivered in SUNWfirefox, 
> SUNWfirefox-apoc-adapter's postremove script will touch .autoreg right 
> after apoc removal,  then when Firefox starts up next time, it will 
> detect this file is newer than "components/compreg.dat" and call the 
> registration program to update component registration information.
>
> Dave.
> Brian Lu wrote:
>> Fix the bug CR 6521792: Firefox cannot start,after removing apoc 
>> adapter,with user account setup when apoc adapter installed
>> ------------------------------------------------------------------------
>>
>> --- mozilla/xpcom/build/nsXPComInit.cpp.old    2006-08-05 
>> 01:50:52.000000000 +0800
>> +++ mozilla/xpcom/build/nsXPComInit.cpp    2007-03-09 
>> 11:05:45.166807000 +0800
>> @@ -262,6 +262,7 @@
>>  // compreg.dat file.  If the .autoreg file is newer, we autoregister.
>>  static PRBool CheckUpdateFile()
>>  {
>> +    PRBool ret;
>>      nsresult rv;
>>      nsCOMPtr<nsIFile> file;
>>      rv = 
>> nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, @@ 
>> -297,8 +298,13 @@
>>      PRInt64 compregModTime, autoregModTime;
>>      compregFile->GetLastModifiedTime(&compregModTime);
>>      file->GetLastModifiedTime(&autoregModTime);
>> -
>> -    return LL_CMP(autoregModTime, >, compregModTime);
>> + +    ret = LL_CMP(autoregModTime, >, compregModTime);
>> +    if (ret)
>> +    {
>> +      compregFile->Remove(PR_FALSE);
>> +    }
>> +    return ret;
>>  }
>>  
>>  
>> @@ -622,6 +628,7 @@
>>          for (int i = 0; i < components_length; i++)
>>              RegisterGenericFactory(registrar, &components[i]);
>>      }
>> +    CheckUpdateFile();
>>      rv = 
>> nsComponentManagerImpl::gComponentManager->ReadPersistentRegistry();
>>  #ifdef DEBUG         if (NS_FAILED(rv)) {
>> @@ -629,7 +636,7 @@
>>      }
>>  #endif
>>  
>> -    if ( NS_FAILED(rv) || CheckUpdateFile()) {
>> +    if ( NS_FAILED(rv)) {
>>          // if we find no persistent registry, we will try to 
>> autoregister
>>          // the default components directory.
>>          
>> nsComponentManagerImpl::gComponentManager->AutoRegister(nsnull);
>>   
>
> ------------------------------------------------------------------------
>
> Index: SUNWfirefox.spec
> ===================================================================
> --- SUNWfirefox.spec  (revision 10869)
> +++ SUNWfirefox.spec  (working copy)
> @@ -122,6 +122,15 @@
>  find firefox ! -type d | grep -v "libmozapoc.so" | \
>    sed -e 's#{#\\{#g' -e 's#}#\\}#g' -e 's#^.*$#%{_libdir}/&#' \
>      >  %{_builddir}/%name-%version/%{name}.list
> +
> +# deliver file .autoreg for triggerring Firefox auto-re-registration
> +# right after apoc adapter removal(see bug CR#CR6521792)
> +# The postremove script will touch .autoreg after SUNWfirefox-apoc-adapter
> +# uninstallation, then Firefox will detect this change and re-register 
> +# the components
> +#
> +touch $RPM_BUILD_ROOT%{_libdir}/firefox/.autoreg
> +
>  %endif
>  
>  rm -rf $RPM_BUILD_ROOT%{_mandir}
> @@ -148,10 +157,16 @@
>    echo '/usr/bin/update-desktop-database'
>  ) | $BASEDIR/lib/postrun -b -u -c JDS
>  
> -#####################################
> -##      Package Files Section      ##
> -#####################################
> +%if %with_apoc_adapter
> +%postun apoc-adapter
> +PKGCOND=/usr/bin/pkgcond
> +test -x $PKGCOND || exit 0
> +if $PKGCOND is_path_writable $BASEDIR/lib/firefox; then
> +  touch $BASEDIR/lib/firefox/.autoreg
> +fi
> +%endif
>  
> +
>  %if %with_apoc_adapter
>  %files -f SUNWfirefox.list
>  %else
> @@ -164,7 +179,7 @@
>  %dir %attr (0755, root, bin) %{_libdir}
>  
>  %if %with_apoc_adapter
> -#%{_libdir}/firefox
> +%ghost %{_libdir}/firefox/.autoreg
>  %else
>  %{_libdir}/firefox
>  %endif
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: firefox-fix-apoc-removal-crash-2.diff
Type: text/x-patch
Size: 1600 bytes
Desc: not available
URL: 
<http://mail.opensolaris.org/pipermail/jds-review/attachments/20070320/8db32e30/attachment.bin>

Reply via email to