google / mount-zip

FUSE file system for ZIP archives
GNU General Public License v3.0
158 stars 16 forks source link

Create install dir if it doesn't exist yet #17

Closed tenzap closed 7 months ago

tenzap commented 7 months ago

When running make install, it fails if the destination dir doesn't exist yet. Please create the destination dir if required.

install --strip-program=true "mount-zip" "/mnt/packages/git_repos/dpkg/mount-zip/mount-zip-1.0.13/debian/mount-zip/usr/bin/mount-zip"
install: WARNING: ignoring --strip-program option as -s option was not specified
install: cannot create regular file '/mnt/packages/git_repos/dpkg/mount-zip/mount-zip-1.0.13/debian/mount-zip/usr/bin/mount-zip': No such file or directory

Same issue when installing the manpage

fdegros commented 7 months ago

According to the Makefile, the install program is already called with the -D option, which should create all the intermediary directories.

Example:

$ DESTDIR=/tmp/a/b/c make install                                    
...
install -D "mount-zip" "/tmp/a/b/c/usr/bin/mount-zip"
install -D -m 644 mount-zip.1 "/tmp/a/b/c/usr/share/man/man1/mount-zip.1"

$ tree /tmp/a
/tmp/a
└── b
    └── c
        └── usr
            ├── bin
            │   └── mount-zip
            └── share
                └── man
                    └── man1
                        └── mount-zip.1

8 directories, 2 files

$ rm -r /tmp/a

$ tree /tmp/a
/tmp/a  [error opening dir]

0 directories, 0 files

$ DESTDIR=/tmp/a/b/c make install-strip
...
install -D -s "mount-zip" "/tmp/a/b/c/usr/bin/mount-zip"
install -D -m 644 mount-zip.1 "/tmp/a/b/c/usr/share/man/man1/mount-zip.1"

$ tree /tmp/a
/tmp/a
└── b
    └── c
        └── usr
            ├── bin
            │   └── mount-zip
            └── share
                └── man
                    └── man1
                        └── mount-zip.1

8 directories, 2 files

So, I'm not sure how you could run into the situation you described. For example, your traces show that the install program is called with --strip-program=true, but this string is nowhere to be found in mount-zip's makefiles.

tenzap commented 7 months ago

This is how the debian package calls make install. It looks like the packager calls it by overriding INSTALL.

dh_auto_install --destdir=debian/mount-zip/
    install -m0755 -d /builds/bastif/mount-zip/debian/output/source_dir/debian/mount-zip
    make -j2 install DESTDIR=/builds/bastif/mount-zip/debian/output/source_dir/debian/mount-zip AM_UPDATE_INFO_DIR=no "INSTALL=install --strip-program=true"
tenzap commented 7 months ago

Would you consider something like that? Ie. keep only the name/path of the binary in INSTALL, and move the -D argument to INSTALL_PROGRAM & INSTALL_DATA

--- a/Makefile
+++ b/Makefile
@@ -36,9 +36,9 @@
 MAN = $(DEST).1
 MANDIR = $(prefix)/share/man/man1
 CLEANFILES = $(OBJECTS) $(DEST)
-INSTALL = install -D
-INSTALL_PROGRAM = $(INSTALL)
-INSTALL_DATA = $(INSTALL) -m 644
+INSTALL = install
+INSTALL_PROGRAM = $(INSTALL) -D
+INSTALL_DATA = $(INSTALL) -D -m 644

 all: $(DEST)