2013-11-01

Slitaz -- lxc / rm

rm: unrecognized option '--preserve-root'

Fix: coreutils-operations dont remove cp/rm in post_install, we need them to install


1.
root@slitaz:/home/tux# lxc-create -n slitaz-lxc -t busybox
rm: unrecognized option '--preserve-root'   

Command line: rm -rf --preserve-root /var/lib/lxc/slitaz-lxc

BusyBox v1.18.4 (2012-03-14 03:32:25 CET) multi-call binary.

Usage: rm [-irf] FILE...

Remove (unlink) FILEs

Options:
    -i    Always prompt before removing
    -f    Never prompt
    -R,-r    Recurse


2.
root@slitaz:/home/tux# ls -l /bin/rm /usr/bin/rm
lrwxrwxrwx    1 root     root            12 Nov  1 23:37 /bin/rm -> /bin/busybox
-rwxr-xr-x    1 root     root         55487 Nov  1 11:08 /usr/bin/rm


3.
root@slitaz:/home/tux# which rm
/usr/bin/rm


4.
root@slitaz:/home/tux# echo $PATH
/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/sbin:/usr/local/bin


5.
root@slitaz:/home/tux# rm --version
rm (GNU coreutils) 8.12
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
and Jim Meyering.


6.
root@slitaz:/home/tux# rm --help | grep root
      --no-preserve-root  do not treat `/' specially
      --preserve-root   do not remove `/' (default)


7.
Receipt for: coreutils-operations
http://cook.slitaz.org/cooker.cgi?receipt=coreutils-operations

# SliTaz package receipt.

PACKAGE="coreutils-operations"
VERSION="8.12"
CATEGORY="system-tools"
SHORT_DESC="GNU utilities that perform basic operations."
MAINTAINER="rcx@zoominternet.net"
LICENSE="GPL3"
WEB_SITE="http://www.gnu.org/software/coreutils/"
WANTED="coreutils"

DEPENDS="glibc-base acl"

# Rules to gen a SliTaz package suitable for Tazpkg.
#
# This is a special package for installed system or developer. We only take
# a few things, as Busybox provides all the basic utilities, but not for compiling.
# But DO NOT erase a Busybox applet, remove it before with pre_install rules.
#
genpkg_rules()
{
    mkdir -p $fs/bin
    #cp -a $install/usr/bin/cp $fs/bin
    cp -a $install/usr/bin/dd $fs/bin
    cp -a $install/usr/bin/mv $fs/bin
    cp -a $install/usr/bin/ln $fs/bin
    #cp -a $install/usr/bin/rm $fs/bin

    mkdir -p $fs/usr/bin
    cp -a $install/usr/bin/install $fs/usr/bin
    cp -a $install/usr/bin/shred $fs/usr/bin
}

# Pre and post install commands for Tazpkg.
# We must remove all Busybox symlink before installing.
#
pre_install()
{
    local root
    root=$1
    echo "Processing pre-install commands..."
    echo -n "Removing all Busybox replaced utils... "
    rm -f $root/bin/dd $root/bin/mv $root/bin/ln
    rm -f $root/usr/bin/install $root/usr/bin/shred
    # Dont remove cp/rm or the installation will fail because tazpkg use
    # cp and rm during the process.
    #
    #rm -f $root/bin/cp $root/bin/rm
    status
}

post_remove()
{
    # use busybox ln applet directly since /bin/ln
    # in this package is remove already
    /bin/busybox ln -s /bin/busybox $1/bin/cp
    /bin/busybox ln -s /bin/busybox $1/bin/dd
    /bin/busybox ln -s /bin/busybox $1/bin/mv
    /bin/busybox ln -s /bin/busybox $1/bin/ln
    /bin/busybox ln -s /bin/busybox $1/bin/rm
    /bin/busybox ln -s /bin/busybox $1/usr/bin/install
    /bin/busybox ln -s /bin/busybox $1/usr/bin/shred
}


8.
Fix: coreutils-operations dont remove cp/rm in post_install, we need them to install
http://hg.slitaz.org/wok/raw-rev/59b766d69633

# HG changeset patchs
# User Christophe Lincoln <pankso@slitaz.org>
# Date 1253559865 -7200
# Node ID 59b766d69633316bc1a1b70fe1d8e2a30c43d279
# Parent  6ef3727f527d032a1515dd96bece7bea625c3b8a
Fix: coreutils-operations dont remove cp/rm in post_install, we need them to install

diff -r 6ef3727f527d -r 59b766d69633 coreutils-operations/receipt
--- a/coreutils-operations/receipt    Mon Sep 21 13:37:43 2009 +0200
+++ b/coreutils-operations/receipt    Mon Sep 21 21:04:25 2009 +0200
@@ -18,10 +18,10 @@
 genpkg_rules()
 {
     mkdir -p $fs/bin
-    cp -a $_pkg/usr/bin/cp $fs/bin
+    #cp -a $_pkg/usr/bin/cp $fs/bin
     cp -a $_pkg/usr/bin/dd $fs/bin
     cp -a $_pkg/usr/bin/mv $fs/bin
-    cp -a $_pkg/usr/bin/rm $fs/bin
+    #cp -a $_pkg/usr/bin/rm $fs/bin

     mkdir -p $fs/usr/bin
     cp -a $_pkg/usr/bin/install $fs/usr/bin
@@ -37,8 +37,12 @@
     root=$1
     echo "Processing pre-install commands..."
     echo -n "Removing all Busybox replaced utils... "
-    rm -f $root/bin/cp $root/bin/dd $root/bin/mv $root/bin/rm
+    rm -f $root/bin/dd $root/bin/mv
     rm -f $root/usr/bin/install $root/usr/bin/shred
+    # Dont remove cp/rm or the installation will fail because tazpkg use
+    # cp and rm during the process.
+    #
+    #rm -f $root/bin/cp $root/bin/rm
     status
 }