Commit d0348408 by TAMUKI Shoichi Committed by Stéphane Graber

lxc-plamo: keep original uid/gid of files/dirs when installing

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: 's avatarTAMUKI Shoichi <tamuki@linet.gr.jp> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 67702c21
...@@ -123,14 +123,13 @@ install_plamo() { ...@@ -123,14 +123,13 @@ install_plamo() {
return 1 return 1
fi fi
fi fi
if [ ! -x /sbin/installpkg ] ; then # install "installpkg" command temporarily with static linked tar
echo "'installpkg' command is missing." # command into the lxc cache directory to keep the original uid/
echo "Installing 'installpkg' command into $dlcache/sbin..." # gid of files/directories.
( cd $dlcache ; tar xpJf hdsetup-*.txz ; rm -rf tmp usr var ) echo "Installing 'installpkg' command into $dlcache/sbin..."
sed -i "/ldconfig/!s@/sbin@$dlcache&@g" $dlcache/sbin/installpkg* ( cd $dlcache ; tar xpJf hdsetup-*.txz ; rm -rf tmp usr var )
sed -i "/^TAR=/s@tar@`which tar`@g" $dlcache/sbin/installpkg2 sed -i "/ldconfig/!s@/sbin@$dlcache&@g" $dlcache/sbin/installpkg*
PATH=$dlcache/sbin:$PATH PATH=$dlcache/sbin:$PATH
fi
echo "Installing packages to $rtcache..." echo "Installing packages to $rtcache..."
if [ ! -d $rtcache ] ; then if [ ! -d $rtcache ] ; then
mkdir -p $rtcache mkdir -p $rtcache
...@@ -239,10 +238,7 @@ configure_plamo() { ...@@ -239,10 +238,7 @@ configure_plamo() {
rm -f $rootfs/etc/rc.d/rc.inet1.tradnet rm -f $rootfs/etc/rc.d/rc.inet1.tradnet
sh /tmp/netconfig.rconly sh /tmp/netconfig.rconly
rm -f /tmp/netconfig.rconly rm -f /tmp/netconfig.rconly
ed - $rootfs/etc/rc.d/rc.inet1.tradnet <<- "EOF" sed -i '/cmdline/s/if/& false \&\&/' $rootfs/etc/rc.d/rc.inet1.tradnet
g/cmdline/s/if/& false \&\&/
w
EOF
return 0 return 0
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment