The officially official Devuan Forum!

You are not logged in.

#1 2021-04-15 09:49:12

dice
Member
Registered: 2020-11-22
Posts: 559  
Website

[SOLVED] Building .deb package from git source

Im wanting to have a try at creating .deb for the slstatus package but not sure how.

Could i just git clone slstatus and use dh_make from there or would be better off downloading the tar?

I successfully created a .deb of a shell script but a git repo is a bit daunting, is there any good tutorials for this type of build?

Edit: Ive read the f'ing manual but still confused im stuck at debian/rules

dh_usrlocal: debian/slstatus/usr/local/bin/slstatus is not a directory
make: *** [debian/rules:18: binary] Error 25
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2
debuild: fatal error at line 1182:
dpkg-buildpackage -us -uc -ui failed

Last edited by dice (2021-04-15 10:16:21)

Offline

#2 2021-04-15 10:44:38

GlennW
Member
From: Brisbane, Australia
Registered: 2019-07-18
Posts: 644  

Re: [SOLVED] Building .deb package from git source

Whenever I get stuck like this I create the directories... and re-run the command.

use

locate debian/slstatus/usr/local/bin/slstatus

work your way back from there...

create directory...

mkdir debian/slstatus/usr/local/bin/slstatus

See if that helps. Sometimes it's a permission to write by the program.

see how you go.


pic from 1993, new guitar day.

Offline

#3 2021-04-15 11:17:18

ShorTie
Member
Registered: 2020-05-14
Posts: 21  

Re: [SOLVED] Building .deb package from git source

"is there any good tutorials", Nope
There is like no tutes on writing a deb that I can find.

To me it's looking for a directory to include in the deb.

dh_usrlocal: debian/slstatus/usr/local/bin/slstatus is not a directory

I'd say you need to add in your rules file to create it

mkdir -vp debian/slstatus/usr/local/bin

/usr/local/bin/slstatus only makes sense to me as a program, not a directory

Good luck
It's a matter of play to get it working

Offline

#4 2021-04-15 12:40:11

dice
Member
Registered: 2020-11-22
Posts: 559  
Website

Re: [SOLVED] Building .deb package from git source

Thanks for the hints. Figured it out somewhat from dwm apt source.

slstatus-1.0/debian/rules

#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

SHELL := sh -e

%:
        dh ${@}

override_dh_auto_clean:
        rm -f config.h
        $(MAKE) clean

override_dh_auto_install:
        $(MAKE) install DESTDIR=$(CURDIR)/debian/slstatus PREFIX=/usr

        mv debian/slstatus/usr/bin/slstatus debian/slstatus/usr/bin/slstatus.default
        ln -s slstatus.1.gz debian/slstatus/usr/share/man/man1/slstatus.default.1.gz

Last edited by dice (2021-04-15 12:47:19)

Offline

#5 2021-04-15 12:45:27

dice
Member
Registered: 2020-11-22
Posts: 559  
Website

Re: [SOLVED] Building .deb package from git source

can see the new marked SOLVED link in op too, nice addition admin.

Offline

#6 2021-04-15 13:50:23

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] Building .deb package from git source

The best way to create .deb packages is with the debmake command.

dice wrote:

any good tutorials

Have you seen https://www.debian.org/doc/manuals/debmake-doc/?

I made a package for slstatus a while ago, here's a link to my debian directory tarball: https://download.opensuse.org/repositor … ian.tar.xz

dice wrote:
       ln -s slstatus.1.gz debian/slstatus/usr/share/man/man1/slstatus.default.1.gz

Was the man page not installed automatically by dh_installman(1)?

EDIT: corrected download link.

Last edited by Head_on_a_Stick (2021-04-15 13:52:10)


Brianna Ghey — Rest In Power

Offline

#7 2021-04-15 14:16:17

dice
Member
Registered: 2020-11-22
Posts: 559  
Website

Re: [SOLVED] Building .deb package from git source

Head_on_a_Stick wrote:

The best way to create .deb packages is with the debmake command.

dice wrote:

any good tutorials

Have you seen https://www.debian.org/doc/manuals/debmake-doc/?

I made a package for slstatus a while ago, here's a link to my debian directory tarball: https://download.opensuse.org/repositor … ian.tar.xz

dice wrote:
       ln -s slstatus.1.gz debian/slstatus/usr/share/man/man1/slstatus.default.1.gz

Was the man page not installed automatically by dh_installman(1)?

EDIT: corrected download link.

Thanks.

I fear any package for slstatus will be mostly personal via source, but its good to have a binary for easy installation. What features does your package have as default settings?

The default debian/rules were not enough to successfully build the deb so i borrowed the rules from apt source dwm and modified to suit. It would have picked up man page with dh_installman i suppose.

Offline

#8 2021-04-15 14:42:57

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] Building .deb package from git source

dice wrote:

What features does your package have as default settings?

I cut the guts out of the suckless original, here's my de-commented config.def.h:

const unsigned int interval = 1000;

static const char unknown_str[] = "n/a";

#define MAXLEN 2048

static const struct arg args[] = {
   { load_avg,     " %s  •  ", NULL },
   { battery_perc, "%s",       "BAT0" },
   { datetime,     "%s",       "%  •  %F  •  %T" },
};

I also removed the unwanted components and associated lines in the Makefile.

The resultant binary is tiny:

-rwxr-xr-x 1 root root 22656 May 12  2019 /usr/bin/slstatus

But the memory usage is about the same as a (dash) shell script:

268.0 KiB + 338.0 KiB = 606.0 KiB       status
240.0 KiB + 392.0 KiB = 632.0 KiB       slstatus

*shrugs*


Brianna Ghey — Rest In Power

Offline

#9 2021-04-15 14:49:50

dice
Member
Registered: 2020-11-22
Posts: 559  
Website

Re: [SOLVED] Building .deb package from git source

ive got volume via dev/mixer and cpu temp which bumps my settings up somewhat.

-rwxr-xr-x 1 root root 31784 Apr 15 22:14 /usr/bin/slstatus

static const struct arg args[] = {
        /* function format          argument */
        { vol_perc,     " V: %s % | ",          "/dev/mixer" },
        { run_command, " C: %s | " ,            "/home/dice/bin/temp" },
        { battery_perc,  "B: %2s %% | ",      "BAT1"           },
        { datetime, "T: %s",           "%R" },
};

Offline

#10 2021-04-15 14:54:31

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] Building .deb package from git source

Did you remove the unwanted stuff from the components directory and delete the lines relating to them in the Makefile? That reduces the size of the binary considerably.


Brianna Ghey — Rest In Power

Offline

#11 2021-04-15 14:58:25

dice
Member
Registered: 2020-11-22
Posts: 559  
Website

Re: [SOLVED] Building .deb package from git source

Head_on_a_Stick wrote:

Did you remove the unwanted stuff from the components directory and delete the lines relating to them in the Makefile? That reduces the size of the binary considerably.


so just delete the components not needed in the Makefile as well?

wouldnt deleting the lines in the makefile be enough?

eg;

REQ = util
COM =\
        components/battery\
        components/cpu\
        components/datetime\
        components/disk\
        components/entropy\
        components/hostname\
        components/ip\
        components/kernel_release\
        components/keyboard_indicators\
        components/keymap\
        components/load_avg\
        components/netspeeds\
        components/num_files\
        components/ram\
        components/run_command\
        components/separator\
        components/swap\
        components/temperature\
        components/uptime\
        components/user\
        components/volume\
        components/wifi

Last edited by dice (2021-04-15 15:01:52)

Offline

#12 2021-04-15 15:00:25

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] Building .deb package from git source

Yes, that's right.

Here's mine:

COM =\
        components/battery\
        components/datetime\
        components/load_avg

I also cut up the load_avg component so that it only displays the first value (from the last minute) smile


Brianna Ghey — Rest In Power

Offline

#13 2021-04-15 15:14:36

dice
Member
Registered: 2020-11-22
Posts: 559  
Website

Re: [SOLVED] Building .deb package from git source

Head_on_a_Stick wrote:

Yes, that's right.

Here's mine:

COM =\
        components/battery\
        components/datetime\
        components/load_avg

I also cut up the load_avg component so that it only displays the first value (from the last minute) smile

Got it down to this.

-rwxr-xr-x 1 root root 23336 Apr 15 22:14 /usr/bin/slstatus

REQ = util
COM =\
        components/battery\
        components/datetime\
        components/run_command\
        components/volume\

Thanks for the tips.

Last edited by dice (2021-04-15 15:15:04)

Offline

Board footer