[lxc-devel] [PATCH] lxc-plamo: keep original uid/gid of files/dirs when installing

Stéphane Graber stgraber at ubuntu.com
Fri Sep 19 20:57:31 UTC 2014


On Fri, Sep 05, 2014 at 07:29:29AM +0900, TAMUKI Shoichi wrote:
> Regardless of whether "installpkg" command exists or not, install the
> command temporarily with static linked tar command into the lxc cache
> directory to keep the original uid/gid of files/directories.  Also,
> use sed command instead of ed command for simplicity.
> 
> Signed-off-by: TAMUKI Shoichi <tamuki at linet.gr.jp>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  templates/lxc-plamo.in | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/templates/lxc-plamo.in b/templates/lxc-plamo.in
> index 82a9e78..ce98c1a 100644
> --- a/templates/lxc-plamo.in
> +++ b/templates/lxc-plamo.in
> @@ -123,14 +123,13 @@ install_plamo() {
>          return 1
>        fi
>      fi
> -    if [ ! -x /sbin/installpkg  ] ; then
> -      echo "'installpkg' command is missing."
> -      echo "Installing 'installpkg' command into $dlcache/sbin..."
> -      ( cd $dlcache ; tar xpJf hdsetup-*.txz ; rm -rf tmp usr var )
> -      sed -i "/ldconfig/!s@/sbin@$dlcache&@g" $dlcache/sbin/installpkg*
> -      sed -i "/^TAR=/s at tar@`which tar`@g" $dlcache/sbin/installpkg2
> -      PATH=$dlcache/sbin:$PATH
> -    fi
> +    # install "installpkg" command temporarily with static linked tar
> +    # command into the lxc cache directory to keep the original uid/
> +    # gid of files/directories.
> +    echo "Installing 'installpkg' command into $dlcache/sbin..."
> +    ( cd $dlcache ; tar xpJf hdsetup-*.txz ; rm -rf tmp usr var )
> +    sed -i "/ldconfig/!s@/sbin@$dlcache&@g" $dlcache/sbin/installpkg*
> +    PATH=$dlcache/sbin:$PATH
>      echo "Installing packages to $rtcache..."
>      if [ ! -d $rtcache ] ; then
>        mkdir -p $rtcache
> @@ -239,10 +238,7 @@ configure_plamo() {
>    rm -f $rootfs/etc/rc.d/rc.inet1.tradnet
>    sh /tmp/netconfig.rconly
>    rm -f /tmp/netconfig.rconly
> -  ed - $rootfs/etc/rc.d/rc.inet1.tradnet <<- "EOF"
> -	g/cmdline/s/if/& false \&\&/
> -	w
> -	EOF
> +  sed -i '/cmdline/s/if/& false \&\&/' $rootfs/etc/rc.d/rc.inet1.tradnet
>    return 0
>  }
>  
> -- 
> 1.9.0
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140919/5a1fa309/attachment.sig>


More information about the lxc-devel mailing list