Solved Install companion script for Rust package

Chuck Musser

New Member

Thanks: 1
Messages: 10

#1
My Rust project's port has a small script intended to be used in conjunction with the binary that the package installs. Currently this script is located in the base of my Git repository (it doesn't get installed in the target/release/bin/ subdirectory, because the Cargo build process is not aware of it). I futzed around some to try to get this into the package, all of which involved tweaks to the Makefile and pkg-plist, but no luck. Here's what I tried:

Makefile:
do-install:                                                                           

        ${INSTALL_SCRIPT} ${WRKSRC}/ipfw-ssh.sh ${PREFIX}/bin
This resulted in the check-orphans target failing because none of the things in my pkg-plist file got installed in the staging area. I think this might be because the default installation steps got replaced by the single step above.

Makefile:
post-install:                                                                           

        ${INSTALL_SCRIPT} ${WRKSRC}/ipfw-ssh.sh ${PREFIX}/bin
This allowed the pkg-plist stuff to get installed in the staging area, but it put the script in my actual /usr/local/bin/ directory, not the staging area. So maybe $PREFIX is not the right variable.

I tried altering the target path above to be ${STAGEDIR}${PREFIX}, which did put the script in the stage directory, but then the check-orphans step failed and the package ended up not containing the script. The error was
Bash:
xo% sudo make check-orphans

====> Checking for pkg-plist issues (check-plist)

===> Parsing plist

===> Checking for items in STAGEDIR missing from pkg-plist

Error: Orphaned: bin/ipfw-ssh.sh

===> Checking for items in pkg-plist which are not in STAGEDIR

===> Error: Plist issues found.

*** Error code 1
Hm. This has to be possible. How can I get this script into my package? I couldn't figure out from the porters handbook page on installing files how to do this.

Chuck
 
OP
OP
C

Chuck Musser

New Member

Thanks: 1
Messages: 10

#2
I also tried adding this entry to the package-plist:

bin/ipfw-ssh.sh

That didn't help. Got an odd error from check-orphans where it looks like it's combining paths with the rc script that lives in the files subdirectory.

Bash:
sudo make check-orphans

====> Checking for pkg-plist issues (check-plist)

===> Parsing plist

===> Checking for items in STAGEDIR missing from pkg-plist

Error: Orphaned: bin/ipfw-ssh.sh

Error: Orphaned: etc/rc.d/accessd

===> Checking for items in pkg-plist which are not in STAGEDIR

Error: Missing: bin/ipfw-ssh.sh/usr/local/etc/rc.d/accessd

===> Error: Plist issues found.

*** Error code 1
 
OP
OP
C

Chuck Musser

New Member

Thanks: 1
Messages: 10

#4
I can't figure out which part of that chapter addresses this particular situation. One thing I did try was having `make makeplist` generate the packing list. That added one additional item (for an rc script that being managed automatically via USE_RC_SUBR= in the Makefile). That caused check-orphans to fail with "Error: Missing: etc/rc.d/accessd"

I guess I'm looking for some specific advice on how to make this work. Is there a particular section, or maybe an example of adding file to a package I could look at?
 
OP
OP
C

Chuck Musser

New Member

Thanks: 1
Messages: 10

#5
OK, I bungled something before and didn't realize it. The things that seemed like the obvious changes worked. After starting over with a "make clean" of the package, the following mods to the Makefile and the pkg-plist file resulted in the companion script getting added to the installable package.

The upshot is: you invoke the macro for installing scripts in the "post-install" make target and make sure that the file you're installing shows up in the package manifest.

This was added to the Makefile:
post-install:
${INSTALL_SCRIPT} ${WRKSRC}/ipfw-ssh.sh ${STAGEDIR}${PREFIX}/bin

This was added to pkg-plist:
bin/ipfw-ssh.sh
 
Top