On Mon, Apr 25, 2011 at 01:14:23PM -0500, George McCollister wrote:
> I added install_config which is the same as install_alternative except
> it also adds the file name to conffiles inside of the .ipk file so it is
> handled by the package manager as a config file.

Can you move this patch to the begining of the patch series (before adding
the opkg stuff)? This way I can merge it now. The opkg stuff will problably
take a bit longer before it can be merged.

More below.

> Signed-off-by: George McCollister <george.mccollis...@gmail.com>
> ---
>  rules/post/install.make              |   28 ++++++++++++++++++++++++++++
>  scripts/lib/ptxd_make_ipkg_common.sh |    1 +
>  scripts/lib/ptxd_make_opkg_common.sh |    1 +
>  scripts/lib/ptxd_make_xpkg_pkg.sh    |   24 ++++++++++++++++++++----
>  4 files changed, 50 insertions(+), 4 deletions(-)
> 
> diff --git a/rules/post/install.make b/rules/post/install.make
> index 4a18ba3..1c609be 100644
> --- a/rules/post/install.make
> +++ b/rules/post/install.make
> @@ -87,6 +87,34 @@ install_alternative =                                      
>                                 \
>       echo "ptxd_install_alternative '$$FILE' '$$DST' '$$OWN' '$$GRP' '$$PER' 
> '$$STRIP'" >> "$(STATEDIR)/$$XPKG.cmds"
>  
>  #
> +# install_config
> +#
> +# Installs a config file with user/group ownership and permissions via
> +# fakeroot. Adds filename to conffiles
> +#
> +# This macro first looks in $(PTXDIST_WORKSPACE)/projectroot for the file to 
> copy and then
> +# in $(PTXDIST_TOPDIR)/generic and installs the file under $(ROOTDIR)
> +#
> +# $1: xpkg label
> +# $2: UID
> +# $3: GID
> +# $4: permissions (octal)
> +# $5: source file
> +# $6: (strip, obsolete)
> +# $7: destination (optional)
> +#
> +install_config =                                                             
>         \
> +     XPKG=$(subst _,-,$(strip $(1)));                                        
>         \
> +     OWN=$(strip $(2));                                                      
>         \
> +     GRP=$(strip $(3));                                                      
>         \
> +     PER=$(strip $(4));                                                      
>         \
> +     FILE=$(strip $(5));                                                     
>         \
> +     STRIP=$(strip $(6));                                                    
>         \
> +     DST=$(strip $(7));                                                      
>         \
> +     $(call install_check, install_config);                                  
> \
> +     echo "ptxd_install_config '$$FILE' '$$DST' '$$OWN' '$$GRP' '$$PER' 
> '$$STRIP'" >> "$(STATEDIR)/$$XPKG.cmds"
> +
> +#
>  # install_tree
>  #
>  # Installs all files and subdirectories with user/group ownership and
> diff --git a/scripts/lib/ptxd_make_ipkg_common.sh 
> b/scripts/lib/ptxd_make_ipkg_common.sh
> index 5d2f83a..450b4ab 100644
> --- a/scripts/lib/ptxd_make_ipkg_common.sh
> +++ b/scripts/lib/ptxd_make_ipkg_common.sh
> @@ -17,5 +17,6 @@ ptxd_make_ipkg_init() {
>      pkg_ipkg_tmp="${pkg_xpkg_tmp}/ipkg"
>      pkg_xpkg_control_dir="${pkg_ipkg_tmp}/CONTROL"
>      pkg_xpkg_control="${pkg_xpkg_control_dir}/control"
> +    pkg_xpkg_conffiles="${pkg_xpkg_control_dir}/conffiles"
>  }
>  export -f ptxd_make_ipkg_init
> diff --git a/scripts/lib/ptxd_make_opkg_common.sh 
> b/scripts/lib/ptxd_make_opkg_common.sh
> index ac6d672..dca8580 100644
> --- a/scripts/lib/ptxd_make_opkg_common.sh
> +++ b/scripts/lib/ptxd_make_opkg_common.sh
> @@ -17,5 +17,6 @@ ptxd_make_opkg_init() {
>      pkg_opkg_tmp="${pkg_xpkg_tmp}/opkg"
>      pkg_xpkg_control_dir="${pkg_opkg_tmp}/CONTROL"
>      pkg_xpkg_control="${pkg_xpkg_control_dir}/control"
> +    pkg_xpkg_conffiles="${pkg_xpkg_control_dir}/conffiles"
>  }
>  export -f ptxd_make_opkg_init
> diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh 
> b/scripts/lib/ptxd_make_xpkg_pkg.sh
> index 7cd35d7..c7128bc 100644
> --- a/scripts/lib/ptxd_make_xpkg_pkg.sh
> +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
> @@ -54,7 +54,7 @@ ptxd_install_setup_src() {
>  
>      local -a list
>  
> -    if [ "${cmd}" = "alternative" ]; then
> +    if [ "${cmd}" = "alternative" -o "${cmd}" = "config" ]; then
>       #
>       # if pkg_dir is empty we'll have some some empty entries in
>       # the array, but that's no problem for the "-e" below.
> @@ -205,9 +205,10 @@ install ${cmd}:
>           fi
>           ;;
>       *)
> -         if [ "${strip:0:1}" = "/" -a "${cmd}" = "alternative" ]; then
> +         if [ "${strip:0:1}" = "/" ] && \
> +               [ "${cmd}" = "alternative" -o "${cmd}" = "config" ]; then

Fix intent please.

>               ptxd_bailout "
> -the 6th parameter of 'install_alternative' is strip, not the destination.
> +the 6th parameter of 'install_${cmd}' is strip, not the destination.
>  Usually, just remove the 6th parameter and everything works fine.
>  "
>           fi
> @@ -222,7 +223,12 @@ Usually, just remove the 6th parameter and everything 
> works fine.
>      # now change to requested user and group
>      chown "${usr}:${grp}" "${pdirs[@]/%/${dst}}" &&
>  
> -    echo "f:${dst}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}"
> +    echo "f:${dst}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}" &&
> +
> +    # if this is a config file add it to conffiles so it's handled correctly
> +    if [ "${cmd}" = "config" ]; then
> +     echo "${dst}" >> "${pkg_xpkg_conffiles}"
> +    fi

Why not do this in ptxd_install_config? Then we can avoid the 'if'.

Michael

>  }
>  export -f ptxd_install_file_impl
>  
> @@ -303,6 +309,16 @@ ptxd_install_alternative() {
>  }
>  export -f ptxd_install_alternative
>  
> +ptxd_install_config() {
> +    local cmd="config"
> +    local src="${1}"
> +    local dst="${2}"
> +    shift 2
> +    ptxd_install_file_impl "${src}" "${dst:-${src}}" "${@}" ||
> +    ptxd_install_error "install_config failed!"
> +}
> +export -f ptxd_install_config
> +
>  ptxd_install_file() {
>      local cmd="file"
>      ptxd_install_file_impl "$@" ||
> -- 
> 1.7.1
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to