hi there i have a problem to generate a debian package
i have 2 files to install 1 is a BASH SCRIPT
the other is .DESKTOP FILE
/kate-folder-service-menu-0.1.0$ tree
.
└── usr
├── bin
│ └── ktexeditor-open-folder
└── share
└── kde4
└── services
└── ServiceMenus
└── kate-folder.desktop
Now i have created all the stuff, with
dh_make -s -c gpl
i have edited:
-control file
-copyright file
-rules file
in the rules file i have made :
#!/usr/bin/make -f
# %:
# dh $# --with-lzma
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
configure: configure-stamp
configure-stamp:
dh_testdir
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
touch $#
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
binary-indep: build install
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
install --mode=777 -t debian/usr/bin usr/bin/ktexeditor-open-folder
install --mode=644 -t debian/usr/share/kde4/services/ServiceMenus usr/share/kde4/services/ServiceMenus/kate-folder.desktop
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
now i did
debuild -uc -us --source-option=--include-binaries --source-option=-isession
and finally this
sudo pbuilder build MYSTUFF.dsc
but this bastard generates the debian package without the script and the service menu :D
dpkg --contents kate-folder-service-menu_0.1.0-1_i386.deb
drwxr-xr-x root/root 0 2012-04-14 14:53 ./
drwxr-xr-x root/root 0 2012-04-14 14:53 ./usr/
drwxr-xr-x root/root 0 2012-04-14 14:53 ./usr/share/
drwxr-xr-x root/root 0 2012-04-14 14:53 ./usr/share/doc/
drwxr-xr-x root/root 0 2012-04-14 14:53 ./usr/share/doc/kate-folder-service-menu/
-rw-r--r-- root/root 201 2012-04-12 11:16 ./usr/share/doc/kate-folder-service-menu/README.Debian
-rw-r--r-- root/root 1239 2012-04-12 15:31 ./usr/share/doc/kate-folder-service-menu/copyright
-rw-r--r-- root/root 152 2012-04-12 15:55 ./usr/share/doc/kate-folder-service-menu/changelog.Debian.gz
That must be an ancient dh_make if it's giving you old-style debhelper rules.
I suggest a modern minimal debian/rules:
#!/usr/bin/make -f
%:
dh $#
Then put this in debian/install:
usr/bin/ktexeditor-open-folder
usr/share/kde4/services/ServiceMenus/kate-folder.desktop
That'll use dh_install to put them in the right place, and do all the other usual stuff to generate the package.
Related
I am trying to create a shared library using gcc and make. I have the following section in the Makefile to compile the shared library object:
# The library build step.
lib : $(DHLLOBJS)
$(CC) $(XCFLAGS) $(SCFLAGS)$(SLIB).1 $(INCFLAGS) -o $(LIB_DIR)/$(SLIB).1.0 \
$(DLOPATHS) $(LNKFLAGS)
ln -sf $(LIB_DIR)/$(SLIB).1.0 $(LIB_DIR)/$(SLIB).1
ln -sf $(LIB_DIR)/$(SLIB).1.0 $(LIB_DIR)/$(SLIB)
The above doesn't throw any compilation errors or file system errors but the symlinks are described as dangling as shown by a chmod command:
$ sudo chmod 0755 ../lib/*
chmod: cannot operate on dangling symlink '../lib/libdhlim.so'
chmod: cannot operate on dangling symlink '../lib/libdhlim.so.1'
and the ls command output below shows the lines 5 and 6 in red:
$ ls -la lib/
total 29
drwxrwxrwx 1 root root 376 Jul 5 21:13 .
drwxrwxrwx 1 root root 4096 Jul 5 21:13 ..
lrwxrwxrwx 1 root root 21 Jul 5 21:13 libdhlim.so -> ./lib/libdhlim.so.1.0
lrwxrwxrwx 1 root root 21 Jul 5 21:13 libdhlim.so.1 -> ./lib/libdhlim.so.1.0
-rwxrwxrwx 1 root root 23792 Jul 5 21:13 libdhlim.so.1.0
When I run the same set of commands manually, they work fine. Is there something I am doing wrong here?
The problem is that you use relative paths but don't create the links with the ln option -r.
Try these as the last two lines:
ln -sfr $(LIB_DIR)/$(SLIB).1.0 $(LIB_DIR)/$(SLIB).1
ln -sfr $(LIB_DIR)/$(SLIB).1.0 $(LIB_DIR)/$(SLIB)
-r, --relative
with -s, create links relative to link location
I have tried lot by searching goggle to solve it.but unable to compile as per documentation in below GitHub.
Pg_Audit Extention
below is the env. for my postgres user.
export PGHOME=/var/lib/pgsql/
export PGDATA=/var/lib/pgsql/11/data/
export PGDATABASE=postgres
export PGUSER=postgres
export PGPORT=xxxx
export PGLOCALEDIR=/usr/pgsql-11/share/
Following below STEPS. I am using to make install/compile.
-bash-4.2$ pwd
/var/lib/pgsql
-bash-4.2$ cd pgaudit-REL_11_STABLE/
-bash-4.2$ pwd
/var/lib/pgsql/pgaudit-REL_11_STABLE
-bash-4.2$ ll
total 528
drwx------. 2 postgres postgres 25 May 23 2019 expected
-rw-------. 1 postgres postgres 171 May 23 2019 LICENSE
-rw-------. 1 postgres postgres 548 May 23 2019 Makefile
-rw-------. 1 postgres postgres 175 May 23 2019 pgaudit--1.3--1.3.1.sql
-rw-------. 1 postgres postgres 615 May 23 2019 pgaudit--1.3.1.sql
-rw-------. 1 postgres postgres 63517 May 23 2019 pgaudit.c
-rw-------. 1 postgres postgres 35 May 23 2019 pgaudit.conf
-rw-------. 1 postgres postgres 145 May 23 2019 pgaudit.control
-rw-------. 1 postgres postgres 266312 Feb 9 11:48 pgaudit.o
-rwx------. 1 postgres postgres 157624 Feb 9 11:48 pgaudit.so
-rw-------. 1 postgres postgres 17312 May 23 2019 README.md
drwx------. 2 postgres postgres 25 May 23 2019 sql
drwx------. 2 postgres postgres 25 May 23 2019 test
-bash-4.2$
-bash-4.2$ make check USE_PGXS=1
"make check" is not supported.
Do "make install", then "make installcheck" instead.
-bash-4.2$ make install
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/in
clude/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o pgaudit.bc pgaudit.c
make: /opt/rh/llvm-toolset-7/root/usr/bin/clang: Command not found
make: *** [pgaudit.bc] Error 127
-bash-4.2$
I also copied pg_audit.so
scp -r /var/lib/pgsql/pgaudit-REL_11_STABLE/pgaudit.so /usr/pgsql-11/share/contrib/
cd /usr/pgsql-11/share/contrib/
/usr/pgsql-11/share/contrib
-bash-4.2$ ll
total 176
-rwx------. 1 root root 157624 Feb 10 07:43 pgaudit.so
-rw-------. 1 root root 14875 Feb 10 08:10 pgaudit.sql
-rw-r--r--. 1 root root 1644 Aug 7 2019 sepgsql.sql
-bash-4.2$ pwd
/usr/pgsql-11/share/contrib
also when i use below command getting below error.
-bash-4.2$ make install PGUSER=postgres USE_PGXS=1 PATH=/usr/pgsql-11/bin:{PATH}
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/in
clude/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o pgaudit.bc pgaudit.c
make: /opt/rh/llvm-toolset-7/root/usr/bin/clang: Command not found
make: *** [pgaudit.bc] Error 127
I am missing something related to copying or setting env. please help me.
Edit: I go through suggested by Laurenz Albe in below answer. now getting below error.
[root#ip- pgaudit-REL_11_STABLE]# /usr/bin/make install PGUSER=postgres USE_PGXS=1 with_llvm=no make -e PATH=/usr/pgsql-11/bin:{PATH}
/usr/bin/mkdir -p '/usr/lib64/pgsql'
/usr/bin/mkdir -p '/usr/share/pgsql/extension'
/usr/bin/mkdir -p '/usr/share/pgsql/extension'
/bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c -m 755 pgaudit.so '/usr/lib64/pgsql/pgaudit.so'
/usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh: line 75: uname: command not found
/usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh: line 326: sed: command not found
/usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh: line 461: exec: cp: not found
/usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh: line 1: rm: command not found
make: *** [install-lib-shared] Error 1
i have checked in /usr/bin all required utilities are available.
[root#ip- pgaudit-REL_11_STABLE]# ls -lrth /usr/bin/ | grep uname
lrwxrwxrwx. 1 root root 7 Jun 18 2019 uname26 -> setarch
-rwxr-xr-x. 1 root root 29K Jan 23 19:07 uname
[root#ip pgaudit-REL_11_STABLE]# ls -lrth /usr/bin/ | grep sed
-rwxr-xr-x. 1 root root 75K Aug 1 2018 sed
-rwxr-xr-x. 2 root root 53K Feb 19 2019 psed
[root#ip pgaudit-REL_11_STABLE]# ls -lrth /usr/bin/ | grep exec
-rwxr-xr-x. 1 root root 16K Aug 2 2018 msgexec
[root#ip pgaudit-REL_11_STABLE]# ls -lrth /usr/bin/ | grep rm
-rwxr-xr-x. 1 root root 41K Jan 23 19:07 rmdir
Now getting below error. I am really not able to understand what error want to say. please help.
[root# pgaudit-REL_11_STABLE]# make install PGUSER=postgres USE_PGXS=1 PATH=/usr/pgsql-11/bin:$PATH with_llvm=no make -e
/usr/bin/mkdir -p '/usr/lib64/pgsql'
/usr/bin/mkdir -p '/usr/share/pgsql/extension'
/usr/bin/mkdir -p '/usr/share/pgsql/extension'
/bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c -m 755 pgaudit.so '/usr/lib64/pgsql/pgaudit.so'
/bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c -m 644 ./pgaudit.control '/usr/share/pgsql/extension/'
/bin/sh /usr/lib64/pgsql/pgxs/src/makefiles/../../config/install-sh -c -m 644 ./pgaudit--1.3.1.sql ./pgaudit--1.3--1.3.1.sql '/usr/share/pgsql/extension/'
make: *** No rule to make target `make'. Stop.
[root# pgaudit-REL_11_STABLE]#
You should install clang so that PGXS can build the byte code.
If you don't need JIT, a workaround is to build with
with_llvm=no make -e
To add /usr/pgsql-11/bin to the PATH, run
PATH=/usr/pgsql-11/bin:$PATH with_llvm=no make -e
I want to cross compile with Yocto a simple C Hello World for my Colibri iMX7 from Toradex.
The tree of my meta-hellow is as follow :
meta-hellow
├── conf
│ └── layer.conf
└── recipes-myhello
└── files
└── helloworld.c
└── README.TXT
└── myhello_0.0.bb
helloworld.c :
#include <stdio.h>
int main(int argc, char** argv)
{
printf("Hello World!\n");
return 0;
}
myhello_0.0.bb inspired from this one :
DESCRIPTION = "Hello world program"
#To prevent the LICENSE field not set error
LICENSE = "CLOSED"
PR = "r0"
SRC_URI = "file://helloworld.c \
file://README.txt"
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/helloworld.c -o helloworld
}
do_install() {
install -m 0755 -d ${D}${bindir} ${D}${docdir}/helloworld
install -m 0644 ${S}/helloworld ${D}${bindir}
install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/helloworld
}
I have added my layer in my my bblayers.conf like so ${TOPDIR}/../layers/meta-hellow \ and added the package in the local.conf like so IMAGE_INSTALL_append = "myhello".
But the problem I have, after installing it on my board with opkg install, is as follow :
root#colibri-imx7:~# myhello
-sh: /usr/bin/myhello: Permission denied
Why is there a Permission denied since I'm root ? Thank you for your help !
install -m 0644 ${S}/helloworld ${D}${bindir}
You are telling install to set no execute permission for anyone: try "0755" instead.
I'm trying to export a software to openwrt and i'm able to generate the ipk but the compiled file always gives me this error
-ash: scanReportProbe: not found
I've tried everything but i'm not able to make it work.
To be complete this is what i have done to prepare the environment:
git clone git://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make prereq
make menuconfig
[here i selected the package with the M and saved the configuration]
make tools/install
make toolchain/install
make package/scanReport_probe/compile
I have no idea of to fix this error so i need some hint of solution.
I don't think that the error is in the code but in casse is needed this is my program:
file structure
scanReport_probe
├── LICENSE
├── Makefile
├── README.md
└── src
├── data
│ └── THIS IS FOR DATA FILES.txt
├── runScript
│ └── scanReportProbe
├── scanReport_probe
│ ├── a.c
│ └── makefile
└── scanReport_probe.conf
makefile for openwrt
include $(TOPDIR)/rules.mk
# name of package
# version number of the sources you're using
# how many times you've released a package based on the above version number
PKG_NAME:=scanReport_probe
PKG_VERSION:=1.0
PKG_RELEASE:=1
PKG_LICENSE:=MIT
# sources will be unpacked into this directory (you shouldn't need to change this)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
#needed
include $(INCLUDE_DIR)/package.mk
# Metadata; information about what the package is for the ipkg listings
# to keep things simple, a number of fields have been left at their defaults
# and are not shown here.
define Package/scanReport_probe
SECTION:=utils
CATEGORY:=Utilities
TITLE:=scanReport_probe
URL:=https://github.com/luigiDB/scan-report_probe
TITLE:=Scan in monitor mode probe over wifi channel with periodic report to a server through http post.
MAINTAINER:=Please refer to github repository page
endef
define Package/scanReport_probe/description
This is the best tool ever.
Scan probe over wifi and at regualar interval send results via http post.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
CONFIGURE_VARS+= \
CC="$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)"
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR)/scanReport_probe $(TARGET_CONFIGURE_OPTS)
endef
# We'll use the OpenWrt defaults to configure and compile the package. Otherwise we'd need to define
# Build/Configure - commands to invoke a configure (or similar) script
# Build/Compile - commands used to run make or otherwise build the source
define Package/scanReport_probe/install
# Now that we have the source compiled (magic huh?) we need to copy files out of the source
# directory and into our ipkg file. These are shell commands, so make sure you start the lines
# with a TAB. $(1) here represents the root filesystem on the router.
# INSTALL_DIR, INSTALL_BIN, INSTALL_DATA are used for creating a directory, copying an executable,
# or a data file. +x is set on the target file for INSTALL_BIN, independent of it's mode on the host.
# make a directory for the config
$(INSTALL_DIR) $(1)/etc/scanReport_probe/
# copy the config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/scanReport_probe.conf $(1)/etc/scanReport_probe
# make a directory for some random data files required by scanReport_probe
$(INSTALL_DIR) $(1)/usr/share/scanReport_probe
# copy the data files
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/* $(1)/usr/share/scanReport_probe
#make directory bin
$(INSTALL_DIR) $(1)/bin
# copy the binary
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scanReport_probe/scanReportProbe $(1)/bin
#make the directory init.d in case isn't present
$(INSTALL_DIR) $(1)/etc/init.d
#copy script to init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/runScript/scanReportProbe $(1)/etc/init.d
endef
#runned post installation call the enable on the service
define Package/scanReport_probe/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for scanReportProbe"
/etc/init.d/scanReportProbe enable
fi
exit 0
endef
#runned pre uninstallation call the disable on the service
define Package/scanReport_probe/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for scanReportProbe"
/etc/init.d/scanReportProbe disable
fi
exit 0
endef
$(eval $(call BuildPackage,scanReport_probe))
a.c
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
}
makefile for c program
PROFILE = -O2 -s
CFLAGS = $(PROFILE)
LDFLAGS =
all: main
# build it
main: a.o
$(CC) $(LDFLAGS) a.o -o scanReportProbe
a.o: a.c
$(CC) $(CFLAGS) -c a.c
# clean it
clean:
rm *.o a
For -ash, IIRC, ash is a [boot] shell. It is saying that it can't find a particular command.
So, it may be one of:
(1) In your rc script section, you're doing /etc/init.d/scanReportProbe enable but the package you're building uses scanReport_probe. So, you may need to add or remove an _ here or there and/or some other renames so things match up.
(2) If the file structure you gave is the final one, I'm not sure the script is in the right directory.
(3) Are the permissions for the script correct (i.e. has execute)?
I want to set up file permissions for files I add to a docker image. I have this simple Dockerfile:
FROM ubuntu:utopic
WORKDIR /app
RUN groupadd -g 1000 baz && useradd -u 1000 -g baz baz -d /app -s /bin/false
RUN chown baz:baz /app && chmod g+s /app
# want this to be have group baz
ADD foo /app/
Building this with docker build -t abc . where there is a foo file in . creates an image. However, the permissions on /app/foo inside is not what I want.
docker run abc ls -la
total 12
drwxr-xr-x 2 baz baz 4096 Sep 2 23:21 .
drwxr-xr-x 37 root root 4096 Sep 3 07:27 ..
-rw-rw-r-- 1 root root 419 Sep 2 21:43 foo
Note that file foo doesn't belong to group baz despite the setgid bit being set on the /app dir. I could use RUN chown -R baz:baz /app after adding the files, but that casues the a copy of the layer to be created (Note the size of the two layers below):
docker history abc | head -n 3
IMAGE CREATED CREATED BY SIZE COMMENT
b95a3d798873 About a minute ago /bin/sh -c chown -R baz:baz /app 419 B
7e007196c116 About a minute ago /bin/sh -c #(nop) ADD file:2b91d9890a9c392390 419 B
Is there some way to get around this and have the ownership of files added be what I want?
Instead of adding foo directly, you could pack it as a tar-archive and set permissions for a specific UID/GID. Here is a post on how to do it:
https://unix.stackexchange.com/questions/61004/force-the-owner-and-group-for-the-contents-of-a-tar-file
After that you can just untar it within your Docker image (ADD untars automagically). You should see the permissions preserved without an additional layer.