Packaging symlinks via rpmbuild? - symlink

Is it possible to make rpmbuild to preserve symlinks on packaging?
The current behavior is to create copies of files, which I would like to avoid.

Sure it supports symlinks. But you actually have to package symlink and not copy the contents to the buildroot. Example spec packaging a symlink to /bin directory called /newbin
Name: test
Version: 1.0
Release: 1%{?dist}
Summary: nothing
License: GPLv2
Source0: nothing
%description
%install
rm -rf %{buildroot}
mkdir %{buildroot}
ln -sf /bin %{buildroot}/newbin
%files
/newbin
You'll also need nothing file in your SOURCES directory to succesfully build rpm out of this. Tested with rpm 4.9.1.2

I know this Q is old, but here's how I do it.
In the %install section, simply touch the file that will be the symlink.
touch %{buildroot}[path to your file]
In the %files section, you specify it as a %ghost file:
%ghost [path to symlink file]
By doing this, it'll be listed as part of the package's files and will also be automatically removed when the package is uninstalled.
Finally, create the symlink in the %post section:
ln -sf [file to link to] [symlink]

I don't think so. I've used the post-install script set up symlinks in my packages.

Related

How can i create a .pkg mac installer for my binary?

I have a binary file, foo. Built using vercel/pkg.
I would like to bundle this in an installer for mac; A .pkg installer file.
It should install the binary in /usr/local/bin/foo.
Attempt:
$ cd Desktop // <--- foo binary is here
$ pkgbuild --identifier com.foo.pkg --install-location ./usr/local/bin/ --root ./ foo.pkg
This creates a .pkg file: foo.pkg on my desktop. And when i run foo.pkg, it installs the foo binary in /usr/local/bin correctly, except that it also leaves foo.pkg in /usr/local/bin also.
How can make pkgbuild avoid leaving foo.pkg inside /usr/local/bin?
UPDATE:
Based on this thread, I think it will work if i set BundleIsRelocatable to false. But I am not able to figure out how that is done.
When you pass --root, it takes everything in that folder and bakes it into the package. You're running pkgbuild in the root that you're building - it seems very likely that you have a copy of foo.pkg on your desktop that was created by an earlier run of pkgbuild. When you run it again, the old foo.pkg is now built into the new package.
Instead, point --root at a directory only containing the files you wish to package.
Otherwise, use --analyze to generate a component list of your root directory. Customize the resulting .plist as necessary (specifying the files you want to include and associated options), then feed it back into pkgbuild with --component-plist.
You should read the man page if you haven't already.

config.status: error: cannot find input file: `po/Makefile.in.in'

I hit this error message while trying to build gnote using GNU Autotools.
I had first run:
$ git clean -xf # to clean the tree of untracked files, then
$ autoreconf # to create the script named `configure`, and finally
$ ./configure # to check my system, and create Makefiles from their templates
Neither po/Makefile.in.in nor po/Makefile.in exist in the source tree that I downloaded.
Yet configure needs to make this po/Makefile, as called for in the root Makefile.am in this line:
SUBDIRS = data src po help
Where do I get, or how do I make, po/Makefile.in.in?
Like all Gnome related packages, gnote uses many steps of buildsystem setup beyond just running autoreconf.
The autogen.sh script gnote comes with should run all the required steps to set up the buildsystem.
As usual, run the autogen.sh script with the --help parameter if you want to call configure separately.
po/Makefile.in.in is created by running intltoolize from the intltool package. It needs to be run from the project tree's root directory.
There isn't much documentation on intltoolize that I could find except for the brief man page, but it's source code says that that it's a fork of an older utility called libtoolize, and it's a relatively short script.
(BTW, if you don't already have intltoolize installed, you can figure out which package installs it, with this: sudo apt-file find intltoolize.)
*.in files are templates used by AutoMake to create a Makefile.
.in.in is a soft link to /usr/share/intltool/Makefile.in.in.

Docker file, symlink disappears mid build

I have the following docker file (at the bottom). I am using another image to grab a precompiled library (utilities) and copying it into the route of a new image. I then need to symlink that directory into my node_modules directory. This works fine, I have 3 places where I prove the issue.
Check for the existence of the original root directory /utilities. This works, I can see the files
Then I create the symlink: ln -sf ...
I think check to see the contents at the location of the symlink. This works, I can see the files.
I go on to create the rest of the image
At the end I again list out the files, and now I get
ls: /usr/src/app/node_modules/#boiler/utilities: No such file or directory
It's like the symlink doesn't persist. If I run the container with shell: docker run -it --entrypoint=sh backend:latest and create the symlink it works.
Any thoughts as to where my symlink is going?
FROM utilities-setup:latest as build
FROM node:8.5.0-alpine
COPY --from=build /utilities /utilities
RUN ls -l /utilities <-- 1. THIS WORKS, FILES EXIST
#setup directories
RUN mkdir -p /usr/src/app/node_modules/#boiler/
WORKDIR /usr/src/app
#create symlink to the utilities module into the boiler module
RUN ln -sf /utilities /usr/src/app/node_modules/#boiler/
RUN ls /usr/src/app/node_modules/#boiler/utilities <-- 2. THIS WORKS, FILES EXIST
#copy the content of the backend to the current direcotry
COPY . .
RUN yarn install
RUN ls /usr/src/app/node_modules/#boiler/utilities <-- 3. THIS FAILS, NO MODULE
RUN ["chmod", "+x", "./scripts/prod.sh"]
EXPOSE 8080
ENTRYPOINT ["/usr/src/app/scripts/prod.sh"]
[see comment] I clocked the problem.
What was happening was the yarn install was recreating the node_modules directory, so you have to create the symlink after all other modules are installed. Makes sense I suppose, but I thought it would just write to the directory if it already existed

File Ownership Modification by productbuild and pkgbuild

I am trying to create an installer for a Java app on Mac OS 10.8.4. The app runs fine, and I can install it without a hitch from a zip file. I can create a .pkg installer with either productbuild or pkgbuild. I can also install either of the installer .pkg file successfully, however the app does not run properly due to the fact that both packaging programs change the ownership of a data directory and its subordinate files and subdirectories from user to root. I install this data directory in the Resources directory of the .app bundle, and the first time the program executes, it moves the data directory to /Users/user/Library/Application Support. I tried using the --ownership preserve and --ownership preserve-other options with pkgbuild to no avail. The only way I have been able to install and execute properly is via the zip file, since it leaves file ownership alone. Here is the pkgbuild command I am using:
pkgbuild --ownership preserve --component ./myApp.app ./myApp-installer.pkg
My questions are:
How can I force pkgbuild to honor my --ownership preserve option?
Is it possible to build a separate data-only package with user ownership and destined for the user area and merge it with the executable package via the --synthesize option of pkgbuild? if yes, could someone show me how to build such a data-only package?
I know it is quite old, I'll just answer in case someone else needs the answer.
What I usually do, is that I have a shell script which creates the .pkg file for me. In that script I set all the file permissions and ownership before packaging. Here is an example:
NAME="PKGFILENAME"
IDENTIFIER="com.pkg.APPNAME"
VERSION="1.0.0"
INSTALL_LOCATION="PATH_TO_WHERE_THE_FILES_SHOULD_BE_COPIED_ON_USERS_MACHINE"
ROOT_LOCATION="PATH_TO_WHERE_FILES_ARE_ON_YOUR_MASCHINE"
# Remove any unwanted .DS_Store files.
find "$ROOT_LOCATION" -name '*.DS_Store' -type f -delete
# put any command for changing the ownership or permissions here
chmod -R +r "$ROOT_LOCATION"
# Build package.
/usr/bin/pkgbuild \
--root "$ROOT_LOCATION" \
--install-location "$INSTALL_LOCATION" \
--identifier "$IDENTIFIER" \
--version "$VERSION" \
"$NAME.pkg"
save this something in a file like create-my-package.sh and run this in command line.

how do I solve `ld cannot find -something`

When I try running openFrameworks example audioOutputExample in CodeBlocks, I get the following errors:
in Debug:
ld cannot find -openframeworksDebug
in Release:
ld cannot find -openframeworks
How do I solve this?
UPDATES
Here is why I've tried up to now:
make
cd apps/examples/audioOutputExample/
make
[...]
compiling done
to launch the application
cd bin
./audioOutputExample
ok
cd bin
./audioOutputExample
./audioOutputExample: error while
loading shared libraries:
libfmodex.so: cannot open shared
object file: No such file or directory
Looking for openframeworksDebug
sudo updatedb
[password]
locate openframeworksDebug
[finds nothing]
ldconfig
ldconfig
/sbin/ldconfig.real: Can't create
temporary cache file
/etc/ld.so.cache~: Permission denied
sudo ldconfig
[Enter password]
[Finishes very quickly with no output whatsoever]
if you are on linux may this can help:
run this two scripts from /scripts/linux/ with root privileges:
./install_dependencies.sh
./install_codeblocks.sh
first look for the location of the libfmodex.so library. It should be in the libs path in the same directory as the application you try to start.
like this
someApp
libs/libfmodex.so
If this is not the case, copy it over there (should usually be done by make).
If still not ok use ldd.
ldd someApp
This will show you, where someApp looks for the missing library.
The following options are now available to you:
adjust LD_LIBRARY_PATH to include a directory, where your lib(.so files) is located
use ldconfig -l /path/to/lib/libfmodex.so

Resources