Bug 157628 - [patch] www/red5 remove user data while reinstalling updating
Summary: [patch] www/red5 remove user data while reinstalling updating
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Chris Rees
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-05 15:40 UTC by Joris Dedieu
Modified: 2011-08-15 08:00 UTC (History)
1 user (show)

See Also:


Attachments
red5.diff (11.32 KB, patch)
2011-06-05 15:40 UTC, Joris Dedieu
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joris Dedieu 2011-06-05 15:40:06 UTC
	Reinstalling or updating port www/red5 will remove files in /usr/local/red5/conf and /usr/local/red5/webapps
	witch can contains specific settings or date.

Fix: New version of the port that install conf and webapps in %%EXAMPLESDIR%%
	and in ${RED5_HOME} only if it's a new installation.
	Files in ${RED5_HOME}/conf and ${RED5_HOME}/webapps are not removed anymore
	by deinstall
How-To-Repeat: 	make -C /usr/ports/red5 install clean
	echo "something=important" >> /usr/local/red5/conf/red5.properties
	make -C /usr/ports/red5 deinstall reinstall
	You loose your settings
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-06-05 15:40:21 UTC
Class Changed
From-To: sw-bug->maintainer-update

Fix category (submitter is maintainer) (via the GNATS Auto Assign Tool)
Comment 2 Olli Hauer freebsd_committer freebsd_triage 2011-07-10 18:43:15 UTC
This can be fixed in pkg-plist and in the ports Makefile
with other methodes.

In ports Makefile:

post-extract:
	${MV} ${WRKSRC}/config-file ${WRKSRC}/config-file.sample


In pkg-plist:
--- pkg-plist.orig      2011-07-10 19:20:36.000000000 +0200
+++ pkg-plist   2011-07-10 19:25:45.000000000 +0200
@@ -21,8 +21,9 @@
 red5/conf/red5-origin.xml
 red5/conf/red5.globals
 red5/conf/red5.policy
-red5/conf/red5.properties
-red5/conf/red5.properties.bak
+@unexec if cmp -s %D/red5/conf/red5.properties.sample
%D/red5/conf/red5.properties; then rm -f %D/red5/conf/red5.properties; fi
+red5/conf/red5.properties.sample
+@exec [ -f %D/red5/conf/red5.properties ] || cp
%D/red5/conf/red5.properties.sample %D/red5/conf/red5.properties
 red5/conf/red5.xml
 red5/conf/tomcat-users.xml
 red5/conf/truststore.jmx
@@ -1059,5 +1060,5 @@
 @dirrmtry red5/log
 @dirrm red5/lib
 @dirrm red5/conf/war
-@dirrm red5/conf
+@dirrmtry red5/conf
 @dirrmtry red5



Additional the pkg-plist file of the port should be sorted.

Please install ports-mgmt/genplist and generate a starting
pkg-plist with this tool!

Example usage:
$> cd ports/www/red5
$> make clean
$> genplist create /tmp
$> mv pkg-plist pkg-plist.old && mv pkg-plist.new pkg-plist

Now adjust missing settings like @dirrm -> @dirrmtry ..., then
$> genplist clean
$> genplist create /tmp

echo foo >> /tmp/red5/conf/red5.properties
pkg_delete red5...

You will notice your config file is preserved

If you have issues, I'm happy to help and then
pick up the PR with a good pkg-plist file ;)

--
Regards,
olli
Comment 3 Chris Rees freebsd_committer freebsd_triage 2011-08-12 13:23:00 UTC
State Changed
From-To: open->feedback

Hi Joris, Are you OK to work the fixes in that Olli suggested? If you're 
stuck, one of us will help you, just email.
Comment 4 Chris Rees freebsd_committer freebsd_triage 2011-08-12 17:01:01 UTC
On 12 August 2011 16:49, joris dedieu <joris.dedieu@gmail.com> wrote:
> 2011/8/12 =A0<crees@freebsd.org>:
>> Synopsis: [patch] www/red5 remove user data while reinstalling updating
>>
>> State-Changed-From-To: open->feedback
>> State-Changed-By: crees
>> State-Changed-When: Fri Aug 12 12:23:00 UTC 2011
>> State-Changed-Why:
>> Hi Joris, Are you OK to work the fixes in that Olli suggested? If you're
>> stuck, one of us will help you, just email.
>>
>> http://www.freebsd.org/cgi/query-pr.cgi?pr=3D157628
>>
>
> Hi crees,
> As there are many files in conf/ and webapps/root, maybe the best way
> is to install them in %%EXEMPLEDIR%%, make a copy =A0if %D/red5/conf and
> %D/red5/webapps/root don't exist and remove then only if no
> modification occurred.
>
> Something like :
>
> @unexec =A0diff -rq =A0%D/%%EXAMPLESDIR%%/conf %D/red5/conf >/dev/null
> 2>&1 && rm -fr %D/red5/conf
> @exec ! =A0[ -d %D/red5/conf =A0-o -L %D/red5/conf =A0] && cp -RP
> %D/%%EXAMPLESDIR%%/conf %D/red5/conf
>
> What do you think about it ?
>
> Joris

Hm, something like [1] would probably be easier, or we're going to be
looking at a monster plist.

I'm happy to adapt that script for your port if you'd like, or you can
have a play. Let me know!

Chris

[1] http://www.freebsd.org/cgi/cvsweb.cgi/ports/mail/mailscanner/files/pkg-=
install.in?rev=3D1.1;content-type=3Dtext%2Fx-cvsweb-markup
Comment 5 Chris Rees freebsd_committer freebsd_triage 2011-08-13 09:41:52 UTC
Responsible Changed
From-To: freebsd-ports-bugs->crees

I'll take it.
Comment 6 Mark Linimon 2011-08-13 10:39:47 UTC
----- Forwarded message from joris dedieu <joris.dedieu@gmail.com> -----

Date: Fri, 12 Aug 2011 17:49:23 +0200
From: joris dedieu <joris.dedieu@gmail.com>
To: crees@freebsd.org
Cc: freebsd-ports-bugs@freebsd.org
Subject: Re: ports/157628: [patch] www/red5 remove user data while
	reinstalling updating

Hi crees,
As there are many files in conf/ and webapps/root, maybe the best way
is to install them in %%EXEMPLEDIR%%, make a copy  if %D/red5/conf and
%D/red5/webapps/root don't exist and remove then only if no
modification occurred.

Something like :

@unexec  diff -rq  %D/%%EXAMPLESDIR%%/conf %D/red5/conf >/dev/null
2>&1 && rm -fr %D/red5/conf
@exec !  [ -d %D/red5/conf  -o -L %D/red5/conf  ] && cp -RP
%D/%%EXAMPLESDIR%%/conf %D/red5/conf

What do you think about it ?

Joris

----- End forwarded message -----
Comment 7 Chris Rees 2011-08-13 17:02:17 UTC
The canonical way to do it is to install each config file as a sample in 
the same dir and copy it over -- copying from EXAMPLESDIR is almost 
without precedent and not what people generally expect. Note that I'm 
not saying it's a bad idea :)

I'll have a play with for loops in pkg-plist and let you know.

Chris

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Comment 8 Chris Rees 2011-08-13 17:33:46 UTC
Yeah, I thought stuff clever scripts, I wrote code a while ago to make 
this kind of contortions obsolete, so for now I generated a plist the 
old-fashioned way (with @unexec cmp stuff) using perl.

I'm putting it through the Tinderbox now, the plist is at [1].

Chris

http://www.bayofrum.net/~crees/patches/red5-plist-big.txt

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Comment 9 Chris Rees freebsd_committer freebsd_triage 2011-08-13 20:43:02 UTC
State Changed
From-To: feedback->analyzed

Take for Tinderbox run: 

http://www.bayofrum.net/tb/index.php?action=describe_port&id=1212 

New patch at: 

http://www.bayofrum.net/~crees/patches/www-red5-userdata.diff 

Please let me know if it's OK, and I can commit it if Tinderbox doesn't 
complain :)
Comment 10 Joris Dedieu 2011-08-14 00:31:01 UTC
2011/8/13  <crees@freebsd.org>:
> Synopsis: [patch] www/red5 remove user data while reinstalling updating
>
> State-Changed-From-To: feedback->analyzed
> State-Changed-By: crees
> State-Changed-When: Sat Aug 13 19:43:02 UTC 2011
> State-Changed-Why:
> Take for Tinderbox run:
>
> http://www.bayofrum.net/tb/index.php?action=describe_port&id=1212
>
> New patch at:
>
> http://www.bayofrum.net/~crees/patches/www-red5-userdata.diff
>
> Please let me know if it's OK, and I can commit it if Tinderbox doesn't
> complain :)
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=157628
>

Sounds good to me. As far as I test it doesn't remove user data anymore.
Joris
Comment 11 Chris Rees freebsd_committer freebsd_triage 2011-08-14 08:51:09 UTC
I'll stick a note in UPDATING to back up configurations, because although
we'll have fixed it, installed packages will still remove the files.

Chris
Comment 12 Chris Rees freebsd_committer freebsd_triage 2011-08-15 07:53:12 UTC
State Changed
From-To: analyzed->closed

Committed. Thanks!
Comment 13 dfilter service freebsd_committer freebsd_triage 2011-08-15 07:53:12 UTC
crees       2011-08-15 06:53:03 UTC

  FreeBSD ports repository

  Modified files:
    www/red5             Makefile pkg-plist 
  Log:
  - Stop clobbering config files on deinstall.
  - Use post-patch for sed rather than pre-install.
  
  PR:             ports/157628
  Submitted by:   Joris Dedieu <joris.dedieu@gmail.com> (maintainer)
  
  Revision  Changes    Path
  1.8       +17 -1     ports/www/red5/Makefile
  1.2       +144 -52   ports/www/red5/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"