tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: directory migration on upgrade



On Thu, 18 Oct 2012, Emmanuel Dreyfus wrote:

> glusterfs-3.2.7 had its config in ${SYSCONFDIR}/glusterd
> glusterfs-3.3.1 has its config in ${VARBASE}/lib/glusterd
> 
> I am not big fan of /var/lib stuff, but it seems wise to stick to
> upstream approach. I understand the rationale is that the config file
> should not be touched by hand and are modified only by command line
> tools, hence the storage in /var
> 
> glusterfs 3.3.1 make install performa the migration: it checks for
> ${SYSCONFDIR}/glusterd being a directory, moves it to
> ${VARBASE}/lib/glusterd, and make a symlink from previous to new
> location.
> 
> How can I handle that in pkgsrc? I tried adding this at the end of
> PLIST:
> 
> @exec test -d ${SYSCONFDIR}/glusterd -a ! -d ${VARBASE}/lib/glusterd &&
> ${MKDIR} -p ${VARBASE}/lib/ && mv ${SYSCONFDIR}/glusterd
> ${VARBASE}/lib/glusterd && ${LN} -s ${VARBASE}/lib/glusterd
> ${SYSCONFDIR}/glusterd
> 
> This is the result at pkg_add time:
> 
> # pkg_add glusterfs
> Executing 'test -d ${SYSCONFDIR}/glusterd -a ! -d
> ${VARBASE}/lib/glusterd && /bin/mkdir -p -p ${VARBASE}/lib/ && mv
> ${SYSCONFDIR}/glusterd  ${VARBASE}/lib/glusterd && /bin/ln -s
> ${VARBASE}/lib/glusterd  ${SYSCONFDIR}/glusterd'
> pkg_add: command 'test -d ${SYSCONFDIR}/glusterd -a ! -d
> ${VARBASE}/lib/glusterd && /bin/mkdir -p -p ${VARBASE}/lib/ && mv
> ${SYSCONFDIR}/glusterd  ${VARBASE}/lib/glusterd && /bin/ln -s
> ${VARBASE}/lib/glusterd  ${SYSCONFDIR}/glusterd' failed


May need to define in Makefile:
PLIST_SUBST+= VARBASE=${VARBASE}
PLIST_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
and use ${PKG_SYSCONFDIR}.

Also consider using a INSTALL script with post-install target instead of 
@exec.

> Any advice? How should it be done? Or should I just add a line about the
> migration in MESSAGE?

I think you should just use a MESSAGE. I don't know the configuration,
but since not managed by tools, I'd assume that some users may lose
comments and organization automatically if they just move it. They may
want to review it first. (I guess your script could create a backup copy 
instead though.



Home | Main Index | Thread Index | Old Index