All,

I thought that since the usr merge is coming up again, and since I lost
track of the message where it was brought up, I would open a
new thread to discuss it.

When it came up before, some were saying that the /usr merge violates
the fhs. I don't remember the specifics of what the claim was at the
time, (I'm sure someone will point it out if it is still a concern).

I don't think creating usr merged stages would be that difficult. I
think it would just be a matter of creating a new version of baselayout
that puts these symlinks in place:

/bin->usr/bin
/lib->usr/lib
/lib32->usr/lib32
/lib64->usr/lib64
/sbin->usr/bin
/usr/sbin->bin

Once that is in place in a new baselayout, I think portage's colission
detection would be able to catch files that had the same names and were
originally in different paths when building the new stages.

I put some thought also in how to nigrate live systems, and I'm not sure
what the best way to do that is. I wrote a script, which would do it in
theory, but I haven't tested because I only have one system and if
it breaks it the only way back would be to reinstall.

The script is attached.


Thoughts on any of this?

William

#!/bin/bb

is_internal()
{
        [ -z "$1" ] && return 1
        case $(command -v $1) in
                */*) rc=1 ;;
                *) rc=0 ;;
        esac
        return $rc
}

run_command()
{
        local dryrun=
        [ $DRYRUN -eq 1 ] && dryrun=echo
        $dryrun "$@"
}

for cmd in cp ln; do
        if ! is_internal $cmd; then
                echo "Please rebuild busybox and include the $cmd command."
                exit 1
        fi
done

if [ -L /bin -a -L /sbin ]; then
        echo "It appears that the /usr merge has already been done on this 
system."
        exit 0
fi

DRYRUN=1
HELP=0
while [ $# -gt 0 ]; do
        case $1 in
                --dryrun|--dry-run) DRYRUN=1 ;;
                -h|--help) HELP=1 ;;
        esac
        shift
done

if [ $HELP -eq 1 ]; then
        echo "$(basename $0) -h \| --help - displays this message"
        echo "$(basename $0) --dryrun \| --dry-run  - show what would be done"
        exit 0
fi

# copy binaries
for dir in /bin /sbin /usr/sbin; do
        run_command cp -a $dir/* /usr/bin
done

# copy libraries
for dir in /lib*; do
        [ -L $dir ] && continue
        run_command cp -a $dir/* /usr$dir
done

# Create the /usr merge compatibility symlinks
for dir in /bin /sbin; do
run_command rm -rf $dir
run_command ln -s usr/bin $dir
done
run_command rm -rf /usr/sbin
run_command ln -s bin /usr/sbin
for dir in /lib*; do
        run_command rm -rf $dir
        run_command ln -s usr$dir $dir
done

Attachment: signature.asc
Description: Digital signature

Reply via email to