Scripts installed by the deb package have wrong prefix

匆匆过客 提交于 2019-12-24 10:48:30

问题


Building our own deb packages we've run into the issue of having to patch manually some scripts so they get the proper prefix.

In particular,

  • We're building mono
  • We're using official tarballs.
  • The scripts that end up with wrong prefix are: mcs, xbuild, nunit-console4, etc

An example of a wrong script:

#!/bin/sh
exec /root/7digital-mono/mono/bin/mono \
      --debug $MONO_OPTIONS \
      /root/7digital-mono/mono/lib/mono/2.0/nunit-console.exe "$@"

What should be the correct end result:

#!/bin/sh
exec /usr/bin/mono \
      --debug $MONO_OPTIONS \
      /usr/lib/mono/2.0/nunit-console.exe "$@"

The workaround we're using in our build-package script before calling dpkg-buildpackage:

sed -i s,`pwd`/mono,/usr,g $TARGET_DIR/bin/mcs
sed -i s,`pwd`/mono,/usr,g $TARGET_DIR/bin/xbuild
sed -i s,`pwd`/mono,/usr,g $TARGET_DIR/bin/nunit-console
sed -i s,`pwd`/mono,/usr,g $TARGET_DIR/bin/nunit-console2
sed -i s,`pwd`/mono,/usr,g $TARGET_DIR/bin/nunit-console4

Now, what is the CORRECT way to fix this? Full debian package creation scripts here.

Disclaimer: I know there are preview packages of Mono 3 here! But those don't work for Squeeze.


回答1:


the proper way is to not call ./configure --prefix=$TARGET_DIR

this tells all the binaries/scripts/... that the installated files will end up in ${TARGET_DIR}, whereas they really should endup in /usr.

you can use the DESTDIR variable (as in make install DESTDIR=${TARGET_DIR}) to change (prefix) the installation target at install time (files will end-up in ${TARGET_DIR}/${prefix} but will only have ${prefix} "built-in")



来源:https://stackoverflow.com/questions/14713288/scripts-installed-by-the-deb-package-have-wrong-prefix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!