Source: debianutils
Version: 5.1-1
Severity: normal
Tags: patch

Hi,

creating a sub-essential chroot based on busybox used to work:

mmdebstrap --variant=custom \
        
--include=base-files,base-passwd,busybox,debianutils,dpkg,libc-bin,mawk,tar \
        --extract-hook='chroot "$1" busybox --install -s' \
        unstable /dev/null

But probably since 5.1-1 it fails with:

--%<---------------------------------------------------------------------
Setting up debianutils (5.3-1) ...
chmod: unrecognized option '--reference=/etc/shells'
BusyBox v1.30.1 (Debian 1:1.30.1-6+b3) multi-call binary.

Usage: chmod [-Rcvf] MODE[,MODE]... FILE...

Each MODE is one or more of the letters ugoa, one of the
symbols +-= and one or more of the letters rwxst

        -R      Recurse
        -c      List changed files
        -v      List all files
        -f      Hide errors
dpkg: error processing package debianutils (--install):
 installed debianutils package post-installation script subprocess returned 
error exit status 1
-->%---------------------------------------------------------------------


The following patch fixes the problem with chmod and sync (the busybox
version only has the short option):

--- a/update-shells
+++ b/update-shells
@@ -133,14 +133,14 @@ done
 
 if [ "$NOACT" = 0 ]; then
        if [ -e "$STATE_FILE" ]; then
-               chmod --reference="$STATE_FILE" "$NEW_STATE_FILE"
-               chown --reference="$STATE_FILE" "$NEW_STATE_FILE"
+               chmod $(stat -c %a "$STATE_FILE") "$NEW_STATE_FILE"
+               chown $(stat -c %a "$STATE_FILE") "$NEW_STATE_FILE"
        else
                chmod 0644 "$NEW_STATE_FILE"
        fi
-       chmod --reference="$SOURCE_ETC_FILE" "$NEW_ETC_FILE"
-       chown --reference="$SOURCE_ETC_FILE" "$NEW_ETC_FILE"
-       sync --data "$NEW_ETC_FILE" "$NEW_STATE_FILE"
+       chmod $(stat -c %a "$SOURCE_ETC_FILE") "$NEW_ETC_FILE"
+       chown $(stat -c %a "$SOURCE_ETC_FILE") "$NEW_ETC_FILE"
+       sync -d "$NEW_ETC_FILE" "$NEW_STATE_FILE"
        mv "$NEW_ETC_FILE" "$TARGET_ETC_FILE"
        sync "$TARGET_ETC_FILE"
        sync "$(dirname "$TARGET_ETC_FILE")"


Thanks!

cheers, josch

Reply via email to