Skip to content

makeself removes directory name when specifying directory without sub-directories #314

@PeterWhittaker

Description

@PeterWhittaker

Given a directory bin containing two files, test1 and test2, I would expect different behaviour when running the two commands

makeself --current ./bin ~/test.sh test_label
cd bin; makeself --current . ~/test.sh test_label

but the results are exactly the same:

Adding files to archive named "test.sh"...
./test1
./test2

The second command does what I would expect: it creates an archive containing the contents of bin, but without any path information. This is consistent with cd bin; tar cf ../test.tar ., for example. Perfect!

But I would expect the first command to be consistent with tar cf test.tar ./bin, that is, I would expect it to preserve the relative path information. In other words, I would expect

Adding files to archive named "test.sh"...
./bin/test1
./bin/test2

After all, if I go to bin's parent directory, and execute makeself --current . test.sh somelabel, I get

Adding files to archive named "test.sh"...
./bin/test1
./bin/test2

which, again, is consistent with cd ..; tar cf test.tar . (assuming one started in bin).

FWIW, I discovered this while attempting to incrementally build a self-extractor of only parts of my current working directory. E.g., I have a directory containing .git, bin, etc, var, lib, wlp, examples, README, Makefile, testing, etc., and I only want to include bin, etc, lib, and var in my archive.

In other words, I wanted to do

makeself --current ./bin test.sh somelabel
makeself --append ./lib test.sh somelabel
makeself --append ./etc test.sh somelabel
makeself --append ./var test.sh somelabel

but everything ends up being flattened, which is not what I expected.

The only supported way to do this is to use --tar-extra --exclude=wlp --exclude examples --exclude Makefile..., which is a bit clunky, since I may have far more directories that aren't bin, etc, lib, or var. (I've tried getting a man 7 glob pattern that works but have had no luck.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions