Package create - how to add "home" directory in .hpkg files?

Hi again,

I’m trying to create a .hpkg for ThinkFree Office 4.0 (since every download link gives 404 error)
I found a .zip file uploadet by 3dEyes, but it does not run on the current nightlies. i got it to run by replacing the jre folder with a symlink.

->but now to my problem:
i found a tutorial on how to create .hpkg files, but that does not cover how i can add folders outside of the system folder.

i want to add .xls, .ppt and .doc templates to /boot/home/config/settings/Tracker/Tracker New Templates/ but how to do that with the “package” command?

looking into other packages installed on my machine, i can’t find a single package that does that so i got no reference.

thank you,
core36

You create a shell script in boot/post-install that does it for you.

But an hpkg for Thinkfree already exists. Look for it on BeShare.

Thank you for your quick reply.

ok creating a shell script sounds good to me, but i would need more information. like, is there some temp folder where i can put the template files so i can move them with the script? i don’t want to mess up my system and i don’t want my system to get messy (i guess nobody wants that). google doesn’t help much. it still thinks i want to write haikus on ubuntu if i type “haiku os”…

noob question: where can i find BeShare? google gives me beshare.com, but this site does not exist. looking further, i can only find some download link of a BeOS/Haiku chat tool but no thinkfree office hpkg.

BeShare is a file sharing and chat tool … get the latest one here… http://fatelk.com/repo/packages. Log in to BeShare and search for thinkfree office.

place your template files in a sub-folder of the app, and have the script copy them to the appropriate folder. The app folder is contained in the .hpkg file and is removed when the .hpkg is removed.

yeah, i found it. so it’s a limewire like chat/share tool.
but i still can’t find the hpkg file. bad timing and everyone that has the file is offline? my luck :frowning:

anyway i will try the solution with the script.

thanks :smiley:

now that i tried using the shell script, i got an error while installing.

failed to remove transaction directory: Directory not empty

it seems like everything installs, but the script either is wrong, or it just doesn’t get executed.

my script looks like this:

#!/bin/sh

srcPath="/boot/system/apps/ThinkFree Office 4.0/templates"
destPath="/boot/home/config/settings/Tracker/Tracker New Templates"
cp -v “$srcPath”/* “$destPath”/

my .PackageInfo:

name tfo_trial_x86
version 4.0-1
architecture x86_gcc2

summary "A Java based MS Office alternative."
description “Contains alternatives for Word, Excel and Powerpoint.”

packager "core36"
vendor “Hancom Inc.”

copyrights "Hancom Inc."
licenses “ThinkFreeOffice”

provides {
tfo_trial_x86 = 4.0-1
}

requires {
openjdk_x86 >= 1.7.u80_b32-3
}

post-install-scripts {
boot/post-install/tfo_install_templates.sh
}

I’m on hrev50280

The “failed to remove transaction directory: Directory not empty” bug is not necessarily your fault. We all see it from time to time. There’s a two-year old bug report on it: https://dev.haiku-os.org/ticket/10959

Ok thank you for the information. i cleared out the transaction-N folders (1-10) and now the error didn’t show up. but so did the script. it just won’t appear in the boot/post-install directory. the only thing i found was a broken symlink in the /boot/system/packages/administrative/queued-scripts directory… can you maybe point me to a package that uses post-install-scripts? maybe my paths are wrong or something like that, but i can only find incomplete documentations on it.
also i found some chat log file from 2014 stating that the post-install-scripts are a planned feature but do not actually work, but i hope that is old information?

It’s working, all right. Go here: https://depot.haiku-os.org/#/pkg/backontrack/clasqm/1/2/-/-/3/x86_gcc2?bcguid=bc471-CVFA and download the hpkg from the link at the bottom of the page. That should give you something to work from (and it’s not too big). A mistake I made in the beginning in the .PackageInfo was to use

post-install-script {
“boot/post-install/post_BackOnTrack.sh”
}

because I only had one, right? But it really is

post-install-scripts {
“boot/post-install/post_BackOnTrack.sh”
}

Your example above didn’t make THAT particular error, but it shows how easily one can go astray. another easy mistake to make is

package create -b myGreatApp_1.2-3_x86_gcc2.hpkg
package add myGreatApp_1.2-3_x86_gcc2.hpkg data bin apps documentation

oops, I forgot about the boot directory there

package add myGreatApp_1.2-3_x86_gcc2.hpkg data bin apps documentation boot

I’ve long lost count of the number of times I made THAT particular error. The order in which you list those directories does not seem to matter, btw.

Sorry, I can’t se any obvious errors in your .PackageInfo. Just keep testing it.

PS did you remember to chmod +x your shell script? Just checking. If your script works from Terminal, it really should work in the packaging system.

What I have noticed is that the post-install scripts seem to operate in a rather restricted environment. Your script may be running short of memory. So take it one step at a time. Copy a small number of files, even one at a time, rather than trying to copy a hundred all in one go.

In one or two cases I had to create a shellscript on the desktop and my post-install script just was an Alert that said “click on that new script on your desktop”. What I was trying to do just didn’t work in the post-install environment. Still, you won’t know till you try.

Thanks for your answer, michel.

the package you posted did help me a lot. i could solve the error, but i’m not sure what the real issue was.

one thing i changed was that i didn’t put any quotation marks in my post-install-scripts list. i also now made the script executable with chmod, but the script did work without that before (from terminal) so im not sure if that helped. i checked my .PackageInfo twice for any other errors, but i couldn’t find any.

but changing that did nothing until i moved the package into the /boot/system/packages folder by hand, as i only tried the HaikuDepot app until now.
for some reason, reinstalling -removing the package form the /boot/system/packages folder and installing it using the HaikuDepot app- works now without problems.

so it does work now, but i’m not quite sure what did the trick. thank you for your help.

this wasn’t one of the problems, but good to know, i will keep it in mind

I’ve only two partially related question remaining:

  1. is there something like an uninstall-script? i want to delete the files copied by my script if i decide to uninstall the package.
  2. and also can/should i remove the post-install script after installation, or does the package management system need the file for some reason?
  1. Not to my knowledge. Deleting the package removes the package files, but not the things you did in the post-install script.

  2. I don’t think you can. /boot/system/boot and /boot/home/config/boot are write-only virtual directories AFAIK.